mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 22:53:35 +00:00
btrfs-progs: tests, add more common helpers
Add support for failures of commands, log the output. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c0f32c54a3
commit
e547fdb166
13
tests/common
13
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
|
||||
|
Loading…
Reference in New Issue
Block a user