Add a test to confirm the initrd's are the same, and that rebuilds are fast
This commit is contained in:
parent
6c13b984d4
commit
2986dec150
@ -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
|
||||
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 requires support on the build machine:
|
||||
|
||||
3
size-test/.gitignore
vendored
Normal file
3
size-test/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
netboot-base
|
||||
netboot-incremental
|
||||
netboot-incremental.drv
|
||||
3
size-test/base.nix
Normal file
3
size-test/base.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
imports = [ ../quickly.nix ];
|
||||
}
|
||||
27
size-test/build.sh
Executable file
27
size-test/build.sh
Executable 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!"
|
||||
4
size-test/incremental.nix
Normal file
4
size-test/incremental.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
imports = [ ./base.nix ];
|
||||
services.nginx.enable = true;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user