Syscache Test

Note This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.

Type: Automated Test

Overview

Syscache is a test that writes to a file and verifies that the data written is read back correctly. It can detect corruptions caused by anything in the path from firmware, drivers, file system, or memory. It uses a standard Win32 File System and memory management APIs to read and write data from the file.

The test binary is Readwrit.exe.

Details

Syscache opens a file with a certain flag or attribute, and it writes to the file. Each selected flag may span several runs on the file. A run is defined as a set of the following sequence:

  1. Create/open a file.
  2. Truncate the filesize to 0.
  3. Write to the file.
  4. Close the file.
  5. Reopen the file.
  6. Read the file.
  7. Verify file content.
  8. Close the file.

There is a set of zero and non-zero regions in the file. Zero regions are areas in the file where no data was written. Non-zero regions are areas in the file where data was written. The pattern is a DWORD of the format RRPPPPPP. The top two bytes are the run number, and the next three bytes are the one’s complement of the offset of this DWORD in the file.

Attributes used for writing a file:

Write Attribute Explanation
FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
FILE_FLAG_SEQUENTIAL_SCAN FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
FILE_FLAG_NO_BUFFERING FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
FILE_FLAG_RANDOM_ACCESS FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
FILE_FLAG_WRITE_THROUGH FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
FILE_ATTRIBUTE_TEMPORARY FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
NO_BUFFERING | WRITE_THROUGH FILE_ATTRIBUTE_NORMAL See CreateFile() Documentation
FILE_ATTRIBUTE_SPARSE_FILE The file is set to sparse.
NORMAL APPEND_WRITE Same as FILE_ATTRIBUTE_NORMAL; closes and reopening the file per write and appending the next region.
FILE_FLAG_SECTOR_CHUNKS Same as FILE_FLAG_NO_BUFFERING, data is written one sector at a time.
FILE_MAP Same as FILE_ATTRIBUTE_NORMAL, data is written via memory mapping.
FILE_FLAG_OVEREXTEND Same as FILE_ATTRIBUTE_NORMAL, data is written via memory mapping, but aligned at 0x10000 boundaries.

Attributes used for reading from the file:

Read Attribute Explanation
FILE_MAP FILE_ATTRIBUTE_NORMAL, data is read via memory mapping
NO_BUFFERING FILE_FLAG_NO_BUFFERING
NORMAL FILE_ATTRIBUTE_NORMAL
RANDOM_ACCESS FILE_FLAG_RANDOM_ACCESS
SEQUENTIAL_SCAN FILE_FLAG_SEQUENTIAL_SCAN
TEMPORARY FILE_FLAG_TEMPORARY
WRITE_THROUGH FILE_FLAG_WRITE_THROUGH

Run Time:1 hour

Log File:

Syscache-NTFS.log

Syscache-CNTFS.log

Syscache-FAT16.log

Syscache-FAT32.log

Syscache-ExFAT.log

Syscache-UDF.log

System Restart Required: Yes

Test Category:Kernel Mode Filter Drivers

Supported operating systems for Logo or Signature testing:

  • Windows 7 SP1

  • Windows Server 2008 R2 SP1

Program: IFSTest.exe

Requirements

Software Requirements

The test tool requires the following software:

  • Supported operating system (see list above)
  • Filter driver to be tested, along with any supporting application suite

Hardware Requirements

  • Computer that meets the minimum software requirements
  • Windows keyboard
  • Two-button pointing device
  • Color display monitor capable of at least 1024 by 768 resolution, 32-bits per pixel, 60 Hz
  • Hard drive with a minimum of 20 GB available on partition C:
  • Extra hard drive space for four simple 2048 mb partitions and two simple 1024 mb partitions

Processor

The test tool runs on the following processor architectures:

  • x86
  • x64

Running the Test

Before running the test, the following partitions need to be added to the Windows environment:

Label File System Size Expected Drive Letter
NTFS ntfs 2048mb g:
CNTFS ntfs (compressed) 2048mb i:
FAT Fat16 1024mb k:
FAT32 Fat32 1024mb l:
ExFAT ExFat 2048mb m:
UDF UDF 2048mb n:

