torture: Fix cleanup2 to utilize on-demand cleanup
authorVolker Lendecke <vl@samba.org>
Wed, 20 Aug 2014 09:53:28 +0000 (09:53 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 22 Aug 2014 22:24:18 +0000 (00:24 +0200)
Now we check the cleanup when conflicts happen, not when we first open
the file. This means we don't have to re-open the connection to make
cleanup happen.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/test_cleanup.c

index c5c53c3c4c40efccebb350e69746bc6908cc2319..8efdf35e080908334ea3c218e59ff8f1bede5ced 100644 (file)
@@ -157,23 +157,10 @@ bool run_cleanup2(int dummy)
        }
 
        /*
-        * Right now we don't clean up immediately. Re-open the 2nd connection.
+        * Give the suicidal smbd a bit of time to really pass away
         */
-#if 1
-       cli_shutdown(cli2);
-       if (!torture_open_connection(&cli2, 0)) {
-               return false;
-       }
-       status = cli_ntcreate(
-               cli2, fname, 0, FILE_GENERIC_READ|FILE_GENERIC_WRITE,
-               FILE_ATTRIBUTE_NORMAL,
-               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-               FILE_OPEN, 0, 0, &fnum2, NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               printf("open of %s failed (%s)\n", fname, nt_errstr(status));
-               return false;
-       }
-#endif
+       smb_msleep(1000);
+
        status = cli_smbwrite(cli2, fnum2, &buf, 0, 1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("write failed: %s\n", nt_errstr(status));