diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-30 11:28:53 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-30 11:28:53 -0400 |
commit | caa444b44f1ce1974bd9f46c68e45ff26d251bdf (patch) | |
tree | 956fec4a0234572df2200067e50f5d84136ac750 /tests | |
parent | 252f9425fc9a5fc8a7e152772b7af67ff7869652 (diff) | |
download | stasis-caa444b44f1ce1974bd9f46c68e45ff26d251bdf.tar.gz |
Implement missing SKIP conditions
* The not (bang) overrides the return code. Split the command from the if-statement to obtain the real code, not just true/false
* Print the last n lines of the log only when there's something to print
Diffstat (limited to 'tests')
-rw-r--r-- | tests/setup.sh | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/setup.sh b/tests/setup.sh index 743fafd..0875cac 100644 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -103,13 +103,23 @@ run_command() { local cmd="${@}" local lines_on_error=100 /bin/echo "Testing: $cmd " - if ! $cmd &>"$logfile"; then - echo "... FAIL" - echo "#" - echo "# Last $lines_on_error line(s) follow:" - echo "#" - tail -n $lines_on_error "$logfile" - (( STASIS_TEST_RESULT_FAIL++ )) + + $cmd &>"$logfile" + code=$? + if (( code )); then + if (( code == 127 )); then + echo "... SKIP" + (( STASIS_TEST_RESULT_SKIP++ )) + else + echo "... FAIL" + if (( $(wc -c "$logfile" | cut -d ' ' -f 1) > 1 )); then + echo "#" + echo "# Last $lines_on_error line(s) follow:" + echo "#" + tail -n $lines_on_error "$logfile" + fi + (( STASIS_TEST_RESULT_FAIL++ )) + fi else echo "... PASS" (( STASIS_TEST_RESULT_PASS++ )) |