Re: [GUILT 10/28] Run test_failed if the exit status of a test script is bad.
From: Jeff Sipek <hidden>
Date: 2016-06-15 23:01:01
On Fri, Mar 21, 2014 at 08:31:48AM +0100, Per Cederqvist wrote:
There were two problems with the old code: - Since "set -e" is in effect (that is set in scaffold) the run-test script exited immediately if a t-*.sh script failed. This is not nice, as we want the error report that test_failed prints. - The code ran "cd -" between running the t-*.sh script and checking the exit status, so the exit status was lost. (Actually, the exit status was saved in $ERR, but nothing ever looked at $ERR.)
Oops :)
quoted hunk ↗ jump to hunk
Signed-off-by: Per Cederqvist <redacted> --- regression/run-tests | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)diff --git a/regression/run-tests b/regression/run-tests index a10e796..d39f9ef 100755 --- a/regression/run-tests +++ b/regression/run-tests@@ -55,11 +55,16 @@ function run_test # run the test cd "$REPODIR" > /dev/null - "$REG_DIR/t-$1.sh" 2>&1 > "$LOGFILE" - ERR=$? + if "$REG_DIR/t-$1.sh" 2>&1 > "$LOGFILE" + then + ERR=false + else + ERR=true
I'm going to comment on this here... Coding style. Guilt is a bit of a
hodge-podge of style as my personal style for shell changed over the years
and various contributors threw in some more. I need to get better at
spotting style mismatch during review. With that said, I have two comments
about the above:
(1) I'd put the 'then' on the same line as 'if' but I don't feel strongly
enough about this to reject this patch.
(2) Tabs for indentation. I do feel strongly about this one :)
Jeff.
+ fi + cd - > /dev/null - [ $? -ne 0 ] && test_failed + $ERR && test_failed diff -u "t-$1.out" "$LOGFILE" || test_failed echo "done." -- 1.8.3.1
-- I'm somewhere between geek and normal. - Linus Torvalds