From: Stefan Metzmacher Date: Thu, 15 Aug 2019 12:31:54 +0000 (+0200) Subject: s3:torture: convert LOCK9 into LOCK9A and LOCK9B X-Git-Tag: talloc-2.3.1~976 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac28eec3e4af710feab3be3d4b25bfbe38294431;p=thirdparty%2Fsamba.git 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 Reviewed-by: Volker Lendecke --- 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 589c3347b84..5983d033819 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 9d214f55973..208bb56ae8b 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -2547,7 +2547,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'; @@ -2556,7 +2556,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); @@ -2615,10 +2615,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]; @@ -2629,10 +2629,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 \n"); + d_fprintf(stderr, "locktest9X must be given a local path via -l \n"); return false; } @@ -2647,7 +2647,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); } @@ -2670,7 +2670,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)); @@ -2701,7 +2701,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)); @@ -2728,10 +2728,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; @@ -14154,8 +14164,12 @@ static struct { .fn = run_locktest8, }, { - .name = "LOCK9", - .fn = run_locktest9, + .name = "LOCK9A", + .fn = run_locktest9a, + }, + { + .name = "LOCK9B", + .fn = run_locktest9b, }, { .name = "LOCK10",