s4:selftest: test for smbtorture subunit names with and without --fullname
authorSachin Prabhu <sprabhu@redhat.com>
Fri, 26 Jun 2020 16:35:38 +0000 (16:35 +0000)
committerStefan Metzmacher <metze@samba.org>
Tue, 7 Jul 2020 12:16:34 +0000 (12:16 +0000)
We check the output with both --fullname and with the default shortname
to ensure it works as expected.

We also do tests for each level and test relative names are used.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User((no branch)): Stefan Metzmacher <metze@samba.org>
Autobuild-Date((no branch)): Tue Jul  7 12:16:34 UTC 2020 on sn-devel-184

source4/selftest/tests.py
testprogs/blackbox/test_smbtorture_test_names.sh [new file with mode: 0755]

index 7f866d972491a4a3d716b4e5031f08871718713b..4d3030e470082ef542b683867199e66f95192339 100755 (executable)
@@ -479,6 +479,13 @@ planpythontestsuite("nt4_dc_smb1", "samba.tests.libsmb")
 # the API. These mainly test that the various command-line options of commands
 # work correctly.
 
+# smbtorture --fullname parameter test
+plantestsuite("samba4.blackbox.smbtorture_subunit_names", "none",
+              [
+                 os.path.join(bbdir, "test_smbtorture_test_names.sh"),
+                 smbtorture4
+              ])
+
 for env in ["ad_member", "s4member", "ad_dc_ntvfs", "chgdcpass"]:
     plantestsuite("samba4.blackbox.smbclient(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "utils/tests/test_smbclient.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4])
 
diff --git a/testprogs/blackbox/test_smbtorture_test_names.sh b/testprogs/blackbox/test_smbtorture_test_names.sh
new file mode 100755 (executable)
index 0000000..a451310
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#Tests if the --fullname parameter passed to smbtorture is working as expected.
+
+if [ $# -ne 1 ]; then
+cat <<EOF
+Usage: test_smbtorture_test_names.sh SMBTORTURE
+EOF
+exit 1;
+fi
+
+SMBTORTURE="$1 //a/b"
+
+. `dirname $0`/subunit.sh
+
+failed=0
+
+testit_grep "with_shortname local.smbtorture.level1.level2.level3.always_pass" \
+            '^success: always_pass$' \
+            $SMBTORTURE local.smbtorture.level1.level2.level3.always_pass || failed=`expr $failed + 1`
+testit_grep "with_shortname local.smbtorture.level1.level2.level3" \
+            '^success: always_pass$' \
+            $SMBTORTURE local.smbtorture.level1.level2.level3 || failed=`expr $failed + 1`
+testit_grep "with_shortname local.smbtorture.level1.level2"\
+            '^success: level3.always_pass$' \
+            $SMBTORTURE local.smbtorture.level1.level2 || failed=`expr $failed + 1`
+testit_grep "with_shortname local.smbtorture.level1" \
+            '^success: level2.level3.always_pass$' \
+            $SMBTORTURE local.smbtorture.level1 || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1.level2.level3.always_pass" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1.level2.level3.always_pass || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1.level2.level3" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1.level2.level3 || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1.level2" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1.level2 || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1 || failed=`expr $failed + 1`
+
+testok $0 $failed