summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-02-15 15:33:10 +1100
committerAndrew Tridgell <tridge@samba.org>2008-02-15 15:33:10 +1100
commitc09f70608c97c5df87818f0c6297e85cf8827862 (patch)
tree9ee804daa71d71114b45b72f3dc7ca21af2e110a
parentd48dc5b2e6e45b5a0daa96b32f0b45cdf35a80e5 (diff)
downloadsamba-c09f70608c97c5df87818f0c6297e85cf8827862.tar.gz
samba-c09f70608c97c5df87818f0c6297e85cf8827862.tar.bz2
samba-c09f70608c97c5df87818f0c6297e85cf8827862.zip
added a blackbox test for masktest
(This used to be commit 05a110123df2372418e2ef2fd8f269b92054069c)
-rwxr-xr-xsource4/selftest/samba4_tests.sh1
-rw-r--r--source4/torture/locktest.c15
-rwxr-xr-xtestprogs/blackbox/test_masktest.sh41
3 files changed, 52 insertions, 5 deletions
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index ab7065c6f0..98eade4e41 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -254,6 +254,7 @@ plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$P
plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
+plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
# Tests using the "Simple" NTVFS backend
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index ebc325fe2b..fb2430f881 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -396,7 +396,7 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
we then do random locking ops in tamdem on the 4 fnums from each
server and ensure that the results match
*/
-static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
+static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
int fnum[NSERVERS][NCONNECTIONS][NFILES];
@@ -451,7 +451,12 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
open_files(cli, fnum);
n = retest(cli, fnum, numops);
- if (n == numops || !analyze) return;
+ if (n == numops || !analyze) {
+ if (n != numops) {
+ return 1;
+ }
+ return 0;
+ }
n++;
skip = n/2;
@@ -517,6 +522,8 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
(double)recorded[i].len,
recorded[i].needed);
}
+
+ return 1;
}
@@ -632,8 +639,6 @@ _NORETURN_ static void usage(poptContext pc)
seed, lock_base, lock_range, min_length));
srandom(seed);
- test_locks(lp_ctx, share);
-
- return(0);
+ return test_locks(lp_ctx, share);
}
diff --git a/testprogs/blackbox/test_masktest.sh b/testprogs/blackbox/test_masktest.sh
new file mode 100755
index 0000000000..ef429a1fb0
--- /dev/null
+++ b/testprogs/blackbox/test_masktest.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Blackbox tests for masktest
+# Copyright (C) 2008 Andrew Tridgell
+# based on test_smbclient.sh
+
+if [ $# -lt 5 ]; then
+cat <<EOF
+Usage: test_masktest.sh SERVER USERNAME PASSWORD DOMAIN PREFIX
+EOF
+exit 1;
+fi
+
+SERVER=$1
+USERNAME=$2
+PASSWORD=$3
+DOMAIN=$4
+PREFIX=$5
+shift 5
+failed=0
+
+samba4bindir=`dirname $0`/../../source/bin
+masktest=$samba4bindir/masktest
+
+testit() {
+ name="$1"
+ shift
+ cmdline="$*"
+ echo "test: $name"
+ $cmdline
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "success: $name"
+ else
+ echo "failure: $name"
+ fi
+ return $status
+}
+
+testit "masktest" $VALGRIND $masktest //$SERVER/tmp --num-ops=200 --dieonerror -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
+
+exit $failed