Add verbose flag to test shell script

main
Brian Picciano 9 months ago
parent 2876b56afb
commit aa0d489e88
  1. 2
      default.nix
  2. 4
      tests/00-version.sh
  3. 18
      tests/entrypoint.sh

@ -167,6 +167,6 @@ in rec {
tests = pkgs.writeShellScript "isle-tests" ''
export PATH=$PATH:${appImage}/bin
test_dir=${./tests}
exec $SHELL $test_dir/entrypoint.sh
exec $SHELL $test_dir/entrypoint.sh "$@"
'';
}

@ -1,2 +1,4 @@
version="$(isle version)"
test "$(echo "$version" | wc -l)" -gt 0
echo "$version" | grep -q 'Release:'
echo "$version" | grep -q 'Platform:'
echo "$version" | grep -q 'Build Platform:'

@ -1,5 +1,18 @@
set -e
while [[ $# -gt 0 ]]; do
case $1 in
-v|--verbose)
VERBOSE=1
shift;
;;
*)
echo "USAGE: [-v|--verbose]"
exit 1
;;
esac
done
# cd into script's directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
@ -13,7 +26,10 @@ echo -e '\nrunning all tests...\n'
for file in $(find . -type f -name '*.sh' | grep -v entrypoint.sh | sort -n); do
echo "running test $file"
if ! $SHELL -e -x "$file" >"$tmp/$file.log" 2>&1; then
[ -z "$VERBOSE" ] && output="$tmp/$file.log" || output=/dev/stdout
if ! $SHELL -e -x "$file" >"$output" 2>&1; then
echo "TEST FAILED"
echo "output of test is as follows"
echo "------------------------------"

Loading…
Cancel
Save