Parent Directory
|
Revision Log
Add a file with a short name (x).
1 | #!/bin/sh |
2 | # proxy.sh - test jscoverage-server --proxy |
3 | # Copyright (C) 2008 siliconforks.com |
4 | # |
5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by |
7 | # the Free Software Foundation; either version 2 of the License, or |
8 | # (at your option) any later version. |
9 | # |
10 | # This program is distributed in the hope that it will be useful, |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | # GNU General Public License for more details. |
14 | # |
15 | # You should have received a copy of the GNU General Public License along |
16 | # with this program; if not, write to the Free Software Foundation, Inc., |
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 | |
19 | set -e |
20 | |
21 | shutdown() { |
22 | wget -q -O- --post-data= "http://127.0.0.1:${proxy_server_port}/jscoverage-shutdown" > /dev/null |
23 | wait $proxy_server_pid |
24 | } |
25 | |
26 | shutdown_perl() { |
27 | wget -q -O- --post-data= http://127.0.0.1:8000/perl-shutdown > /dev/null |
28 | wait $origin_server_pid |
29 | } |
30 | |
31 | cleanup() { |
32 | rm -fr EXPECTED ACTUAL DIR OUT |
33 | shutdown |
34 | shutdown_perl |
35 | } |
36 | |
37 | trap 'cleanup' 0 1 2 3 15 |
38 | |
39 | export PATH=.:..:$PATH |
40 | |
41 | if [ -z "$VALGRIND" ] |
42 | then |
43 | delay=0.2 |
44 | else |
45 | delay=2 |
46 | fi |
47 | |
48 | cd recursive |
49 | perl ../server.pl > /dev/null 2> /dev/null & |
50 | origin_server_pid=$! |
51 | cd .. |
52 | |
53 | rm -fr DIR |
54 | mkdir DIR |
55 | $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR & |
56 | proxy_server_pid=$! |
57 | proxy_server_port=8080 |
58 | |
59 | sleep $delay |
60 | |
61 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/index.html | diff recursive/index.html - |
62 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/style.css | diff recursive/style.css - |
63 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/unix.txt | diff recursive/unix.txt - |
64 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/windows.txt | diff recursive/windows.txt - |
65 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/image.png | diff recursive/image.png - |
66 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/x | diff recursive/x - |
67 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/1.html | diff recursive/1/1.html - |
68 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/1.css | diff recursive/1/1.css - |
69 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/2/2.html | diff recursive/1/2/2.html - |
70 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/2/2.css | diff recursive/1/2/2.css - |
71 | |
72 | # test query string |
73 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/index.html?foo | diff recursive/index.html - |
74 | |
75 | # test POST |
76 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' --post-file=recursive/index.html http://127.0.0.1:8000/ | diff recursive/index.html - |
77 | |
78 | # test javascript |
79 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/script.js > OUT |
80 | cat ../report.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT |
81 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/1.js > OUT |
82 | cat ../report.js recursive.expected/1/1.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT |
83 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/2/2.js > OUT |
84 | cat ../report.js recursive.expected/1/2/2.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT |
85 | |
86 | ## test jscoverage |
87 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.html | diff ../jscoverage.html - |
88 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.css | diff ../jscoverage.css - |
89 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage-throbber.gif | diff ../jscoverage-throbber.gif - |
90 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.js > OUT |
91 | echo -e 'jscoverage_isServer = true;\r' | cat ../jscoverage.js - | diff - OUT |
92 | |
93 | # load/store |
94 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' --post-data='{}' http://siliconforks.com/jscoverage-store > /dev/null |
95 | echo -n '{}' | diff - DIR/jscoverage.json |
96 | diff ../jscoverage.html DIR/jscoverage.html |
97 | diff ../jscoverage.css DIR/jscoverage.css |
98 | diff ../jscoverage-throbber.gif DIR/jscoverage-throbber.gif |
99 | echo -e 'jscoverage_isReport = true;\r' | cat ../jscoverage.js - | diff - DIR/jscoverage.js |
100 | |
101 | ## send it an FTP request |
102 | #echo 400 > EXPECTED |
103 | #! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 ftp://ftp.example.com 2> /dev/null > ACTUAL |
104 | #diff EXPECTED ACTUAL |
105 | # |
106 | ## nonexistent domain |
107 | #echo 500 > EXPECTED |
108 | #! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://nonexistent 2> /dev/null > ACTUAL |
109 | #diff EXPECTED ACTUAL |
110 | |
111 | # 404 not found |
112 | echo 404 > EXPECTED |
113 | ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/missing 2> /dev/null > ACTUAL |
114 | diff EXPECTED ACTUAL |
115 | echo 404 > EXPECTED |
116 | ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://siliconforks.com/jscoverage-missing 2> /dev/null > ACTUAL |
117 | diff EXPECTED ACTUAL |
118 | |
119 | ## send it a server request |
120 | #echo 400 > EXPECTED |
121 | #! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/ 2> /dev/null > ACTUAL |
122 | #diff EXPECTED ACTUAL |
123 | |
124 | # kill $proxy_server_pid |
125 | shutdown |
126 | |
127 | $VALGRIND jscoverage-server --no-highlight --port=8081 --proxy --report-dir=DIR --no-instrument=http://127.0.0.1:8000/1/ & |
128 | proxy_server_pid=$! |
129 | proxy_server_port=8081 |
130 | |
131 | sleep $delay |
132 | |
133 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/script.js > OUT |
134 | cat ../report.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT |
135 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/1/1.js | diff recursive/1/1.js - |
136 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/1/2/2.js | diff recursive/1/2/2.js - |
Name | Value |
---|---|
svn:executable | * |
ViewVC Help | |
Powered by ViewVC 1.1.24 |