-
Notifications
You must be signed in to change notification settings - Fork 0
/
testbench.sh
executable file
·151 lines (133 loc) · 2.11 KB
/
testbench.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
# Some simple tasks
./ts -K
./ts ls
./ts -n ls > /dev/null
./ts -f ls
./ts -nf ls > /dev/null
./ts ls
./ts cat
./ts -w
LINES=`./ts -l | grep finished | wc -l`
if [ $LINES -ne 5 ]; then
echo "Error in simple tasks."
exit 1
fi
./ts -K
# Check errorlevel 1
./ts -f ls
if [ $? -ne 0 ]; then
echo "Error in errorlevel 1."
exit 1
fi
# Check errorlevel 2
./ts -f patata
if [ $? -eq 0 ]; then
echo "Error in errorlevel 2."
exit 1
fi
# Check errorlevel 3
./ts patata
if [ $? -ne 0 ]; then
echo "Error in errorlevel 3."
exit 1
fi
# Check errorlevel 4
./ts ls
./ts -w
if [ $? -ne 0 ]; then
echo "Error in errorlevel 4."
exit 1
fi
# Check errorlevel 5
./ts patata
./ts -w
if [ $? -eq 0 ]; then
echo "Error in errorlevel 5."
exit 1
fi
./ts -K
# Check urgency
./ts sleep 1
./ts ls
./ts patata
./ts -w
if [ $? -eq 0 ]; then
echo "Error in urgency 1."
exit 1
fi
./ts sleep 1
./ts ls
./ts patata
./ts -u
./ts -w
if [ $? -ne 0 ]; then
echo "Error in urgency 2."
exit 1
fi
./ts -K
./ts sleep 1
./ts ls
./ts patata
./ts -u 2
./ts -w
if [ $? -ne 0 ]; then
echo "Error in urgency 3."
exit 1
fi
# Test remove job
./ts -K
./ts sleep 1 &&
./ts ls 1 &&
./ts ls 2 &&
./ts -r 1 &&
./ts -r &&
./ts sleep 1 &&
./ts -n ls > /dev/null &&
./ts -n ls 2 > /dev/null &&
./ts -r &&
./ts -w
if [ $? -ne 0 ]; then
echo "Error in remove job."
exit 1
fi
./ts -K
# Test not adding the job to finished.
./ts ls
./ts -w
LINES=`./ts -l | grep finished | wc -l`
if [ $LINES -ne 1 ]; then
echo "Error in not adding the job to finished."
exit 1
fi
./ts -nf ls > /dev/null
LINES=`./ts -l | grep finished | wc -l`
if [ $LINES -ne 1 ]; then
echo "Error in not adding the job to finished."
exit 1
fi
./ts -K
# Test clearing the finished jobs
./ts ls
./ts ls
./ts ls
./ts -nf ls > /dev/null
./ts -C
LINES=`./ts -l | wc -l`
if [ $LINES -ne 1 ]; then
echo "Error clearing the finished jobs."
exit 1
fi
./ts -K
# Test clearing the finished jobs
# We start the daemon
./ts > /dev/null
J1=`./ts sleep 1`
J2=`./ts sleep 2`
J3=`./ts sleep 3`
./ts -U $J2-$J3
if [ $? -ne 0 ]; then
echo "Error clearing the finished jobs."
exit 1
fi
./ts -K