-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.sh
67 lines (58 loc) · 1.73 KB
/
tests.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
#!/bin/bash
#test1
if [ $1 -eq 1 ]; then
./writer.o "we the people of india "
./writer.o "having solemnly resolved "
./writer.o "to constitute india into a "
sleep 1
./reader.o 50 > output1.log 2>&1 & \
./reader.o 50 > output2.log 2>&1 & \
./reader.o 50 > output3.log 2>&1 &
sleep 1
./writer.o "sovereign socialist secular "
#test2
elif [ $1 -eq 2 ]; then
./reader.o 25 > output1.log 2>&1 & \
./reader.o 25 > output2.log 2>&1 & \
./reader.o 25 > output3.log 2>&1 &
sleep 2
./writer.o "we the people of india having solemnly resolved"
sleep 5
./writer.o "to constitute india into a "
#test3
elif [ $1 -eq 3 ]; then
./writer.o "we the people of india having solemnly resolved"
sleep 1
./reader.o 25 > output1.log 2>&1 & \
./writer.o "to constitute india into a " & \
./reader.o 25 > output2.log 2>&1 & \
./reader.o 25 > output3.log 2>&1 &
#test4
#multiple writers together
elif [ $1 -eq 4 ]; then
./writer.o "we the people of india " & \
./writer.o "having solemnly resolved " & \
./writer.o "to constitute india into a " &
sleep 1
./reader.o 50 > output1.log 2>&1 & \
./reader.o 50 > output2.log 2>&1 &
#test5
#multiple readers and writers together on an empty stack
elif [ $1 -eq 5 ]; then
./reader.o 25 > output1.log 2>&1 & \
./writer.o "to constitute india into a " & \
./reader.o 25 > output2.log 2>&1 & \
./reader.o 25 > output3.log 2>&1 & \
./writer.o "we the people of india having solemnly resolved" &
#test6
#reader on an empty stack
elif [ $1 -eq 6 ]; then
./reader.o 25 > output1.log 2>&1 & \
sleep 2 & \
./writer.o "to constitute india into a " &
#test7
#reader and writer together on an empty stack
elif [ $1 -eq 7 ]; then
./reader.o 25 > output1.log 2>&1 & \
./writer.o "to constitute india into a " &
fi