-
Notifications
You must be signed in to change notification settings - Fork 1
/
ts3.sh
executable file
·106 lines (82 loc) · 2.78 KB
/
ts3.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh
# UCLA CS 111 Lab 1c testing script, written by Zhaoxing Bu (zbu@cs.ucla.edu)
# to reader: please read the entire script carefully
# students can work in a team of two, you only need to write down the score for
# the student who submit the assignmet. in your score file sent back to us,
# please make sure that you have a column storing this student's teammate's UID,
# thus we can give his/her partner score by the UID column.
# 3 test cases, each for 10 points
# no partial credit, students get either 10 or 0
# please do not run multiple testing scripts at the same time
# only run this on lnxsrv09.seas.ucla.edu please
# REMEMBER to execute PATH=/usr/local/cs/bin:$PATH in shell to call
# the correct gcc for compiling students' work
# this PATH change is restored after logging out
# this script automatically changes the PATH value for you
# but I do not guarantee it works, but if should work ;-)
# any comments, suggestions, problem reports are greatly welcomed
if [ "${PATH:0:16}" == "/usr/local/cs/bin" ]
then
true
else
PATH=/usr/local/cs/bin:$PATH
fi
echo "please check if there is any error message below"
echo "==="
if [ -e "simpsh" ]
then
rm -rf simpsh
fi
make || exit
# chmod 744 simpsh
TEMPDIR="lab1creadergradingtempdir"
rm -rf $TEMPDIR
mkdir $TEMPDIR
if [ "$(ls -A $TEMPDIR 2> /dev/null)" == "" ]
then
true
else
echo "fatal error! the testing directory is not empty"
exit 1
fi
mv simpsh ./$TEMPDIR/
cp a0.txt ./$TEMPDIR/
cd $TEMPDIR
# use the provided lab1c_generate_a0.sh and pg98.txt to generate a0.txt
# please use the provided a0.txt and make sure it is not modified by any code
echo "==="
echo "please DO NOT run multiple testing scripts at the same time"
echo "starting grading"
NUM_PASSED=0
NUM_FAILED=0
# test case 1 --profile almost no time
echo ""
echo "--->test case 1:"
echo "check if there is time info for --rdonly command"
echo "time should be almost 0"
touch test1in.txt
./simpsh --profile --rdonly test1in.txt
# test case 2 --profile scope
echo ""
echo "--->test case 2:"
echo "in terms of each command's time"
echo "you should only see time info for --wronly, but not for --rdonly"
touch test2in.txt
touch test2out.txt
./simpsh --rdonly test2in.txt --profile --wronly test2out.txt
# test case 3 --profile sort large file
echo ""
echo "--->test case 3:"
echo "check time info for --command sort, should not be 0 (you can test"
echo "the uniq command by yourself to see the running time in shell"
echo "here you may see multiple running time, but there should be one"
echo "corresponding to the running time of uniq the a0.txt"
touch test3out.txt
touch test3err.txt
./simpsh --rdonly a0.txt --wronly test3out.txt \
--wronly test3err.txt --profile --command 0 1 2 uniq --wait
echo ""
echo "student's README file"
echo "==="
cat ../README
echo "==="