[KMTESTS]

- Skip the remaining tests that result in assertions
- Hide KeProcessor test, as it takes very long

svn path=/branches/GSoC_2011/KMTestSuite/; revision=53669
This commit is contained in:
Thomas Faber 2011-09-10 10:48:07 +00:00
parent 21494c6ffa
commit 34e64d7748
5 changed files with 143 additions and 107 deletions

View file

@ -61,7 +61,7 @@ const KMT_TEST TestList[] =
{ "KeEvent", Test_KeEvent },
{ "KeGuardedMutex", Test_KeGuardedMutex },
{ "KeIrql", Test_KeIrql },
{ "KeProcessor", Test_KeProcessor },
{ "-KeProcessor", Test_KeProcessor },
{ "-KernelType", Test_KernelType },
{ "ObReference", Test_ObReference },
{ "ObType", Test_ObType },

View file

@ -52,12 +52,6 @@ TestFastMutex(
ExiReleaseFastMutex(Mutex);
CheckMutex(Mutex, 1L, NULL, 0LU, OriginalIrql, OriginalIrql);
/* acquire/release unsafe */
ExAcquireFastMutexUnsafe(Mutex);
CheckMutex(Mutex, 0L, Thread, 0LU, OriginalIrql, OriginalIrql);
ExReleaseFastMutexUnsafe(Mutex);
CheckMutex(Mutex, 1L, NULL, 0LU, OriginalIrql, OriginalIrql);
/* try to acquire */
ok_bool_true(ExTryToAcquireFastMutex(Mutex), "ExTryToAcquireFastMutex returned");
CheckMutex(Mutex, 0L, Thread, 0LU, OriginalIrql, APC_LEVEL);
@ -69,6 +63,14 @@ TestFastMutex(
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(Mutex);
/* acquire/release unsafe */
if (!KmtIsCheckedBuild || OriginalIrql == APC_LEVEL)
{
ExAcquireFastMutexUnsafe(Mutex);
CheckMutex(Mutex, 0L, Thread, 0LU, OriginalIrql, OriginalIrql);
ExReleaseFastMutexUnsafe(Mutex);
CheckMutex(Mutex, 1L, NULL, 0LU, OriginalIrql, OriginalIrql);
/* mismatched acquire/release */
ExAcquireFastMutex(Mutex);
CheckMutex(Mutex, 0L, Thread, 0LU, OriginalIrql, APC_LEVEL);
@ -85,7 +87,10 @@ TestFastMutex(
CheckMutex(Mutex, 1L, NULL, 0LU, PASSIVE_LEVEL, PASSIVE_LEVEL);
KmtSetIrql(OriginalIrql);
CheckMutex(Mutex, 1L, NULL, 0LU, PASSIVE_LEVEL, OriginalIrql);
}
if (!KmtIsCheckedBuild)
{
/* release without acquire */
ExReleaseFastMutexUnsafe(Mutex);
CheckMutex(Mutex, 2L, NULL, 0LU, PASSIVE_LEVEL, OriginalIrql);
@ -96,6 +101,7 @@ TestFastMutex(
ExReleaseFastMutex(Mutex);
CheckMutex(Mutex, 3L, NULL, 0LU, OriginalIrql, OriginalIrql);
Mutex->Count -= 2;
}
/* make sure we survive this in case of error */
ok_eq_long(Mutex->Count, 1L);

View file

@ -86,7 +86,8 @@ TestResourceSharedAccess(
ok_bool_false(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned");
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
/* this must not crash or deadlock (but can assert) */
/* this asserts */
if (!KmtIsCheckedBuild)
ExConvertExclusiveToSharedLite(Res);
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);

View file

@ -16,11 +16,15 @@ static VOID FsRtlIsNameInExpressionTest()
{
UNICODE_STRING Expression, Name;
/* !Name->Length || !Expression->Length asserts */
if (!KmtIsCheckedBuild)
{
RtlInitUnicodeString(&Expression, L"*");
RtlInitUnicodeString(&Name, L"");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
RtlInitUnicodeString(&Expression, L"");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
}
RtlInitUnicodeString(&Expression, L"ntdll.dll");
RtlInitUnicodeString(&Name, L".");
@ -125,8 +129,11 @@ static VOID FsRtlIsNameInExpressionTest()
RtlInitUnicodeString(&Expression, L"*.?.c.d");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
RtlInitUnicodeString(&Expression, L"*?");
if (!KmtIsCheckedBuild)
{
RtlInitUnicodeString(&Name, L"");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
}
RtlInitUnicodeString(&Name, L"a");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
RtlInitUnicodeString(&Name, L"aa");
@ -134,8 +141,11 @@ static VOID FsRtlIsNameInExpressionTest()
RtlInitUnicodeString(&Name, L"aaa");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
RtlInitUnicodeString(&Expression, L"?*?");
if (!KmtIsCheckedBuild)
{
RtlInitUnicodeString(&Name, L"");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
}
RtlInitUnicodeString(&Name, L"a");
ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
RtlInitUnicodeString(&Name, L"aa");
@ -166,11 +176,14 @@ static VOID FsRtlIsDbcsInExpressionTest()
{
ANSI_STRING Expression, Name;
if (!KmtIsCheckedBuild)
{
RtlInitAnsiString(&Expression, "*");
RtlInitAnsiString(&Name, "");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
RtlInitAnsiString(&Expression, "");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
}
RtlInitAnsiString(&Expression, "ntdll.dll");
RtlInitAnsiString(&Name, ".");
@ -275,8 +288,11 @@ static VOID FsRtlIsDbcsInExpressionTest()
RtlInitAnsiString(&Expression, "*.?.c.d");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
RtlInitAnsiString(&Expression, "*?");
if (!KmtIsCheckedBuild)
{
RtlInitAnsiString(&Name, "");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
}
RtlInitAnsiString(&Name, "a");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
RtlInitAnsiString(&Name, "aa");
@ -284,8 +300,11 @@ static VOID FsRtlIsDbcsInExpressionTest()
RtlInitAnsiString(&Name, "aaa");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
RtlInitAnsiString(&Expression, "?*?");
if (!KmtIsCheckedBuild)
{
RtlInitAnsiString(&Name, "");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
}
RtlInitAnsiString(&Name, "a");
ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
RtlInitAnsiString(&Name, "aa");

View file

@ -71,6 +71,8 @@ START_TEST(KeApc)
CheckApcs(0, 0, FALSE, PASSIVE_LEVEL);
/* leave without entering */
if (!KmtIsCheckedBuild)
{
KeLeaveCriticalRegion();
CheckApcs(1, 0, FALSE, PASSIVE_LEVEL);
KeEnterCriticalRegion();
@ -89,6 +91,7 @@ START_TEST(KeApc)
CheckApcs(0, 1, TRUE, PASSIVE_LEVEL);
KeEnterGuardedRegion();
CheckApcs(0, 0, FALSE, PASSIVE_LEVEL);
}
/* manually disable APCs */
Thread->KernelApcDisable = -1;
@ -126,13 +129,19 @@ START_TEST(KeApc)
KeLeaveCriticalRegion();
CheckApcs(0, 0, TRUE, HIGH_LEVEL);
/* Ke*GuardedRegion assert at > APC_LEVEL */
if (!KmtIsCheckedBuild)
{
KeEnterGuardedRegion();
CheckApcs(0, -1, TRUE, HIGH_LEVEL);
KeLeaveGuardedRegion();
}
CheckApcs(0, 0, TRUE, HIGH_LEVEL);
KeLowerIrql(Irql);
CheckApcs(0, 0, FALSE, PASSIVE_LEVEL);
if (!KmtIsCheckedBuild)
{
KeRaiseIrql(HIGH_LEVEL, &Irql);
CheckApcs(0, 0, TRUE, HIGH_LEVEL);
KeEnterCriticalRegion();
@ -171,6 +180,7 @@ START_TEST(KeApc)
CheckApcs(0, -1, TRUE, PASSIVE_LEVEL);
KeLeaveGuardedRegion();
CheckApcs(0, 0, FALSE, PASSIVE_LEVEL);
}
KeEnterCriticalRegion();
CheckApcs(-1, 0, FALSE, PASSIVE_LEVEL);