btrfs-progs: tests: add helper to log pipe stdout

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2018-02-19 19:24:07 +01:00
parent ea0956bb2a
commit 510bb4ccc4
2 changed files with 8 additions and 1 deletions

View File

@ -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] $*"

View File

@ -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"