torture: use tevent_ functions names instead of the legacy event_ ones
[garming/samba-autobuild/.git] / source4 / torture / smb2 / lock.c
index ad66b6236bd50b70fb674b895e439b24e70db7ac..5bccf04f43805b6d462834587824d918cbdba685 100644 (file)
@@ -62,7 +62,7 @@
 
 #define WAIT_FOR_ASYNC_RESPONSE(req) \
        while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { \
-               if (event_loop_once(req->transport->socket->event.ctx) != 0) { \
+               if (tevent_loop_once(req->transport->socket->event.ctx) != 0) { \
                        break; \
                } \
        }
@@ -2608,8 +2608,8 @@ done:
        return ret;
 }
 
-static NTSTATUS smb2cli_lock(struct smb2_tree *tree, struct smb2_handle h,
-                            uint64_t offset, uint64_t length, bool exclusive)
+static NTSTATUS test_smb2_lock(struct smb2_tree *tree, struct smb2_handle h,
+                              uint64_t offset, uint64_t length, bool exclusive)
 {
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -2632,8 +2632,8 @@ static NTSTATUS smb2cli_lock(struct smb2_tree *tree, struct smb2_handle h,
        return status;
 }
 
-static NTSTATUS smb2cli_unlock(struct smb2_tree *tree, struct smb2_handle h,
-                              uint64_t offset, uint64_t length)
+static NTSTATUS test_smb2_unlock(struct smb2_tree *tree, struct smb2_handle h,
+                                uint64_t offset, uint64_t length)
 {
        struct smb2_lock lck;
        struct smb2_lock_element el[1];
@@ -2693,45 +2693,45 @@ static bool test_overlap(struct torture_context *torture,
 
        torture_comment(torture, "Testing overlapping locks:\n");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 0, 4, true)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h, 2, 4, true));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 0, 4, true)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h, 2, 4, true));
        EXPECTED(ret, false);
        torture_comment(torture, "the same session/handle %s set overlapping "
                                 "exclusive locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 10, 4, false)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h, 12, 4, false));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 10, 4, false)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h, 12, 4, false));
        EXPECTED(ret, true);
        torture_comment(torture, "the same session/handle %s set overlapping "
                                 "shared locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 20, 4, true)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree2, h3, 22, 4, true));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 20, 4, true)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree2, h3, 22, 4, true));
        EXPECTED(ret, false);
        torture_comment(torture, "a different session %s set overlapping "
                                 "exclusive locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 30, 4, false)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree2, h3, 32, 4, false));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 30, 4, false)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree2, h3, 32, 4, false));
        EXPECTED(ret, true);
        torture_comment(torture, "a different session %s set overlapping "
                                 "shared locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 40, 4, true)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h2, 42, 4, true));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 40, 4, true)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h2, 42, 4, true));
        EXPECTED(ret, false);
        torture_comment(torture, "a different handle %s set overlapping "
                                 "exclusive locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 50, 4, false)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h2, 52, 4, false));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 50, 4, false)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h2, 52, 4, false));
        EXPECTED(ret, true);
        torture_comment(torture, "a different handle %s set overlapping "
                                 "shared locks\n", ret?"can":"cannot");
 
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 110, 4, false)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h, 112, 4, false)) &&
-             NT_STATUS_IS_OK(smb2cli_unlock(tree, h, 110, 6));
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 110, 4, false)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h, 112, 4, false)) &&
+             NT_STATUS_IS_OK(test_smb2_unlock(tree, h, 110, 6));
        EXPECTED(ret, false);
        torture_comment(torture, "the same handle %s coalesce read locks\n",
                                 ret?"can":"cannot");
@@ -2742,11 +2742,11 @@ static bool test_overlap(struct torture_context *torture,
        CHECK_STATUS(status, NT_STATUS_OK);
        status = torture_smb2_testfile(tree, fname, &h2);
        CHECK_STATUS(status, NT_STATUS_OK);
-       ret = NT_STATUS_IS_OK(smb2cli_lock(tree, h, 0, 8, false)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h2, 0, 1, false)) &&
+       ret = NT_STATUS_IS_OK(test_smb2_lock(tree, h, 0, 8, false)) &&
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h2, 0, 1, false)) &&
              NT_STATUS_IS_OK(smb2_util_close(tree, h)) &&
              NT_STATUS_IS_OK(torture_smb2_testfile(tree, fname, &h)) &&
