]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:torture: convert LOCK9 into LOCK9A and LOCK9B
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Aug 2019 12:31:54 +0000 (14:31 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 9 Sep 2019 14:23:39 +0000 (14:23 +0000)
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>
selftest/skip
source3/selftest/tests.py
source3/torture/torture.c

index 1e7448acb9f791e72e6676fbcbc875476a74b7be..c471072e88f677efa98382885cf62222b396ce65 100644 (file)
@@ -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
index 589c3347b8406855496c36ed0e739c9889aa64d3..5983d0338198c10412eb6e8b1c6fb3cae82d5d8a 100755 (executable)
@@ -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",
index 9d214f55973f122978d84e67cd189fda1ab2f204..208bb56ae8b738f0fd65ea1a889a30dd985fa6a8 100644 (file)
@@ -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 <localpath>\n");
+               d_fprintf(stderr, "locktest9X must be given a local path via -l <localpath>\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",