diff --git a/tests/pseudofiles/fixture.nix b/tests/pseudofiles/fixture.nix new file mode 100644 index 0000000..043b23d --- /dev/null +++ b/tests/pseudofiles/fixture.nix @@ -0,0 +1,47 @@ +{ + pseudofile +}: let + inherit (pseudofile) dir; + structure = { + service = dir { + s6-linux-init-runleveld = dir { + notification-fd = { file = "3"; }; + run = { + file = '' + hello + world + ''; + mode = "0755"; + }; + }; + s6-linux-init-shutdownd = dir { + fifo = { + type = "i"; + subtype = "f"; + mode = "0600"; + }; + run = { + file = '' + s6-linux-init/bin/s6-linux-init-shutdownd -c "/etc/s6-linux-init/current" -g 3000 + ''; + mode = "0755"; + }; + + }; + s6-svscan-log = dir { + fifo = { + type = "i"; + subtype = "f"; + mode = "0600"; + }; + notification-fd = { file = "3"; }; + run = { + file = '' + gdsgdfgsdgf + ''; + }; + }; + }; + uncaught-logs = (dir {}) // {mode = "2750";}; + }; +in pseudofile.write "pseudo.s6-init" structure diff --git a/tests/pseudofiles/run.sh b/tests/pseudofiles/run.sh deleted file mode 100755 index 81f407e..0000000 --- a/tests/pseudofiles/run.sh +++ /dev/null @@ -1,16 +0,0 @@ -set -e - -expr=$(cat <<"EXPR" -let - overlay = import ; - nixpkgs = import { overlays = [overlay]; }; -in nixpkgs.pkgs.callPackage ./test.nix {} -EXPR - ) - -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 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")" diff --git a/tests/pseudofiles/test.nix b/tests/pseudofiles/test.nix old mode 100644 new mode 100755 index 043b23d..3a2ad10 --- a/tests/pseudofiles/test.nix +++ b/tests/pseudofiles/test.nix @@ -1,47 +1,20 @@ { - pseudofile -}: let - inherit (pseudofile) dir; - structure = { - service = dir { - s6-linux-init-runleveld = dir { - notification-fd = { file = "3"; }; - run = { - file = '' - hello - world - ''; - mode = "0755"; - }; - }; - s6-linux-init-shutdownd = dir { - fifo = { - type = "i"; - subtype = "f"; - mode = "0600"; - }; - run = { - file = '' - s6-linux-init/bin/s6-linux-init-shutdownd -c "/etc/s6-linux-init/current" -g 3000 - ''; - mode = "0755"; - }; - - }; - s6-svscan-log = dir { - fifo = { - type = "i"; - subtype = "f"; - mode = "0600"; - }; - notification-fd = { file = "3"; }; - run = { - file = '' - gdsgdfgsdgf - ''; - }; - }; - }; - uncaught-logs = (dir {}) // {mode = "2750";}; - }; -in pseudofile.write "pseudo.s6-init" structure + liminix +, nixpkgs +}: +let + overlay = import "${liminix}/overlay.nix"; + nixpkgs = import { overlays = [overlay]; }; + fixture = nixpkgs.callPackage ./fixture.nix {}; + check = nixpkgs.runCommand "check" { + nativeBuildInputs = with nixpkgs; [ squashfsTools qprint ] ; + } '' +set -e +diff ${fixture} ${./result.expected} +test -f /tmp/out.squashfs && rm /tmp/out.squashfs +mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf ${fixture} -quiet -no-progress +foo="$(unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run)" +test "$foo" = "$(printf "hello\nworld")" +date > $out +''; +in { inherit check; }