10#define CheckEvent(Event, ExpectedType, State, ExpectedWaitNext, \
11 Irql, ThreadList, ThreadCount) do \
14 PLIST_ENTRY TheEntry; \
16 ok_eq_uint((Event)->Header.Type, ExpectedType); \
17 ok_eq_uint((Event)->Header.Hand, sizeof *(Event) / sizeof(ULONG)); \
18 ok_eq_hex((Event)->Header.Lock & 0xFF00FF00L, 0x55005500L); \
19 ok_eq_long((Event)->Header.SignalState, State); \
20 TheEntry = (Event)->Header.WaitListHead.Flink; \
21 for (TheIndex = 0; TheIndex < (ThreadCount); ++TheIndex) \
23 TheThread = CONTAINING_RECORD(TheEntry, KTHREAD, \
24 WaitBlock[0].WaitListEntry); \
25 ok_eq_pointer(TheThread, (ThreadList)[TheIndex]); \
26 ok_eq_pointer(TheEntry->Flink->Blink, TheEntry); \
27 TheEntry = TheEntry->Flink; \
29 ok_eq_pointer(TheEntry, &(Event)->Header.WaitListHead); \
30 ok_eq_pointer(TheEntry->Flink->Blink, TheEntry); \
31 ok_eq_long(KeReadStateEvent(Event), State); \
32 ok_eq_bool(Thread->WaitNext, ExpectedWaitNext); \
54 Event->Header.SignalState = 0x12345678L;
61 Event->Header.SignalState = 0x12345678L;
73 Event->Header.SignalState = 0x23456789L;
78 Event->Header.SignalState = 0x3456789AL;
88 Event->Header.SignalState = 0x456789ABL;
97 Event->Header.SignalState = 0x56789ABCL;
107 ok_irql(OriginalIrql);
150 const INT ThreadCount =
sizeof Threads /
sizeof Threads[0];
165 for (
i = 0;
i < ThreadCount; ++
i)
178 ThreadObjects[
i] = Threads[
i].
Thread;
181 while (!Threads[
i].Signal)
196 for (
i = 0;
i < ThreadCount; ++
i)
207 for (;
i < ThreadCount; ++
i)
217 if (!
skip((
Status & 0x3F) < ThreadCount,
"Index out of bounds\n"))
223 for (
i = 0;
i < ThreadCount; ++
i)
231#define NUM_SCHED_TESTS 1000
294 for (PriorityIncrement = 0; PriorityIncrement <= 8; PriorityIncrement++)
296 ThreadData->PriorityIncrement = PriorityIncrement;
316 if (PriorityIncrement == 0)
320 "[%lu] Counter 0 = %lu\n",
321 PriorityIncrement,
ThreadData->CounterValues[0]);
327 "[%lu] Counter 0 = %lu\n",
328 PriorityIncrement,
ThreadData->CounterValues[0]);
332 if (PriorityIncrement == 0)
336 "[%lu] Counter %lu = %lu, expected %lu or %lu\n",
337 PriorityIncrement,
i,
343 "[%lu] Counter %lu = %lu, expected %lu\n",
344 PriorityIncrement,
i,
376 trace(
"IRQL: %u\n", Irqls[
i]);
377 for (PriorityIncrement = -1; PriorityIncrement <= 8; ++PriorityIncrement)
381 trace(
"PriorityIncrement: %ld\n", PriorityIncrement);
382 trace(
"-> Checking KeSetEvent, NotificationEvent\n");
384 trace(
"-> Checking KeSetEvent, SynchronizationEvent\n");
386 trace(
"-> Checking KePulseEvent, NotificationEvent\n");
388 trace(
"-> Checking KePulseEvent, SynchronizationEvent\n");
static VOID TestEventFunctional(IN PKEVENT Event, IN EVENT_TYPE Type, IN KIRQL OriginalIrql)
#define CheckEvent(Event, ExpectedType, State, ExpectedWaitNext, Irql, ThreadList, ThreadCount)
LONG(NTAPI * PSET_EVENT_FUNCTION)(PRKEVENT, KPRIORITY, BOOLEAN)
static VOID NTAPI WaitForEventThread(IN OUT PVOID Context)
static VOID TestEventConcurrent(IN PKEVENT Event, IN EVENT_TYPE Type, IN KIRQL OriginalIrql, PSET_EVENT_FUNCTION SetEvent, KPRIORITY PriorityIncrement, LONG ExpectedState, BOOLEAN SatisfiesAll)
static VOID NTAPI TestEventScheduling(_In_ PVOID Context)
struct THREAD_DATA * PTHREAD_DATA
static VOID NTAPI CountThread(IN OUT PVOID Context)
struct COUNT_THREAD_DATA * PCOUNT_THREAD_DATA
#define ok_eq_hex(value, expected)
#define ok_eq_long(value, expected)
#define ok_eq_uint(value, expected)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeRaiseIrql(irql, oldIrql)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeLowerIrql(oldIrql)
#define KeSetEvent(pEvt, foo, foo2)
#define KeDelayExecutionThread(mode, foo, t)
LONG NTAPI KePulseEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
LONG NTAPI KeResetEvent(IN PKEVENT Event)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define KeGetCurrentThread
#define OBJ_KERNEL_HANDLE
#define RtlFillMemory(Dest, Length, Fill)
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
VOID KmtSetIrql(IN KIRQL NewIrql)
BOOLEAN KmtIsCheckedBuild
BOOLEAN KmtIsMultiProcessorBuild
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)
#define ExFreePoolWithTag(_P, _T)
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define UNREFERENCED_PARAMETER(P)
enum _EVENT_TYPE EVENT_TYPE
NTSTATUS NTAPI KeWaitForMultipleObjects(IN ULONG Count, IN PVOID Object[], IN WAIT_TYPE WaitType, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL, OUT PKWAIT_BLOCK WaitBlockArray OPTIONAL)
POBJECT_TYPE PsThreadType
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
KPRIORITY PriorityIncrement
static LARGE_INTEGER Counter
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
KPRIORITY NTAPI KeQueryPriorityThread(IN PKTHREAD Thread)
_In_ WDF_POWER_DEVICE_STATE PreviousState
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
#define ObDereferenceObject