[KMTESTS]

- add kmt_platform.h that includes user or kernel headers as appropriate and allows Rtl tests to run in user mode without modification
- include kmt_platform.h from kmt_test.h, so that tests don't have to include separate headers. This also allows for a PCH

svn path=/branches/GSoC_2011/KMTestSuite/; revision=53021
This commit is contained in:
Thomas Faber 2011-08-01 21:53:52 +00:00
parent f63c9159c8
commit 4230863f75
28 changed files with 61 additions and 92 deletions

View file

@ -5,7 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <kmt_test.h>
START_TEST(Example)

View file

@ -5,8 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <kmt_test.h>
//#define NDEBUG

View file

@ -5,9 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <kmt_test.h>
#include "Example.h"

View file

@ -5,7 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <kmt_test.h>
START_TEST(KernelType)

View file

@ -0,0 +1,48 @@
/*
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPLv2+ - See COPYING in the top level directory
* PURPOSE: Kernel-Mode Test Suite platform declarations
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#ifndef _KMTEST_PLATFORM_H_
#define _KMTEST_PLATFORM_H_
#if defined KMT_KERNEL_MODE || defined KMT_STANDALONE_DRIVER
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
#include <ntstrsafe.h>
#elif defined KMT_USER_MODE
#define WIN32_LEAN_AND_MEAN
#define WIN32_NO_STATUS
#define UNICODE
#include <windows.h>
#include <ndk/ntndk.h>
#include <strsafe.h>
#include <winioctl.h>
#ifdef KMT_EMULATE_KERNEL
#define ok_irql(i)
#ifdef __GNUC__
#define KIRQL __attribute__((__unused__)) int
#elif !defined __GNUC__
#define KIRQL int
#endif /* !defined __GNUC__ */
#undef KeRaiseIrql
#define KeRaiseIrql(new, old)
#undef KeLowerIrql
#define KeLowerIrql(i)
#define ExAllocatePool(type, size) HeapAlloc(GetProcessHeap(), 0, size)
#define ExAllocatePoolWithTag(type, size, tag) HeapAlloc(GetProcessHeap(), 0, size)
#define ExFreePool(p) HeapFree(GetProcessHeap(), 0, p)
#define ExFreePoolWithTag(p, tag) HeapFree(GetProcessHeap(), 0, p)
#endif /* defined KMT_EMULATE_KERNEL */
#endif /* defined KMT_USER_MODE */
#include <pseh/pseh2.h>
#endif /* !defined _KMTEST_PLATFORM_H_ */

View file

@ -13,6 +13,8 @@
#ifndef _KMTEST_TEST_H_
#define _KMTEST_TEST_H_
#include <kmt_platform.h>
#include <stdarg.h>
typedef VOID KMT_TESTFUNC(VOID);

View file

@ -5,21 +5,16 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <strsafe.h>
#include <winioctl.h>
#define KMT_DEFINE_TEST_FUNCTIONS
#include <kmt_test.h>
#include "kmtest.h"
#include <kmt_public.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "kmtest.h"
#include <kmt_public.h>
#define KMT_DEFINE_TEST_FUNCTIONS
#include <kmt_test.h>
#define SERVICE_NAME L"Kmtest"
#define SERVICE_PATH L"kmtest_drv.sys"
#define SERVICE_DESCRIPTION L"ReactOS Kernel-Mode Test Suite Driver"

View file

@ -5,15 +5,11 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <strsafe.h>
#include <kmt_test.h>
#include "kmtest.h"
#include <assert.h>
#include "kmtest.h"
#define SERVICE_ACCESS (SERVICE_START | SERVICE_STOP | DELETE)
static SC_HANDLE ScmHandle;

View file

@ -5,17 +5,12 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <strsafe.h>
#include <winioctl.h>
#include <assert.h>
#include <kmt_test.h>
#include "kmtest.h"
#include <kmt_public.h>
#include <kmt_test.h>
#include <assert.h>
extern HANDLE KmtestHandle;

View file

@ -5,9 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#define WIN32_LEAN_AND_MEAN
#define UNICODE
#include <windows.h>
#include <kmt_test.h>
KMT_TESTFUNC Test_Example;

View file

