-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiny_test.sh
More file actions
executable file
·71 lines (56 loc) · 1.98 KB
/
Copy pathtiny_test.sh
File metadata and controls
executable file
·71 lines (56 loc) · 1.98 KB
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
#! /bin/bash
# Tests Assignment 08 solution.
# Set the port to run on. You should change this because
# there might be other students running on the same port
# as you to run tiny!
TINYPORT=2000
# make sure you execute make before running this test!
# run tiny web server
./tiny $TINYPORT web/test_index.txt &
# wait until indexing is complete
sleep 7
# run curl
curl -s "http://localhost:$TINYPORT/search?value=cats">test/stest1.html
curl -s "http://localhost:$TINYPORT/search?value=death" > test/stest2.html
curl -s "http://localhost:$TINYPORT/search?value=death+Virginia" > test/stest3.html
curl -s "http://localhost:$TINYPORT/search?value=the" > test/stest4.html
curl -s "http://localhost:$TINYPORT/search?value=apple" > test/stest5.html
curl -s "http://localhost:$TINYPORT/search?value=orange" > test/stest6.html
curl -s "http://localhost:$TINYPORT/search?value=banana+pear" > test/stest8.html
curl -s "http://localhost:$TINYPORT/search?value=zero" > test/stest9.html
curl -s "http://localhost:$TINYPORT/search?value=chicken" > test/stest10.html
curl -s "http://localhost:$TINYPORT/search?value=food" > test/stest11.html
# kill tiny
##killall tiny
# compare
if diff -b test/test1.html test/stest1.html; then
echo "test/stest1 PASSED"
fi
if diff -b test/test2.html test/stest2.html; then
echo "test/stest2 PASSED"
fi
if diff -b test/test3.html test/stest3.html; then
echo "test/stest3 PASSED"
fi
if diff -b test/test4.html test/stest4.html; then
echo "test/stest4 PASSED"
fi
if diff -b test/test5.html test/stest5.html; then
echo "test/stest5 PASSED"
fi
if diff -b test/test6.html test/stest6.html; then
echo "test/stest6 PASSED"
fi
if diff -b test/test8.html test/stest8.html; then
echo "test/stest8 PASSED"
fi
if diff -b test/test9.html test/stest9.html; then
echo "test/stest9 PASSED"
fi
if diff -b test/test10.html test/stest10.html; then
echo "test/stest10 PASSED"
fi
if diff -b test/test11.html test/stest11.html; then
echo "test/stest11 PASSED"
fi
rm test/stest*