summaryrefslogtreecommitdiff
path: root/tests/common
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2015-10-06 14:16:39 +0200
committerDavid Sterba <dsterba@suse.com>2015-10-21 14:29:26 +0200
commitc2e85337f6600bed1b348c9e86f83c27f753df6b (patch)
tree82f0c5c05d6dc696904b30d346ae9fef3e1e4479 /tests/common
parent982950b74b7754a99e8a2d302a57b1b4348f7574 (diff)
btrfs-progs: tests: print commands on terminal if requested
Set the variable TEST_LOG=tty (in the enviroment or as parameter to make) to print commands executed by 'run_check' helpers to terminal (ie. /dev/tty). This might be useful to see the test progress beside watching the results file. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/common b/tests/common
index 45713506..d70ce54a 100644
--- a/tests/common
+++ b/tests/common
@@ -24,6 +24,7 @@ _not_run()
run_check()
{
echo "############### $@" >> $RESULTS 2>&1
+ if [ "$TEST_LOG" = 'tty' ]; then echo "CMD: $@" > /dev/tty; fi
"$@" >> $RESULTS 2>&1 || _fail "failed: $@"
}
@@ -32,6 +33,7 @@ run_check()
run_check_stdout()
{
echo "############### $@" >> $RESULTS 2>&1
+ if [ "$TEST_LOG" = 'tty' ]; then echo "CMD(stdout): $@" > /dev/tty; fi
"$@" 2>&1 | tee -a $RESULTS || _fail "failed: $@"
}
@@ -39,6 +41,7 @@ run_check_stdout()
run_mayfail()
{
echo "############### $@" >> $RESULTS 2>&1
+ if [ "$TEST_LOG" = 'tty' ]; then echo "CMD(mayfail): $@" > /dev/tty; fi
"$@" >> $RESULTS 2>&1 || _log "failed (ignored): $@"
}