[ROSTESTS]
[reactos.git] / rostests / kmtests / ntos_ex / ExPools.c
similarity index 69%
rename from rostests/drivers/kmtest/ntos_pools.c
rename to rostests/kmtests/ntos_ex/ExPools.c
index 37c9987..c635720 100644 (file)
@@ -1,50 +1,25 @@
 /*
- * NTOSKRNL Pools test routines KM-Test
- * ReactOS Kernel Mode Regression Testing framework
- *
- * Copyright 2008 Aleksey Bragin <aleksey@reactos.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * PROJECT:         ReactOS kernel-mode tests
+ * LICENSE:         LGPLv2+ - See COPYING.LIB in the top level directory
+ * PURPOSE:         Kernel-Mode Test Suite Pools test routines KM-Test
+ * PROGRAMMER:      Aleksey Bragin <aleksey@reactos.org>
  */
 
-/* INCLUDES *******************************************************************/
+/* TODO: PoolsCorruption tests fail because accessing invalid memory doesn't necessarily cause an access violation */
 
-#include <ddk/ntddk.h>
-#include <ntifs.h>
-#include <ndk/ntndk.h>
-/* SEH support with PSEH */
-#include <pseh/pseh2.h>
-#include "kmtest.h"
+#include <kmt_test.h>
 
 #define NDEBUG
-#include "debug.h"
+#include <debug.h>
 
 #define TAG_POOLTEST 'tstP'
 
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-VOID
-PoolsTest(HANDLE KeyHandle)
+static VOID PoolsTest(VOID)
 {
     PVOID Ptr;
     ULONG AllocSize, i, AllocNumber;
     PVOID *Allocs;
 
-    StartTest();
-
     // Stress-test nonpaged pool
     for (i=1; i<10000; i++)
     {
@@ -122,20 +97,14 @@ PoolsTest(HANDLE KeyHandle)
 
 
     ExFreePoolWithTag(Allocs, TAG_POOLTEST);
-
-
-    FinishTest(KeyHandle, L"MmPoolAllocTest");
 }
 
-VOID
-PoolsCorruption(HANDLE KeyHandle)
+static VOID PoolsCorruption(VOID)
 {
     PULONG Ptr, TestPtr;
     ULONG AllocSize;
     NTSTATUS Status = STATUS_SUCCESS;
 
-    StartTest();
-
     // start with non-paged pool
     AllocSize = 4096 + 0x10;
     Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST);
@@ -173,6 +142,10 @@ PoolsCorruption(HANDLE KeyHandle)
 
     // free the pool
     ExFreePoolWithTag(Ptr, TAG_POOLTEST);
+}
 
-    FinishTest(KeyHandle, L"MmPoolCorruptionTest");
+START_TEST(ExPools)
+{
+    PoolsTest();
+    PoolsCorruption();
 }