run-tests cd into each test directory before running it

This commit is contained in:
Daniel Barlow
2022-09-23 17:21:43 +01:00
parent 1bc8fd7873
commit 7a4314baee
4 changed files with 14 additions and 12 deletions

View File

@@ -2,16 +2,16 @@ set -e
expr=$(cat <<"EXPR"
let
overlay = import ./overlay.nix;
nixpkgs = import <nixpkgs> ( {overlays = [overlay]; });
structure = import ./tests/pseudofiles/structure.nix;
overlay = import <liminix/overlay.nix>;
nixpkgs = import <nixpkgs> { overlays = [overlay]; };
structure = import ./structure.nix;
in nixpkgs.pkgs.pseudofile "pseudo.s6-init" structure
EXPR
)
)
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-build -E "${expr}" -o tests/pseudofiles/result $*
diff tests/pseudofiles/result tests/pseudofiles/result.expected
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-build -E "${expr}" -o result $*
diff result result.expected
test -f /tmp/out.squashfs && rm /tmp/out.squashfs
nix-shell -p squashfsTools -p qprint --run "mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf tests/pseudofiles/result -quiet -no-progress"
nix-shell -p squashfsTools -p qprint --run "mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf result -quiet -no-progress"
foo="$(nix-shell -p squashfsTools --run 'unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run')"
test "$foo" = "$(printf "hello\nworld")"