Return to labs index
Assignment #5, Part II - Test Driver
Due Thursday, March 20, 2008 at 11:59PM(Thursday)

Overview

Last week, because of the exam, we let you off without writing a test driver. But, conveniently enough, we do have a couple of spare days this week. So, you are asked to write a shell script test driver for the dictionary array lab.

The Test Driver

The test driver should operate as follows:

  testlab5 dictdir resultsdir querylistfile
  

dictdir specifies a directory that contains all of the dictionary files. resultsdir specifies a diretory into which all result files are written. querylistfile specifies a plain text file that contains a list of arguments to be fed to lab 5.

For example, consider the following two invocations of lab 5:

  lab5 nounsDict.txt verbsDict.txt adverbsDict.txt languagequeries.txt
  lab5 colorsDict.txt namesDict.txt animalsDict.txt toythemes.txt
  

We can create a querylist file to represent these two queries executed in this order as follows:

  nounsDict.txt verbsDict.txt adverbsDict.txt languagequeries.txt
  colorsDict.txt namesDict.txt animalsDict.txt toythemes.txt
  

For each line within the query list file, the test driver should run the query and sore the results into a new file to be created within the results directory. The results files should be named test1.txt, test2.txt, test3.txt, etc., etc., etc. The number in the file name should represent the line number from the query list file. In other words the results from the first line of the query list file should be stored within test1.txt. The results from the second line, test2.txt, etc.

The test driver should print a meaningful warning and terminate immediately if:

  1. the input directory does not exist, or is not a directory
  2. the output directory does not exist, or is not a directory
  3. the query list file does not exist, or is not a regular file

The test driver should print a meaningful warning and skip the affected test, but continue with the ret of the tests, if:

  1. Any of the dictionary files do not exist or are not regular files
  2. The query file does not exist or is not a regualr file.
  3. The results file already exists

We're Here To Help!

As always -- remember, we're here to help!