Lab 9
As with previous labs, set up an appropriate directory. Get feedback
on your work from the TA (only) during the lab. And submit your work
with the command
$ submit 2031 lab9 script1
The Exercise
Since this lab started with a labtest and then course evaluation forms,
there will be just 1 exercise to attempt.
Write a Bash shell script called script1. It should be properly commented.
script1 will be used to test an executable file that reads from standard
input and writes to standard output. It will take 2 parameters and be
invoked as follows:
$ script1 <name_of_executable> <directory_with_test_cases>
The <directory_with_test_cases> is expected to contain input files
whose names start with in.
and corresponding
expected output files whose names start with out.
.
For example, if the input comes from in.17
, the expected
output is in out.17
.
To give you something to work with, the files used to test question 4 of assignment 1 can be found
at /cs/course/2031/Lab9/A1_Test_Cases/
. Just type
$ ls /cs/course/2031/Lab9/A1_Test_Cases/
to see a list of the test cases.
Executables created from the submitted q4.c programs from assignment 1
can be found at /cs/course/2031/Lab9/A1_Executables
.
Just type
$ ls /cs/course/2031/Lab9/A1_Executables/
to see the list of executables.
What your script1
should do is
Here is the result of one incorrect invocation of script1 and then 3 sample runs:
$
$ ./script1 aa bb cc
Usage: script1 <name_of_executable> <directory_with_test_cases> <--- written to standard error, not standard output
$
$ script1 /cs/course/2031/Lab9/A1_Executables/12.q4 /cs/course/2031/Lab9/A1_Test_Cases
63 tests passed out of 93
$
$ script1 /cs/course/2031/Lab9/A1_Executables/21.q4 /cs/course/2031/Lab9/A1_Test_Cases
26 tests passed out of 93
$
$ script1 /cs/course/2031/Lab9/A1_Executables/8.q4 /cs/course/2031/Lab9/A1_Test_Cases
52 tests passed out of 93
$
$ script1 /cs/course/2031/Lab9/A1_Executables/7.q4 /cs/course/2031/Lab9/A1_Test_Cases
93 tests passed out of 93
To follow
Of course, testing isn't that easy. In the next labs, you'll
-
start with the submitted source code instead of the executable.
-
note whether the code compiles
-
note whether it compiles, but with warnings
-
note whether it produces error messages when it runs
-
deal with programs that
-
use too much cpu time (perhaps appear to hang)
-
use too much clock time (perhaps appear to hang)
-
create files that are too large (perhaps writing in an infinite loop)
-
use up too much memory when running
-
etc.
end of lab 9