Add a test to confirm the initrd's are the same, and that rebuilds are fast

This commit is contained in:
Graham Christensen 2020-06-08 09:57:02 -04:00
parent 6c13b984d4
commit 2986dec150
No known key found for this signature in database
GPG Key ID: FE918C3A98C1030F
5 changed files with 41 additions and 0 deletions

View File

@ -14,6 +14,10 @@ Also, the future should include tests in this repo.
Initial testing reduced build time from 5-10 minutes per image to Initial testing reduced build time from 5-10 minutes per image to
15-30 seconds. 15-30 seconds.
The `./size-test/build.sh` test is able to build an incremental
netboot image in just 12 seconds, and the initrd is not rebuilt.
## Setting up recursive nix ## Setting up recursive nix
Setting up recursive Nix requires support on the build machine: Setting up recursive Nix requires support on the build machine:

3
size-test/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
netboot-base
netboot-incremental
netboot-incremental.drv

3
size-test/base.nix Normal file
View File

@ -0,0 +1,3 @@
{
imports = [ ../quickly.nix ];
}

27
size-test/build.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
set -eux
cd "$(dirname "$0")"
nix-build '<nixpkgs/nixos>' \
-I nixos-config=./base.nix \
-A config.system.build.ipxeBootDir \
--out-link ./netboot-base
nix-instantiate '<nixpkgs/nixos>' \
-I nixos-config=./incremental.nix \
-A config.system.build.ipxeBootDir \
--add-root ./netboot-incremental.drv --indirect
time nix-build ./netboot-incremental.drv \
--out-link ./netboot-incremental
ensureSame() (
test "$(realpath "./netboot-base/$1")" = "$(realpath "./netboot-incremental/$1")"
)
ensureSame bzImage
ensureSame initrd
echo "ok!"

View File

@ -0,0 +1,4 @@
{
imports = [ ./base.nix ];
services.nginx.enable = true;
}