[ros-diffs] [tfaber] 53943: [ADVAPI32_APITEST] - Test passing tag, but no group to CreateService [KMTESTS/MM] - MmSection: Wait for write completion to prevent a random test failure

tfaber at svn.reactos.org tfaber at svn.reactos.org
Sun Oct 2 21:42:33 UTC 2011


Author: tfaber
Date: Sun Oct  2 21:42:33 2011
New Revision: 53943

URL: http://svn.reactos.org/svn/reactos?rev=53943&view=rev
Log:
[ADVAPI32_APITEST] - Test passing tag, but no group to CreateService
[KMTESTS/MM] - MmSection: Wait for write completion to prevent a random test failure

Modified:
    trunk/rostests/apitests/advapi32/CreateService.c
    trunk/rostests/kmtests/ntos_mm/MmSection.c

Modified: trunk/rostests/apitests/advapi32/CreateService.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CreateService.c?rev=53943&r1=53942&r2=53943&view=diff
==============================================================================
--- trunk/rostests/apitests/advapi32/CreateService.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/CreateService.c [iso-8859-1] Sun Oct  2 21:42:33 2011
@@ -66,12 +66,28 @@
     return 0;
 }
 
+static void DestroyService(SC_HANDLE hService)
+{
+    LONG ret;
+
+    if (!hService)
+        return;
+    SetLastError(DNS_ERROR_RCODE_NXRRSET);
+    ret = DeleteService(hService);
+    ok(ret == TRUE, "DeleteService returned %ld, expected 1\n", ret);
+    ok(GetLastError() == DNS_ERROR_RCODE_NXRRSET /* win7 */
+        || GetLastError() == ERROR_SUCCESS /* win2k3 */, "DeleteService GetLastError()=0x%08lx\n", GetLastError());
+
+    CloseServiceHandle(hService);
+}
+
 static void Test_CreateService(void)
 {
     SC_HANDLE hScm = NULL;
     SC_HANDLE hService1 = NULL, hService2 = NULL;
-    LONG ret;
+    SC_HANDLE hService3 = NULL;
     DWORD tag1 = 0, tag2 = 0;
+    DWORD tag3 = 785;
 
     SetLastError(DNS_ERROR_RCODE_NXRRSET);
     hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
@@ -92,28 +108,49 @@
 
     ok(tag1 != tag2, "tag1=%lu, tag2=%lu\n", tag1, tag2);
 
+    /* ask for a tag, but don't have a group */
+    hService3 = CreateServiceW(
+                    hScm,
+                    L"advapi32_apitest_CreateService_Test_Service2",
+                    NULL,
+                    DELETE,
+                    SERVICE_KERNEL_DRIVER,
+                    SERVICE_BOOT_START,
+                    SERVICE_ERROR_IGNORE,
+                    L"%systemroot%\\drivers\\win32k.sys",
+                    NULL,
+                    &tag3,
+                    NULL,
+                    NULL,
+                    NULL);
+    ok(hService3 == NULL, "hService3=%p\n", hService3);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "error=%lu\n", GetLastError());
+    ok(tag3 == 785, "tag3=%lu\n", tag3);
+    DestroyService(hService3);
+
+    hService3 = CreateServiceW(
+                    hScm,
+                    L"advapi32_apitest_CreateService_Test_Service2",
+                    NULL,
+                    DELETE,
+                    SERVICE_KERNEL_DRIVER,
+                    SERVICE_BOOT_START,
+                    SERVICE_ERROR_IGNORE,
+                    L"%systemroot%\\drivers\\win32k.sys",
+                    L"",
+                    &tag3,
+                    NULL,
+                    NULL,
+                    NULL);
+    ok(hService3 == NULL, "hService3=%p\n", hService3);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "error=%lu\n", GetLastError());
+    ok(tag3 == 785, "tag3=%lu\n", tag3);
+    DestroyService(hService3);
+
 cleanup:
-    if (hService2)
-    {
-        SetLastError(DNS_ERROR_RCODE_NXRRSET);
-        ret = DeleteService(hService2);
-        ok(ret == TRUE, "DeleteService returned %ld, expected 1\n", ret);
-        ok(GetLastError() == DNS_ERROR_RCODE_NXRRSET /* win7 */
-            || GetLastError() == ERROR_SUCCESS /* win2k3 */, "DeleteService (Error: %ld)\n", GetLastError());
 
-        CloseServiceHandle(hService2);
-    }
-
-    if (hService1)
-    {
-        SetLastError(DNS_ERROR_RCODE_NXRRSET);
-        ret = DeleteService(hService1);
-        ok(ret == TRUE, "DeleteService returned %ld, expected 1\n", ret);
-        ok(GetLastError() == DNS_ERROR_RCODE_NXRRSET /* win7 */
-            || GetLastError() == ERROR_SUCCESS /* win2k3 */, "DeleteService (Error: %ld)\n", GetLastError());
-
-        CloseServiceHandle(hService1);
-    }
+    DestroyService(hService2);
+    DestroyService(hService1);
 
     if (hScm)
         CloseServiceHandle(hScm);

Modified: trunk/rostests/kmtests/ntos_mm/MmSection.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmSection.c?rev=53943&r1=53942&r2=53943&view=diff
==============================================================================
--- trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] Sun Oct  2 21:42:33 2011
@@ -27,7 +27,7 @@
     NTSTATUS Status;                                                    \
     if (skip(SectionObject != NULL &&                                   \
              SectionObject != (PVOID)0x5555555555555555ULL,             \
-             "blah\n"))                                                 \
+             "No section object\n"))                                    \
         break;                                                          \
     Status = ObOpenObjectByPointer(SectionObject, OBJ_KERNEL_HANDLE,    \
                                    NULL, 0, MmSectionObjectType,        \
@@ -401,7 +401,7 @@
     ok(ExGetPreviousMode() == UserMode, "Previous mode is kernel mode\n");
     /* create a one-byte file that we can use */
     InitializeObjectAttributes(&ObjectAttributes, &FileName1, OBJ_CASE_INSENSITIVE, NULL, NULL);
-    Status = ZwCreateFile(&FileHandle1, GENERIC_ALL, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_SUPERSEDE, FILE_NON_DIRECTORY_FILE, NULL, 0);
+    Status = ZwCreateFile(&FileHandle1, GENERIC_WRITE | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_SUPERSEDE, FILE_NON_DIRECTORY_FILE, NULL, 0);
     ok_eq_hex(Status, STATUS_SUCCESS);
     ok_eq_ulongptr(IoStatusBlock.Information, FILE_CREATED);
     ok(FileHandle1 != NULL, "FileHandle1 is NULL\n");
@@ -409,6 +409,8 @@
     {
         FileOffset.QuadPart = 0;
         Status = ZwWriteFile(FileHandle1, NULL, NULL, NULL, &IoStatusBlock, &FileData, sizeof FileData, &FileOffset, NULL);
+        ok(Status == STATUS_SUCCESS || Status == STATUS_PENDING, "Status = 0x%08lx\n", Status);
+        Status = ZwWaitForSingleObject(FileHandle1, FALSE, NULL);
         ok_eq_hex(Status, STATUS_SUCCESS);
         ok_eq_ulongptr(IoStatusBlock.Information, 1);
         Status = ZwClose(FileHandle1);




More information about the Ros-diffs mailing list