When executed, the test will run variations for each of the six partitions above.

All test cases return PASS or FAIL. Review the test results in the log file for specific details about failures.

RunFileIO.cmd contains references to environment variables that can be changed to allow for skipping of certain file systems.

Command Syntax

Command option Description
-l TempFileLocation

Directory where TempFile will be created.

Default = current directory

-p TempFilePrefix

Three character prefix for the TempFile.

Default = "cac"

-s SeedValue

Seed to generate random numbers.

Default = program generated

-z FileSize

Max size of TempFile in megabytes.

Default = TempFile size up to 1 MB.

-m

Flush System Cache before verifying file.

Default = No flush

-f

Flush files after writing

Default = No flush

-d

Break into the debugger if the file is corrupt.

Default = Do not break into the debugger

-e

Continue test after a failure.

Default = Exit upon failure

-C

Continue checking for corruption for succeeding data after detecting corruption.

-t

Stress mode.

Default = No stress mode

-n minutes

Minimum minutes test should run.

-c

Run in cluster-aware mode.

-y Log file name

Name of log file.

-v level

Name of log file.

0 = quiet

1 = normal default level

2 = output to screen as well

-S

Permute order of variations.

-N

Use new expanded set of variations to enable single cached reader, single unbuffered reader, etc.

-B

Let the readers move from back to front when verifying 50% of the time.

-R file

Run reboot tests.

Use the given file to store data.

-W size

Working set maximum size to use.

-r ReadThread

Does not spawn thread that does read with:

0

NORMAL

1

SEQUENTIAL_SCAN

2

NO_BUFFERING

3

RANDOM_ACCESS

4

WRITE_THROUGH

5

FILE_MAP

6

TEMPORARY

-X

Exclude SPARSE FILE write test on CSC drives.

-O options

Debug options.

Options are hex flags.

0x0001

DebugBreak after parse.

0x0002

Flag events for WMI logging.

-w WriteThread

Does not do write with:

0

FILE_ATTRIBUTE_NORMAL

1

FILE_FLAG_SEQUENTIAL_SCAN

2

FILE_FLAG_SECTOR_CHUNKS

3

FILE_FLAG_NO_BUFFERING

4

FILE_FLAG_RANDOM_ACCESS

5

FILE_FLAG_WRITE_THROUGH

6

FILE_MAP

7

FILE_FLAG_OVEREXTEND

8

FILE_ATTRIBUTE_TEMPORARY

9

NO_BUFFERING | WRITE_THROUGH

10

FILE_ATTRIBUTE_SPARSE_FILE

11

NORMAL APPEND_WRITE

Default = Do all writes

Troubleshooting

Note This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.

When the test fails, the log contains all the information needed to analyze the failure. Look for the following information:

  • Write attributes, to find how the data was written to the file

  • Read attributes, to find out how the data was read back from the file

  • Offset at which the error occurred

  • Region of the file where the error occurred

    Note The test typically writes the entire region using a single write (with the exception of the FILE_FLAG_SECTOR_CHUNKS option).

With the above information, you should be able to reproduce the failure on your own.

Code Tour

File Manifest

File Location
readwrit.exe [WTT\TestBinRoot]\NTTest\BASETEST\core_file_services\cachemgr\
RunSyscache.cmd [WTT\TestBinRoot]\NTTest\BASETEST\Core_File_Services\FilterManager\TestSuite\Scripts\FileSystems\
WrapSyscache.cmd [WTT\TestBinRoot]\NTTest\BASETEST\Core_File_Services\FilterManager\TestSuite\Scripts\FileSystems\
ntlog.dll [WTT\TestBinRoot]\NTTest\CommonTest\NtLog\
ntlogger.ini [WTT\TestBinRoot]\NTTest\CommonTest\NtLog\
stresslog.dll [WTT\TestBinRoot]\NTTest\basetest\core_file_services\shared_libs\

Test Assertions

Note This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.

The tests expect the partitions to be in place.

Build date: 9/14/2012