https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f7c0236fc10e833b62e4f67c29c9093718f2facc

commit f7c0236fc10e833b62e4f67c29c9093718f2facc
Author:     Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Dec 22 12:42:05 2018 +0100
Commit:     Pierre Schweitzer <pie...@reactos.org>
CommitDate: Sat Dec 22 12:42:05 2018 +0100

    [KMTESTS:CC] Add more tests for SetFileSizes
    
    These are covered by Thomas' patch.
    
    CORE-11819
---
 modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c  | 11 +++++++++--
 modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c |  8 +++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c 
b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c
index cc8840dc85..3934b9d6a8 100644
--- a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c
@@ -171,13 +171,18 @@ PerformTest(
             Fcb->Header.FileSize.QuadPart = VACB_MAPPING_GRANULARITY - 
PAGE_SIZE;
             Fcb->Header.ValidDataLength.QuadPart = VACB_MAPPING_GRANULARITY - 
PAGE_SIZE;
 
+            if (TestId > 1 && TestId < 4)
+            {
+                Fcb->Header.AllocationSize.QuadPart = VACB_MAPPING_GRANULARITY 
- PAGE_SIZE;
+            }
+
             KmtStartSeh();
             CcInitializeCacheMap(TestFileObject, 
(PCC_FILE_SIZES)&Fcb->Header.AllocationSize, TRUE, &Callbacks, NULL);
             KmtEndSeh(STATUS_SUCCESS);
 
             if (!skip(CcIsFileCached(TestFileObject) == TRUE, 
"CcInitializeCacheMap failed\n"))
             {
-                if (TestId == 0)
+                if (TestId == 0 || TestId == 2)
                 {
                     Offset.QuadPart = 0;
                     KmtStartSeh();
@@ -194,6 +199,7 @@ PerformTest(
                     CcSetFileSizes(TestFileObject, &NewFileSizes);
                     KmtEndSeh(STATUS_SUCCESS);
 
+                    Fcb->Header.AllocationSize.QuadPart = 
VACB_MAPPING_GRANULARITY;
                     Fcb->Header.FileSize.QuadPart = VACB_MAPPING_GRANULARITY;
 
                     Offset.QuadPart = 0;
@@ -208,7 +214,7 @@ PerformTest(
                         CcUnpinData(Bcb);
                     }
                 }
-                else if (TestId == 1)
+                else if (TestId == 1 || TestId == 3)
                 {
                     Buffer = ExAllocatePool(NonPagedPool, PAGE_SIZE);
                     if (!skip(Buffer != NULL, "ExAllocatePool failed\n"))
@@ -226,6 +232,7 @@ PerformTest(
                         CcSetFileSizes(TestFileObject, &NewFileSizes);
                         KmtEndSeh(STATUS_SUCCESS);
 
+                        Fcb->Header.AllocationSize.QuadPart = 
VACB_MAPPING_GRANULARITY;
                         Fcb->Header.FileSize.QuadPart = 
VACB_MAPPING_GRANULARITY;
                         RtlZeroMemory(Buffer, PAGE_SIZE);
 
diff --git a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c 
b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c
index 6e8a11dfff..121598444c 100644
--- a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c
+++ b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c
@@ -18,10 +18,12 @@ START_TEST(CcSetFileSizes)
     KmtLoadDriver(L"CcSetFileSizes", FALSE);
     KmtOpenDriver();
 
-    /* 0: mapped data
-     * 1: copy read
+    /* 0: mapped data - only FS
+     * 1: copy read - only FS
+     * 2: mapped data - FS & AS
+     * 3: copy read - FS & AS
      */
-    for (TestId = 0; TestId < 2; ++TestId)
+    for (TestId = 0; TestId < 4; ++TestId)
     {
         Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId);
         ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);

Reply via email to