mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-26 21:09:42 +01:00
improve test scripts
* validated with shellcheck * allow to evaluate just one for convenience * reduce verbosity and improve debugging output
This commit is contained in:
parent
7dbceec472
commit
8229a43214
2 changed files with 41 additions and 10 deletions
35
tests/eval-one.sh
Executable file
35
tests/eval-one.sh
Executable 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"
|
|
@ -1,15 +1,11 @@
|
|||
#!/bin/sh
|
||||
set -efu
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
echo "### Evaluating all profiles ###"
|
||||
echo
|
||||
|
||||
# shellcheck disable=SC2044
|
||||
for profile in $(find . -name default.nix); do
|
||||
echo evaluating $profile >&2
|
||||
|
||||
nix-build '<nixpkgs/nixos>' \
|
||||
-I nixos-config=tests/eval-test.nix \
|
||||
-I nixos-hardware-profile=$profile \
|
||||
-A system \
|
||||
--dry-run
|
||||
./tests/eval-one.sh "$profile"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue