Skip to content

Commit

Permalink
tst_test.sh: Add sanity checks
Browse files Browse the repository at this point in the history
Given that when the test is executed the path to the LTP test is in PATH
and that the filename of the script is in $0 we can as well grep the
test source to look for common mistakes on runtime. This just adds a
check if the test calls tst_run function, but the possibilities are much
greater.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
  • Loading branch information
metan-ucw committed Oct 12, 2016
1 parent fe94afe commit 7ca6be8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions testcases/lib/tst_test.sh
Expand Up @@ -400,3 +400,9 @@ tst_run()

tst_do_exit
}

if TST_TEST_PATH=$(which $0) 2>/dev/null; then
if ! grep -q tst_run "$TST_TEST_PATH"; then
tst_brk TBROK "Test $0 must call tst_run!"
fi
fi

0 comments on commit 7ca6be8

Please sign in to comment.