testprogs/blackbox: use subunit_ helper functions in test_smbclient_*
[samba.git] / testprogs / blackbox / common_test_fns.inc
1 # Common tests
2 # Pulled out of existing tests to prevent duplication.
3 #
4 test_smbclient() {
5         name="$1"
6         cmd="$2"
7         unc="$3"
8         shift
9         shift
10         shift
11         subunit_start_test "$name"
12         output=`$VALGRIND $smbclient $CONFIGURATION "$unc" -c "$cmd" $@ 2>&1`
13         status=$?
14         if [ x$status = x0 ]; then
15                 subunit_pass_test "$name"
16         else
17                 echo "$output" | subunit_fail_test "$name"
18         fi
19         return $status
20 }
21
22 test_smbclient_expect_failure() {
23         name="$1"
24         cmd="$2"
25         unc="$3"
26         shift
27         shift
28         shift
29         subunit_start_test "$name"
30         output=`$VALGRIND $smbclient $CONFIGURATION "$unc" -c "$cmd" $@ 2>&1`
31         status=$?
32         if [ x$status = x0 ]; then
33                 echo "$output" | subunit_fail_test "$name"
34         else
35                 subunit_pass_test "$name"
36         fi
37         return $status
38 }