@ -10,7 +10,6 @@ struct _LIST_ENTRY *__stdcall ExInterlockedInsertHeadList(struct _LIST_ENTRY *,
struct _LIST_ENTRY *__stdcall ExInterlockedInsertTailList(struct _LIST_ENTRY *, struct _LIST_ENTRY *, unsigned long *);
struct _LIST_ENTRY *__stdcall ExInterlockedRemoveHeadList(struct _LIST_ENTRY *, unsigned long *);
#include <ntddk.h>
#include <kmt_test.h>
LIST_ENTRY Entries[5];

View file

@ -5,11 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/exfuncs.h>
#include <pseh/pseh2.h>
#include <kmt_test.h>
/* TODO: don't require user interaction, test Io* routines,

View file

@ -25,9 +25,6 @@ __declspec(dllimport) int __stdcall ExInterlockedDecrementLong(l
__declspec(dllimport) int __stdcall Exi386InterlockedIncrementLong(long *);
__declspec(dllimport) int __stdcall Exi386InterlockedDecrementLong(long *);
#include <ntddk.h>
#include <pseh/pseh2.h>
#include <kmt_test.h>
/* TODO: There are quite some changes needed for other architectures!

View file

@ -7,11 +7,6 @@
/* TODO: PoolsCorruption tests fail because accessing invalid memory doesn't necessarily cause an access violation */
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
/* SEH support with PSEH */
#include <pseh/pseh2.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -5,11 +5,7 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/extypes.h>
#include <kmt_test.h>
#include <pseh/pseh2.h>
//#define NDEBUG
#include <debug.h>

View file

@ -9,7 +9,6 @@ struct _SINGLE_LIST_ENTRY;
struct _SINGLE_LIST_ENTRY *__stdcall ExInterlockedPushEntryList(struct _SINGLE_LIST_ENTRY *, struct _SINGLE_LIST_ENTRY *, unsigned long *);
struct _SINGLE_LIST_ENTRY *__stdcall ExInterlockedPopEntryList(struct _SINGLE_LIST_ENTRY *, unsigned long *);
#include <ntddk.h>
#include <kmt_test.h>
SINGLE_LIST_ENTRY Entries[5];

View file

@ -5,9 +5,6 @@
* PROGRAMMER: Aleksey Bragin <aleksey@reactos.org>
*/
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -7,7 +7,6 @@
/* TODO: most of these calls fail the Windows checked build's !islower assertion and others */
#include <ntifs.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -7,8 +7,6 @@
/* TODO: what's with the prototypes at the top, what's with the if-ed out part? Doesn't process most results */
#include <ntifs.h>
#include <ndk/iotypes.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -6,7 +6,6 @@
*/
/* Based on code Copyright 2008 Etersoft (Alexander Morozov) */
#include <ntddk.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -5,7 +5,6 @@
* PROGRAMMER: Aleksey Bragin <aleksey@reactos.org>
*/
#include <ntddk.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -5,9 +5,6 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ketypes.h>
#include <kmt_test.h>
#define CheckApcs(KernelApcsDisabled, SpecialApcsDisabled, AllApcsDisabled, Irql) do \

View file

@ -5,11 +5,7 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ketypes.h>
#include <kmt_test.h>
#include <pseh/pseh2.h>
//#define NDEBUG
#include <debug.h>

View file

@ -8,11 +8,7 @@
__declspec(dllimport) void __stdcall KeRaiseIrql(unsigned char, unsigned char *);
__declspec(dllimport) void __stdcall KeLowerIrql(unsigned char);
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
#include <kmt_test.h>
#include <pseh/pseh2.h>
#define NDEBUG
#include <debug.h>

View file

@ -7,9 +7,6 @@
/* TODO: this test doesn't process any test results; it also takes very long */
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -14,11 +14,7 @@ __declspec(dllimport) void __stdcall KeReleaseSpinLockFromDpcLevel(unsigned long
/* this define makes KeInitializeSpinLock not use the inlined version */
#define WIN9X_COMPAT_SPINLOCK
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/kefuncs.h>
#include <kmt_test.h>
#include <pseh/pseh2.h>
#include <limits.h>
//#define NDEBUG

View file

@ -7,9 +7,6 @@
/* TODO: this test terminates with an access violation in Windows */
#include <ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
#include <kmt_test.h>
#define NDEBUG

View file

@ -5,16 +5,7 @@
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
*/
/* TODO: move this to some header */
#ifdef KMT_USER_MODE
# include <windows.h>
# define ok_irql(i)
# define KIRQL int
# define KeRaiseIrql(new, old)
# define KeLowerIrql(i)
#elif KMT_KERNEL_MODE
# include <ntddk.h>
#endif
#define KMT_EMULATE_KERNEL
#include <kmt_test.h>
START_TEST(RtlMemory)