From 00aa42b80320ad42e2958e71fc7231ccd7020b8f Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 29 Jan 2023 21:42:53 +0000 Subject: [PATCH] create ci.nix to run all tests --- ci.nix | 4 ++++ tests/pseudofiles/test.nix | 5 ++--- tests/smoke/test.nix | 9 ++++----- 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 ci.nix diff --git a/ci.nix b/ci.nix new file mode 100644 index 0000000..0469407 --- /dev/null +++ b/ci.nix @@ -0,0 +1,4 @@ +{ + smoke = import ./tests/smoke/test.nix; + pseudofiles = import ./tests/pseudofiles/test.nix; +} diff --git a/tests/pseudofiles/test.nix b/tests/pseudofiles/test.nix index 3a2ad10..8d68a31 100755 --- a/tests/pseudofiles/test.nix +++ b/tests/pseudofiles/test.nix @@ -6,7 +6,7 @@ let overlay = import "${liminix}/overlay.nix"; nixpkgs = import { overlays = [overlay]; }; fixture = nixpkgs.callPackage ./fixture.nix {}; - check = nixpkgs.runCommand "check" { +in nixpkgs.runCommand "check" { nativeBuildInputs = with nixpkgs; [ squashfsTools qprint ] ; } '' set -e @@ -16,5 +16,4 @@ mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf ${fixture} -quiet -no-progre foo="$(unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run)" test "$foo" = "$(printf "hello\nworld")" date > $out -''; -in { inherit check; } +'' diff --git a/tests/smoke/test.nix b/tests/smoke/test.nix index ed1c57d..566ab63 100644 --- a/tests/smoke/test.nix +++ b/tests/smoke/test.nix @@ -7,9 +7,9 @@ let img = (import liminix { liminix-config = ./configuration.nix; }).outputs.squashfs; pkgs = import {}; - check = pkgs.runCommand "check" { - nativeBuildInputs = with pkgs; [ squashfsTools s6-rc ] ; - } '' +in pkgs.runCommand "check" { + nativeBuildInputs = with pkgs; [ squashfsTools s6-rc ] ; +} '' destpath=$(mktemp -d)/smoke.img echo $destpath cleanup(){ test -n $destpath && test -d $destpath && chmod -R +w $destpath && rm -rf $destpath; } @@ -25,5 +25,4 @@ chmod -R +w $db test "$(s6-rc-db -c $db type lo.link)" = "oneshot" test "$(s6-rc-db -c $db type ntp)" = "longrun" echo OK > $out -''; -in { inherit check; } +''