summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-02-19 19:24:07 +0100
committerDavid Sterba <dsterba@suse.com>2018-02-19 19:24:07 +0100
commit510bb4ccc4258567e731b81c4722a6adc7faec8b (patch)
tree912f87f7942bbbf99a880d9287d4606f5ce94bf4 /tests
parentea0956bb2a26ca0deb1bcba186a0e53ab07164a5 (diff)
btrfs-progs: tests: add helper to log pipe stdout
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/common7
-rwxr-xr-xtests/misc-tests/029-send-p-different-mountpoints/test.sh2
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/common b/tests/common
index fae30f1d..4b266c5b 100644
--- a/tests/common
+++ b/tests/common
@@ -54,6 +54,13 @@ _log()
echo "$*" | tee -a "$RESULTS"
}
+# copy stdout to log and pass to stdout, eg. another stdout consumer, commands
+# should redirect stderr to stdout if this is consmed by further commands
+_log_stdout()
+{
+ tee -a "$RESULTS"
+}
+
_not_run()
{
echo " [NOTRUN] $*"
diff --git a/tests/misc-tests/029-send-p-different-mountpoints/test.sh b/tests/misc-tests/029-send-p-different-mountpoints/test.sh
index 64048334..6a380158 100755
--- a/tests/misc-tests/029-send-p-different-mountpoints/test.sh
+++ b/tests/misc-tests/029-send-p-different-mountpoints/test.sh
@@ -31,7 +31,7 @@ run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot -r \
run_mustfail_stdout "send -p on 2 mount points" \
$SUDO_HELPER "$TOP/btrfs" send -f /dev/null -p \
"$SUBVOL_MNT/test-subvol-mnt-subvol" "$TOPLEVEL_MNT/test-subvol-mnt-root" \
- | tee -a "$RESULTS" \
+ | _log_stdout \
| grep -q "not on mount point.*/toplevel" \
|| _fail "expected output not found, please check the logs"