-             NT_STATUS_IS_OK(smb2cli_lock(tree, h, 7, 1, true));
+             NT_STATUS_IS_OK(test_smb2_lock(tree, h, 7, 1, true));
        EXPECTED(ret, true);
        torture_comment(torture, "the server %s have the NT byte range lock "
                                 "bug\n", !ret?"does":"doesn't");
@@ -2853,36 +2853,36 @@ done:
 struct torture_suite *torture_smb2_lock_init(void)
 {
        struct torture_suite *suite =
-           torture_suite_create(talloc_autofree_context(), "LOCK");
+           torture_suite_create(talloc_autofree_context(), "lock");
 
-       torture_suite_add_1smb2_test(suite, "VALID-REQUEST",
+       torture_suite_add_1smb2_test(suite, "valid-request",
            test_valid_request);
-       torture_suite_add_1smb2_test(suite, "RW-NONE", test_lock_rw_none);
-       torture_suite_add_1smb2_test(suite, "RW-SHARED", test_lock_rw_shared);
-       torture_suite_add_1smb2_test(suite, "RW-EXCLUSIVE",
+       torture_suite_add_1smb2_test(suite, "rw-none", test_lock_rw_none);
+       torture_suite_add_1smb2_test(suite, "rw-shared", test_lock_rw_shared);
+       torture_suite_add_1smb2_test(suite, "rw-exclusive",
            test_lock_rw_exclusive);
-       torture_suite_add_1smb2_test(suite, "AUTO-UNLOCK",
+       torture_suite_add_1smb2_test(suite, "auto-unlock",
            test_lock_auto_unlock);
-       torture_suite_add_1smb2_test(suite, "LOCK", test_lock);
-       torture_suite_add_1smb2_test(suite, "ASYNC", test_async);
-       torture_suite_add_1smb2_test(suite, "CANCEL", test_cancel);
-       torture_suite_add_1smb2_test(suite, "CANCEL-TDIS", test_cancel_tdis);
-       torture_suite_add_1smb2_test(suite, "CANCEL-LOGOFF",
+       torture_suite_add_1smb2_test(suite, "lock", test_lock);
+       torture_suite_add_1smb2_test(suite, "async", test_async);
+       torture_suite_add_1smb2_test(suite, "cancel", test_cancel);
+       torture_suite_add_1smb2_test(suite, "cancel-tdis", test_cancel_tdis);
+       torture_suite_add_1smb2_test(suite, "cancel-logoff",
            test_cancel_logoff);
-       torture_suite_add_1smb2_test(suite, "ERRORCODE", test_errorcode);
-       torture_suite_add_1smb2_test(suite, "ZEROBYTELENGTH",
+       torture_suite_add_1smb2_test(suite, "errorcode", test_errorcode);
+       torture_suite_add_1smb2_test(suite, "zerobytelength",
            test_zerobytelength);
-       torture_suite_add_1smb2_test(suite, "ZEROBYTEREAD",
+       torture_suite_add_1smb2_test(suite, "zerobyteread",
            test_zerobyteread);
-       torture_suite_add_1smb2_test(suite, "UNLOCK", test_unlock);
-       torture_suite_add_1smb2_test(suite, "MULTIPLE-UNLOCK",
+       torture_suite_add_1smb2_test(suite, "unlock", test_unlock);
+       torture_suite_add_1smb2_test(suite, "multiple-unlock",
            test_multiple_unlock);
-       torture_suite_add_1smb2_test(suite, "STACKING", test_stacking);
-       torture_suite_add_1smb2_test(suite, "CONTEND", test_contend);
-       torture_suite_add_1smb2_test(suite, "CONTEXT", test_context);
-       torture_suite_add_1smb2_test(suite, "RANGE", test_range);
-       torture_suite_add_2smb2_test(suite, "OVERLAP", test_overlap);
-       torture_suite_add_1smb2_test(suite, "TRUNCATE", test_truncate);
+       torture_suite_add_1smb2_test(suite, "stacking", test_stacking);
+       torture_suite_add_1smb2_test(suite, "contend", test_contend);
+       torture_suite_add_1smb2_test(suite, "context", test_context);
+       torture_suite_add_1smb2_test(suite, "range", test_range);
+       torture_suite_add_2smb2_test(suite, "overlap", test_overlap);
+       torture_suite_add_1smb2_test(suite, "truncate", test_truncate);
 
        suite->description = talloc_strdup(suite, "SMB2-LOCK tests");