[KMTESTS:IO] Fix some failures in IoDeviceObject test. ROSTESTS-380

This commit is contained in:
Thomas Faber 2023-02-01 19:35:16 -05:00
parent 144e984b40
commit 04b35ecc23
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
5 changed files with 37 additions and 14 deletions

View file

@ -170,6 +170,7 @@ VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL);
DWORD KmtRunKernelTest(IN PCSTR TestName);
DWORD KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning);
VOID KmtUnloadDriverKeepService(VOID);
VOID KmtUnloadDriver(VOID);
DWORD KmtOpenDriver(VOID);
VOID KmtCloseDriver(VOID);

View file

@ -140,6 +140,24 @@ KmtLoadDriver(
return KmtCreateAndStartService(TestServiceName, ServicePath, NULL, &TestServiceHandle, RestartIfRunning);
}
/**
* @name KmtUnloadDriverKeepService
*
* Unload special-purpose driver (stop the service only)
*/
VOID
KmtUnloadDriverKeepService(VOID)
{
DWORD Error;
Error = KmtStopService(TestServiceName, &TestServiceHandle);
if (Error)
{
fprintf(stderr, "Failed to stop %ls service with error 0x%lx\n", TestServiceName, Error);
}
}
/**
* @name KmtUnloadDriver
*

View file

@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPLv2+ - See COPYING in the top level directory
* PURPOSE: Kernel-Mode Test Suite Driver Object Test Driver
* PROGRAMMER: Michael Martin <martinmnet@hotmail.com>
* Thomas Faber <thomas.faber@reactos.org>
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Kernel-Mode Test Suite Device Object Test Driver
* COPYRIGHT: Copyright 2009 Michael Martin (michael.martin@reactos.org)
* COPYRIGHT: Copyright 2011-2023 Thomas Faber (thomas.faber@reactos.org)
*/
#include <kmt_test.h>
@ -424,10 +424,11 @@ TestDeviceDeletion(
DeviceObject->DeviceType);
ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
/*Check the extended extension */
/* Check the extended extension */
extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension;
ok(extdev->ExtensionFlags == DOE_UNLOAD_PENDING,
"Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got %lu\n", extdev->ExtensionFlags);
/* FIXME: Windows has the MSB set under some conditions, need to find out what this means */
ok((extdev->ExtensionFlags & 0x7fffffff) == DOE_UNLOAD_PENDING,
"Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got 0x%lx\n", extdev->ExtensionFlags);
ok (extdev->Type == 13, "Expected Type of 13, got %d\n", extdev->Type);
ok (extdev->Size == 0, "Expected Size of 0, got %d\n", extdev->Size);
ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p\n",

View file

@ -1,8 +1,9 @@
/*
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPLv2+ - See COPYING in the top level directory
* PURPOSE: Kernel-Mode Test Suite Driver Object test user-mode part
* PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Kernel-Mode Test Suite Device Object test user-mode part
* COPYRIGHT: Copyright 2011-2023 Thomas Faber (thomas.faber@reactos.org)
* COPYRIGHT: Copyright 2022 Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <kmt_test.h>
@ -16,7 +17,9 @@ START_TEST(IoDeviceObject)
ok_eq_int(Error, ERROR_SUCCESS);
if (Error)
return;
KmtUnloadDriver();
/* Can't use the normal unload function here because we need the
* service to stick around. */
KmtUnloadDriverKeepService();
Error = KmtLoadAndOpenDriver(L"IoDeviceObject", TRUE);
ok_eq_int(Error, ERROR_SUCCESS);

View file

@ -1,6 +1,6 @@
/*
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Kernel-Mode Test Suite Spin lock test
* COPYRIGHT: Copyright 2011-2023 Thomas Faber (thomas.faber@reactos.org)
* COPYRIGHT: Copyright 2021 Jérôme Gardou (jerome.gardou@reactos.org)