2 Commits

Author SHA1 Message Date
zimbatm
0aa778c6a4 fixup! improve test scripts 2017-12-26 00:21:52 +00:00
zimbatm
8229a43214 improve test scripts
* validated with shellcheck
* allow to evaluate just one for convenience
* reduce verbosity and improve debugging output
2017-12-25 18:00:29 +00:00
2 changed files with 41 additions and 10 deletions

35
tests/eval-one.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
set -u
here=$(cd "$(dirname "$0")" && pwd)
if [ -z "$1" ]; then
echo "Usage: $0 <profile>"
exit 1
fi
profile=$1
logfile=$(mktemp)
# shellcheck disable=SC2039
echo -n "evaluating $profile: "
nix-build \
'<nixpkgs/nixos>' \
-I "nixos-config=$here/eval-test.nix" \
-I "nixos-hardware-profile=$profile" \
--dry-run \
--no-out-link \
--show-trace \
-A system > "$logfile" 2>&1
ret=$?
if [ "$ret" -gt 0 ]; then
echo ERROR
echo ===================================================================== >&2
cat "$logfile" >&2
else
echo OK
fi
rm "$logfile"
exit "$ret"

View File

@@ -1,15 +1,11 @@
#!/bin/sh #!/bin/sh
set -efu
set -e
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
for profile in $(find . -name default.nix); do echo "### Evaluating all profiles ###"
echo evaluating $profile >&2 echo
nix-build '<nixpkgs/nixos>' \ # shellcheck disable=SC2044
-I nixos-config=tests/eval-test.nix \ for profile in $(find . -name default.nix); do
-I nixos-hardware-profile=$profile \ ./tests/eval-one.sh "$profile"
-A system \
--dry-run
done done