#!/bin/sh # # ASSIGN1.TEST # $Id: assign1.test,v 1.4 2000/10/04 18:21:34 herlock Exp herlock $ # # To create a test script of your programs put this file and your stats # program, which must be named "stats", together in a directory. Then run # the command "sh assign1.test > test_script". This test will take several # minutes to complete (probably 10 to 15 minutes). Then edit the test_script # output to include your name, student id, and email address at the top; if # you work in a group be sure to include this information for all members of # your group. Then submit the file test_script as your homework. # # % sh assign1.test > test_script # % emacs test_script # add your name, email address, and id # # Your whole program must be contained in the single file named "stats". # If you use multiple files, you will have to modify this script below, where # it says MULTIPLE FILE STATS PROGRAMS REQUIRE MODIFICATIONS HERE! # # Be sure to check the test_script file before you send it in. Be sure # it has your name, id, and email address; be sure it includes a copy # of your stats program, and be sure all the tests have run successfully. # echo ========================================================================== echo echo CS 311 -- Assignment I echo echo Name: echo Student ID: echo Email: echo echo Name: echo Student ID: echo Email: echo echo Name: echo Student ID: echo Email: echo echo echo ========================================================================== echo date uname -a whoami echo echo ========================================================================== echo echo echo LS=/bin/ls RM=rm PS=/bin/ps TESTDIR=assign1.test.$$ STATS=./stats if test -d $TESTDIR then echo Please rename or remove $TESTDIR exit 1 fi mkdir $TESTDIR 2>&1 # MULTIPLE FILE STATS PROGRAMS REQUIRE MODIFICATIONS HERE! # If for some reason your stats program needs other support files # modify this script so these other files are copied into the test directory, # made executable, and catted out (or be sure to include those other files # in your email.) cp stats $TESTDIR 2>&1 cd $TESTDIR 2>&1 chmod +x stats 2>&1 echo -------------------------------------------------------------------------- echo Cat stats program echo cat stats 2>&1 echo echo echo -------------------------------------------------------------------------- echo Creating file1 file2 file3 file4 file5 echo cat > file1 < file2 < file3 < file4 < file5 echo $LS -l 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 1 Statistics by Rows echo $STATS -rows file1 2>&1 echo echo echo -------------------------------------------------------------------------- echo Check for Temporary Files echo $LS 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 1 Statistics by Cols echo $STATS -cols file1 2>&1 echo echo echo -------------------------------------------------------------------------- echo Check for Temporary Files echo $LS 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 2 Statistics by Rows echo $STATS -rows file2 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 2 Statistics by Cols echo $STATS -cols file2 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 3 Statistics by Rows echo $STATS -rows file3 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 3 Statistics by Cols echo $STATS -cols file3 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 4 Statistics by Rows echo $STATS -rows file4 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 4 Statistics by Cols echo $STATS -cols file4 2>&1 echo echo echo -------------------------------------------------------------------------- echo File 5 Statistics by Cols echo $STATS -cols file5 2>&1 echo echo echo -------------------------------------------------------------------------- echo Check for Temporary Files echo $LS 2>&1 echo echo echo -------------------------------------------------------------------------- echo Good Syntax echo echo Standard Input on Rows $STATS -rows < file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Standard Input on Cols $STATS -cols < file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Option -cols $STATS -cols file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Option -rrrrrr $STATS -rrrrrr file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Option -cccccc $STATS -cccccc file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Option -r $STATS -r file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo echo -------------------------------------------------------------------------- echo Bad Syntax echo echo Too Few Arguments $STATS 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Too Many Arguments $STATS -r file1 file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Wrong Format $STATS file1 file2 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo Bad Option $STATS -x file1 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo echo echo -------------------------------------------------------------------------- echo File Not Readable echo chmod 000 file3 2>&1 echo $STATS -r file3 2> err.out echo Exit Value: $? echo Error Message: cat err.out echo $RM -f err.out 2>&1 echo echo echo -------------------------------------------------------------------------- echo Check for Temporary Files echo $LS 2>&1 echo echo echo -------------------------------------------------------------------------- echo Simultaneous Runs echo $STATS -rows < file1 > simrun1.out 2>&1 & PID1=$! $STATS -rows < file1 > simrun2.out 2>&1 & PID2=$! $STATS -rows < file1 > simrun3.out 2>&1 & PID3=$! sleep 2 echo echo Before Finishing $LS 2>&1 echo while ($PS | egrep "^ *($PID1)|($PID2)|($PID3)" > /dev/null) do echo waiting... sleep 5 done echo echo Run 1 Output cat simrun1.out 2>&1 echo echo Run 2 Output cat simrun2.out 2>&1 echo echo Run 3 Output cat simrun3.out 2>&1 echo $RM -f simrun[123].out 2>&1 echo echo After Finishing $LS 2>&1 echo echo cd .. $RM -rf $TESTDIR 2>&1