create ci.nix to run all tests

This commit is contained in:
Daniel Barlow 2023-01-29 21:42:53 +00:00
parent a0380728a5
commit 00aa42b803
3 changed files with 10 additions and 8 deletions

4
ci.nix Normal file
View file

@ -0,0 +1,4 @@
{
smoke = import ./tests/smoke/test.nix;
pseudofiles = import ./tests/pseudofiles/test.nix;
}

View file

@ -6,7 +6,7 @@ let
overlay = import "${liminix}/overlay.nix"; overlay = import "${liminix}/overlay.nix";
nixpkgs = import <nixpkgs> { overlays = [overlay]; }; nixpkgs = import <nixpkgs> { overlays = [overlay]; };
fixture = nixpkgs.callPackage ./fixture.nix {}; fixture = nixpkgs.callPackage ./fixture.nix {};
check = nixpkgs.runCommand "check" { in nixpkgs.runCommand "check" {
nativeBuildInputs = with nixpkgs; [ squashfsTools qprint ] ; nativeBuildInputs = with nixpkgs; [ squashfsTools qprint ] ;
} '' } ''
set -e 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)" foo="$(unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run)"
test "$foo" = "$(printf "hello\nworld")" test "$foo" = "$(printf "hello\nworld")"
date > $out date > $out
''; ''
in { inherit check; }

View file

@ -7,7 +7,7 @@ let img = (import liminix {
liminix-config = ./configuration.nix; liminix-config = ./configuration.nix;
}).outputs.squashfs; }).outputs.squashfs;
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
check = pkgs.runCommand "check" { in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [ squashfsTools s6-rc ] ; nativeBuildInputs = with pkgs; [ squashfsTools s6-rc ] ;
} '' } ''
destpath=$(mktemp -d)/smoke.img destpath=$(mktemp -d)/smoke.img
@ -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 lo.link)" = "oneshot"
test "$(s6-rc-db -c $db type ntp)" = "longrun" test "$(s6-rc-db -c $db type ntp)" = "longrun"
echo OK > $out echo OK > $out
''; ''
in { inherit check; }