summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2019-08-15 14:31:54 +0200
committerStefan Metzmacher <metze@samba.org>2019-09-09 16:04:28 +0000
commitffdb166e49fa1a786ac1ea4e1ab09c286e75af69 (patch)
tree3e8df0305e907e08b164737468f87aaf6128eb37
parent0742879bd8d03333b8b7c2a790afebdb5f7dd92b (diff)
downloadsamba-ffdb166e49fa1a786ac1ea4e1ab09c286e75af69.tar.gz
s3:torture: convert LOCK9 into LOCK9A and LOCK9B
LOCK9A is the original test (with a timeout of -1) and LOCK9B is the same but with timeout of 10 seconds. LOCK9B is needed to demonstrate a server bug in the next commits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit ac28eec3e4af710feab3be3d4b25bfbe38294431)
-rw-r--r--selftest/skip2
-rwxr-xr-xsource3/selftest/tests.py3
-rw-r--r--source3/torture/torture.c38
3 files changed, 29 insertions, 14 deletions
diff --git a/selftest/skip b/selftest/skip
index 1e7448acb9f..c471072e88f 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -34,7 +34,7 @@
^samba3.smbtorture_s3.*.pipe_number
^samba3.smbtorture_s3.LOCAL-DBTRANS #hangs for some reason
^samba3.smbtorture_s3.*.DIR1 #loops on 64 bit linux with ext4
-^samba3.smbtorture_s3.plain.LOCK9\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
+^samba3.smbtorture_s3.plain.LOCK9.*\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.OPLOCK2\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.STREAMERROR\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain.DIR1\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 9569aa9ae00..a3daeacae6b 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -78,7 +78,8 @@ plantestsuite("samba3.local_s3", "nt4_dc:local", [os.path.join(samba3srcdir, "sc
plantestsuite("samba3.blackbox.registry.upgrade", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_registry_upgrade.sh"), net, dbwrap_tool])
-tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7", "LOCK9",
+tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7",
+ "LOCK9A", "LOCK9B",
"LOCK10",
"LOCK11",
"LOCK12",
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 5a75796928a..66dc0cf4d1c 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -2546,7 +2546,7 @@ static void alarm_handler_parent(int dummy)
smbXcli_conn_disconnect(alarm_cli->conn, NT_STATUS_LOCAL_DISCONNECT);
}
-static void do_local_lock(int read_fd, int write_fd)
+static void do_local_lock(const char *fname, int read_fd, int write_fd)
{
int fd;
char c = '\0';
@@ -2555,7 +2555,7 @@ static void do_local_lock(int read_fd, int write_fd)
int ret;
local_pathname = talloc_asprintf(talloc_tos(),
- "%s/lockt9.lck", local_path);
+ "%s/%s", local_path, fname);
if (!local_pathname) {
printf("child: alloc fail\n");
exit(1);
@@ -2614,10 +2614,10 @@ static void do_local_lock(int read_fd, int write_fd)
exit(0);
}
-static bool run_locktest9(int dummy)
+static bool _run_locktest9X(const char *fname, int timeout)
{
struct cli_state *cli1;
- const char *fname = "\\lockt9.lck";
+ char *fpath = talloc_asprintf(talloc_tos(), "\\%s", fname);
uint16_t fnum;
bool correct = False;
int pipe_in[2], pipe_out[2];
@@ -2628,10 +2628,10 @@ static bool run_locktest9(int dummy)
double seconds;
NTSTATUS status;
- printf("starting locktest9\n");
+ printf("starting locktest9X: %s\n", fname);
if (local_path == NULL) {
- d_fprintf(stderr, "locktest9 must be given a local path via -l <localpath>\n");
+ d_fprintf(stderr, "locktest9X must be given a local path via -l <localpath>\n");
return false;
}
@@ -2646,7 +2646,7 @@ static bool run_locktest9(int dummy)
if (child_pid == 0) {
/* Child. */
- do_local_lock(pipe_out[0], pipe_in[1]);
+ do_local_lock(fname, pipe_out[0], pipe_in[1]);
exit(0);
}
@@ -2669,7 +2669,7 @@ static bool run_locktest9(int dummy)
smbXcli_conn_set_sockopt(cli1->conn, sockops);
- status = cli_openx(cli1, fname, O_RDWR, DENY_NONE,
+ status = cli_openx(cli1, fpath, O_RDWR, DENY_NONE,
&fnum);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "cli_openx returned %s\n", nt_errstr(status));
@@ -2700,7 +2700,7 @@ static bool run_locktest9(int dummy)
start = timeval_current();
- status = cli_lock32(cli1, fnum, 0, 4, -1, WRITE_LOCK);
+ status = cli_lock32(cli1, fnum, 0, 4, timeout, WRITE_LOCK);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "Unable to apply write lock on range 0:4, error was "
"%s\n", nt_errstr(status));
@@ -2727,10 +2727,20 @@ fail:
fail_nofd:
- printf("finished locktest9\n");
+ printf("finished locktest9X: %s\n", fname);
return correct;
}
+static bool run_locktest9a(int dummy)
+{
+ return _run_locktest9X("lock9a.dat", -1);
+}
+
+static bool run_locktest9b(int dummy)
+{
+ return _run_locktest9X("lock9b.dat", 10000);
+}
+
struct locktest10_state {
bool ok;
bool done;
@@ -13651,8 +13661,12 @@ static struct {
.fn = run_locktest8,
},
{
- .name = "LOCK9",
- .fn = run_locktest9,
+ .name = "LOCK9A",
+ .fn = run_locktest9a,
+ },
+ {
+ .name = "LOCK9B",
+ .fn = run_locktest9b,
},
{
.name = "LOCK10",