nachos.kernel.devices.test
Class ConsoleTest

java.lang.Object
  extended by nachos.kernel.devices.test.ConsoleTest

public class ConsoleTest
extends java.lang.Object

Class for testing the Console hardware device.


Nested Class Summary
private static class ConsoleTest.ConsHandler
          Console interrupt handler class.
 
Field Summary
private static nachos.machine.Console console
          Instance of the console device being tested.
private static Semaphore readAvail
          Semaphore used to wait for available input.
private static Semaphore writeDone
          Semaphore used to wait until printing is done.
 
Constructor Summary
ConsoleTest()
           
 
Method Summary
static void run(java.lang.String in, java.lang.String out)
          Test the console by echoing characters typed at the input onto the output.
static void start(java.lang.String[] args)
          Entry point for the Console test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

console

private static nachos.machine.Console console
Instance of the console device being tested.


readAvail

private static Semaphore readAvail
Semaphore used to wait for available input.


writeDone

private static Semaphore writeDone
Semaphore used to wait until printing is done.

Constructor Detail

ConsoleTest

public ConsoleTest()
Method Detail

run

public static void run(java.lang.String in,
                       java.lang.String out)
Test the console by echoing characters typed at the input onto the output. Stop when the user types a 'q'.

Parameters:
in - If non-null, the name of a file from which to read input. If null, then read input from the keyboard.
out - If non-null, the name of a file to which to direct output. If null, then direct output to the display.

start

public static void start(java.lang.String[] args)
Entry point for the Console test. If "-c" is included in the command-line arguments, then run the console test; otherwise, do nothing. If "-c" is followed by two more arguments, then they are interpreted as the names of files from which to read the console input and to which to direct the console output, respectively; otherwise, input is read from the keyboard, and output is directed to the display. The console test reads characters from the input and echoes them onto the output. The test ends when a 'q' is read.

Parameters:
args - Command-line arguments.