2022-08-11 22:27:21 +03:00
|
|
|
{
|
|
|
|
self,
|
|
|
|
lib,
|
|
|
|
async,
|
|
|
|
bash,
|
|
|
|
coreutils,
|
|
|
|
git,
|
|
|
|
parallel,
|
|
|
|
nix,
|
|
|
|
utils,
|
|
|
|
dream2nixWithExternals,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
l = lib // builtins;
|
|
|
|
tests = ./tests;
|
|
|
|
testScript =
|
|
|
|
utils.writePureShellScript
|
|
|
|
[
|
|
|
|
async
|
|
|
|
bash
|
|
|
|
coreutils
|
|
|
|
git
|
|
|
|
nix
|
|
|
|
]
|
|
|
|
''
|
2022-08-20 19:32:48 +03:00
|
|
|
cd $TMPDIR
|
2022-08-11 22:27:21 +03:00
|
|
|
dir=$1
|
|
|
|
shift
|
|
|
|
echo -e "\nrunning test $dir"
|
2022-08-20 19:32:48 +03:00
|
|
|
start_time=$(date +%s)
|
2022-08-11 22:27:21 +03:00
|
|
|
cp -r ${tests}/$dir/* .
|
|
|
|
chmod -R +w .
|
|
|
|
nix flake lock --override-input dream2nix ${../../.}
|
|
|
|
nix run .#resolveImpure || echo "no resolveImpure probably?"
|
|
|
|
nix build
|
2022-08-12 00:11:54 +03:00
|
|
|
nix flake check
|
2022-08-20 19:32:48 +03:00
|
|
|
end_time=$(date +%s)
|
|
|
|
elapsed=$(( end_time - start_time ))
|
|
|
|
echo -e "testing example for $dir took $elapsed seconds"
|
|
|
|
echo "$elapsed sec: $dir" >> $STATS_FILE
|
2022-08-11 22:27:21 +03:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
utils.writePureShellScript
|
|
|
|
[
|
|
|
|
coreutils
|
|
|
|
parallel
|
|
|
|
]
|
|
|
|
''
|
2022-08-20 19:32:48 +03:00
|
|
|
export STATS_FILE=$(mktemp)
|
2022-08-11 22:27:21 +03:00
|
|
|
if [ -z ''${1+x} ]; then
|
2022-08-24 14:14:07 +03:00
|
|
|
JOBS=''${JOBS:-$(nproc)}
|
|
|
|
parallel --halt now,fail=1 -j$JOBS -a <(ls ${tests}) ${testScript}
|
2022-08-11 22:27:21 +03:00
|
|
|
else
|
|
|
|
arg1=$1
|
|
|
|
shift
|
|
|
|
${testScript} $arg1 "$@"
|
|
|
|
fi
|
|
|
|
echo "done running integration tests"
|
2022-08-20 19:32:48 +03:00
|
|
|
echo -e "\nExecution times:"
|
|
|
|
cat $STATS_FILE | sort --numeric-sort
|
|
|
|
rm $STATS_FILE
|
2022-08-11 22:27:21 +03:00
|
|
|
''
|