diff --git a/default.nix b/default.nix index c69a8ec..b04bef3 100644 --- a/default.nix +++ b/default.nix @@ -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 "$@" ''; } diff --git a/tests/00-version.sh b/tests/00-version.sh index 51f4d9d..f8b3bf4 100644 --- a/tests/00-version.sh +++ b/tests/00-version.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:' diff --git a/tests/entrypoint.sh b/tests/entrypoint.sh index 02cb6f7..bd84e28 100644 --- a/tests/entrypoint.sh +++ b/tests/entrypoint.sh @@ -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 "------------------------------"