diff options
author | David Sterba <dsterba@suse.com> | 2015-08-25 18:32:41 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-08-31 19:25:12 +0200 |
commit | e547fdb16667b97ad3db4ce08a3a46b7449497f2 (patch) | |
tree | 32df3bcc539123f0bfca3017402c8e659b8bc305 /tests | |
parent | c0f32c54a3de142201847cbcbf83ae83a4b76fd2 (diff) |
btrfs-progs: tests, add more common helpers
Add support for failures of commands, log the output.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/common b/tests/common index 2d337b0b..cf463e82 100644 --- a/tests/common +++ b/tests/common @@ -9,6 +9,12 @@ _fail() exit 1 } +# log a message to the results file +_log() +{ + echo "$*" | tee -a $RESULTS +} + _not_run() { echo " [NOTRUN] $*" @@ -29,6 +35,13 @@ run_check_stdout() "$@" 2>&1 | tee -a $RESULTS || _fail "failed: $@" } +# same as run_check but does not fail the test, output is logged +run_mayfail() +{ + echo "############### $@" >> $RESULTS 2>&1 + "$@" >> $RESULTS 2>&1 || _log "failed (ignored): $@" +} + check_prereq() { if ! [ -f $TOP/$1 ]; then |