chore: print execution times for integration tests

This commit is contained in:
DavHau 2022-08-20 18:32:48 +02:00
parent 479dc304b5
commit 027083be7d
2 changed files with 20 additions and 0 deletions

View File

@ -23,9 +23,11 @@
nix
]
''
cd $TMPDIR
dir=$1
shift
echo -e "\ntesting example for $dir"
start_time=$(date +%s)
cp -r ${examples}/$dir/* .
chmod -R +w .
nix flake lock --override-input dream2nix ${../../.}
@ -37,6 +39,10 @@
nix eval --read-only --no-allow-import-from-derivation .#default.name
fi
nix flake check "$@"
end_time=$(date +%s)
elapsed=$(( end_time - start_time ))
echo -e "testing example for $dir took $elapsed seconds"
echo "$elapsed sec: $dir" >> $STATS_FILE
'';
in
utils.writePureShellScript
@ -45,6 +51,7 @@ in
parallel
]
''
export STATS_FILE=$(mktemp)
if [ -z ''${1+x} ]; then
parallel --halt now,fail=1 -j$(nproc) -a <(ls ${examples}) ${testScript}
else
@ -52,4 +59,7 @@ in
shift
${testScript} $arg1 "$@"
fi
echo -e "\nExecution times:"
cat $STATS_FILE | sort --numeric-sort
rm $STATS_FILE
''

View File

@ -23,15 +23,21 @@
nix
]
''
cd $TMPDIR
dir=$1
shift
echo -e "\nrunning test $dir"
start_time=$(date +%s)
cp -r ${tests}/$dir/* .
chmod -R +w .
nix flake lock --override-input dream2nix ${../../.}
nix run .#resolveImpure || echo "no resolveImpure probably?"
nix build
nix flake check
end_time=$(date +%s)
elapsed=$(( end_time - start_time ))
echo -e "testing example for $dir took $elapsed seconds"
echo "$elapsed sec: $dir" >> $STATS_FILE
'';
in
utils.writePureShellScript
@ -40,6 +46,7 @@ in
parallel
]
''
export STATS_FILE=$(mktemp)
if [ -z ''${1+x} ]; then
parallel --halt now,fail=1 -j$(nproc) -a <(ls ${tests}) ${testScript}
else
@ -48,4 +55,7 @@ in
${testScript} $arg1 "$@"
fi
echo "done running integration tests"
echo -e "\nExecution times:"
cat $STATS_FILE | sort --numeric-sort
rm $STATS_FILE
''