1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

testprogs/blackbox: add test_rpcclient_*_grep helper functions

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12709

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2017-03-29 11:53:41 +02:00 committed by Andrew Bartlett
parent 31f0b31308
commit 66ee788a5a

View File

@ -36,3 +36,55 @@ test_smbclient_expect_failure() {
fi fi
return $status return $status
} }
test_rpcclient_grep() {
name="$1"
cmd="$2"
srv="$3"
grep="$4"
shift
shift
shift
shift
subunit_start_test "$name"
output=`$VALGRIND $rpcclient $CONFIGURATION "$srv" -c "$cmd" $@ 2>&1`
status=$?
if [ x$status != x0 ]; then
echo "$output" | subunit_fail_test "$name"
return $status
fi
echo "$output" | grep -q "$grep"
gstatus=$?
if [ x$gstatus = x0 ]; then
subunit_pass_test "$name"
else
echo "$output" | subunit_fail_test "$name"
fi
return $status
}
test_rpcclient_expect_failure_grep() {
name="$1"
cmd="$2"
srv="$3"
grep="$4"
shift
shift
shift
shift
subunit_start_test "$name"
output=`$VALGRIND $rpcclient $CONFIGURATION "$srv" -c "$cmd" $@ 2>&1`
status=$?
if [ x$status = x0 ]; then
echo "$output" | subunit_fail_test "$name"
return $status
fi
echo "$output" | grep -q "$grep"
gstatus=$?
if [ x$gstatus = x0 ]; then
subunit_pass_test "$name"
else
echo "$output" | subunit_fail_test "$name"
fi
return $status
}