nachos.kernel.filesys.test
Class FileSystemTest

java.lang.Object
  extended by nachos.kernel.filesys.test.FileSystemTest

public class FileSystemTest
extends java.lang.Object

This class implements some simple test routines for the file system. We implement: Copy -- copy a file from UNIX to Nachos; Print -- cat the contents of a Nachos file; Perftest -- a stress test for the Nachos file system read and write a really large file in tiny chunks (won't work on baseline system!).


Field Summary
private static byte[] Contents
          Bytes in the test data.
private static int ContentSize
          Length of the test data.
private static java.lang.String ContentString
          Test data to be written to the file in the performance test.
private static java.lang.String FileName
          Name of the file to create for the performance test.
private static int FileSize
          Total size of the test file.
private static int TransferSize
          Transfer data in small chunks, just to be difficult.
 
Constructor Summary
FileSystemTest()
           
 
Method Summary
private static boolean byteCmp(byte[] a, byte[] b, int len)
          Compare two byte arrays to see if they agree up to a specified length.
private static void copy(java.lang.String from, java.lang.String to)
          Copy the contents of the host file "from" to the Nachos file "to"
private static void fileRead()
          Read and verify the file for the performance test.
private static void fileWrite()
          Write the test file for the performance test.
private static void performanceTest()
          Stress the Nachos file system by creating a large file, writing it out a bit at a time, reading it back a bit at a time, and then deleting the file.
private static void print(java.lang.String name)
          Print the contents of the Nachos file "name".
static void start(java.lang.String[] args)
          Entry point for the filesystem test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TransferSize

private static final int TransferSize
Transfer data in small chunks, just to be difficult.

See Also:
Constant Field Values

FileName

private static final java.lang.String FileName
Name of the file to create for the performance test.

See Also:
Constant Field Values

ContentString

private static final java.lang.String ContentString
Test data to be written to the file in the performance test.

See Also:
Constant Field Values

ContentSize

private static final int ContentSize
Length of the test data.


Contents

private static final byte[] Contents
Bytes in the test data.


FileSize

private static final int FileSize
Total size of the test file.

Constructor Detail

FileSystemTest

public FileSystemTest()
Method Detail

copy

private static void copy(java.lang.String from,
                         java.lang.String to)
Copy the contents of the host file "from" to the Nachos file "to"

Parameters:
from - The name of the file to be copied from the host filesystem.
to - The name of the file to create on the Nachos filesystem.

print

private static void print(java.lang.String name)
Print the contents of the Nachos file "name".

Parameters:
name - The name of the file to print.

performanceTest

private static void performanceTest()
Stress the Nachos file system by creating a large file, writing it out a bit at a time, reading it back a bit at a time, and then deleting the file. Implemented as three separate routines: FileWrite -- write the file; FileRead -- read the file; PerformanceTest -- overall control, and print out performance #'s.


fileWrite

private static void fileWrite()
Write the test file for the performance test.


fileRead

private static void fileRead()
Read and verify the file for the performance test.


byteCmp

private static boolean byteCmp(byte[] a,
                               byte[] b,
                               int len)
Compare two byte arrays to see if they agree up to a specified length.

Parameters:
a - The first byte array.
b - The second byte array.
len - The number of bytes to compare.
Returns:
true if the arrays agree up to the specified number of bytes, false otherwise.

start

public static void start(java.lang.String[] args)
Entry point for the filesystem test. Process command-line arguments, performing any actions they indicate.

Parameters:
args - The command-line arguments.