Parent Directory
|
Revision Log
Fix Bashism.
1 | siliconforks | 114 | #!/bin/sh |
2 | # proxy.sh - test jscoverage-server --proxy | ||
3 | siliconforks | 427 | # Copyright (C) 2008, 2009 siliconforks.com |
4 | siliconforks | 114 | # |
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 | siliconforks | 130 | shutdown() { |
22 | siliconforks | 114 | 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 | siliconforks | 130 | shutdown_perl() { |
27 | siliconforks | 126 | wget -q -O- --post-data= http://127.0.0.1:8000/perl-shutdown > /dev/null |
28 | wait $origin_server_pid | ||
29 | } | ||
30 | |||
31 | siliconforks | 130 | cleanup() { |
32 | siliconforks | 114 | rm -fr EXPECTED ACTUAL DIR OUT |
33 | shutdown | ||
34 | siliconforks | 126 | shutdown_perl |
35 | siliconforks | 114 | } |
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 | siliconforks | 126 | perl ../server.pl > /dev/null 2> /dev/null & |
50 | origin_server_pid=$! | ||
51 | siliconforks | 114 | cd .. |
52 | |||
53 | rm -fr DIR | ||
54 | mkdir DIR | ||
55 | siliconforks | 181 | $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR & |
56 | siliconforks | 114 | 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 | siliconforks | 218 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/x | diff recursive/x - |
67 | siliconforks | 114 | 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 | siliconforks | 250 | # test localhost |
73 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://localhost:8000/index.html | diff recursive/index.html - | ||
74 | |||
75 | # test actual hostname | ||
76 | h=`hostname` | ||
77 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://${h}:8000/index.html | diff recursive/index.html - | ||
78 | |||
79 | siliconforks | 114 | # test query string |
80 | 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 - | ||
81 | |||
82 | # test POST | ||
83 | 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 - | ||
84 | |||
85 | # test javascript | ||
86 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/script.js > OUT | ||
87 | siliconforks | 295 | cat ../report.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT |
88 | siliconforks | 114 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/1.js > OUT |
89 | siliconforks | 295 | cat ../report.js recursive.expected/1/1.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT |
90 | siliconforks | 114 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/2/2.js > OUT |
91 | siliconforks | 295 | cat ../report.js recursive.expected/1/2/2.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT |
92 | siliconforks | 114 | |
93 | ## test jscoverage | ||
94 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.html | diff ../jscoverage.html - | ||
95 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.css | diff ../jscoverage.css - | ||
96 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage-throbber.gif | diff ../jscoverage-throbber.gif - | ||
97 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.js > OUT | ||
98 | siliconforks | 442 | echo 'jscoverage_isServer = true;' | cat ../jscoverage.js - | diff --strip-trailing-cr - OUT |
99 | siliconforks | 114 | |
100 | # load/store | ||
101 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' --post-data='{}' http://siliconforks.com/jscoverage-store > /dev/null | ||
102 | echo -n '{}' | diff - DIR/jscoverage.json | ||
103 | diff ../jscoverage.html DIR/jscoverage.html | ||
104 | diff ../jscoverage.css DIR/jscoverage.css | ||
105 | diff ../jscoverage-throbber.gif DIR/jscoverage-throbber.gif | ||
106 | siliconforks | 442 | echo 'jscoverage_isReport = true;' | cat ../jscoverage.js - | diff --strip-trailing-cr - DIR/jscoverage.js |
107 | siliconforks | 114 | |
108 | siliconforks | 250 | # send it an FTP request |
109 | echo 400 > EXPECTED | ||
110 | ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 ftp://ftp.example.com 2> /dev/null > ACTUAL | ||
111 | diff EXPECTED ACTUAL | ||
112 | siliconforks | 114 | |
113 | siliconforks | 250 | # nonexistent domain |
114 | echo 504 > EXPECTED | ||
115 | ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://nonexistent 2> /dev/null > ACTUAL | ||
116 | diff EXPECTED ACTUAL | ||
117 | |||
118 | siliconforks | 114 | # 404 not found |
119 | echo 404 > EXPECTED | ||
120 | ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/missing 2> /dev/null > ACTUAL | ||
121 | diff EXPECTED ACTUAL | ||
122 | echo 404 > EXPECTED | ||
123 | ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://siliconforks.com/jscoverage-missing 2> /dev/null > ACTUAL | ||
124 | diff EXPECTED ACTUAL | ||
125 | |||
126 | ## send it a server request | ||
127 | #echo 400 > EXPECTED | ||
128 | #! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/ 2> /dev/null > ACTUAL | ||
129 | #diff EXPECTED ACTUAL | ||
130 | |||
131 | # kill $proxy_server_pid | ||
132 | shutdown | ||
133 | |||
134 | siliconforks | 181 | $VALGRIND jscoverage-server --no-highlight --port=8081 --proxy --report-dir=DIR --no-instrument=http://127.0.0.1:8000/1/ & |
135 | siliconforks | 114 | proxy_server_pid=$! |
136 | proxy_server_port=8081 | ||
137 | |||
138 | sleep $delay | ||
139 | |||
140 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/script.js > OUT | ||
141 | siliconforks | 295 | cat ../report.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT |
142 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/1/1.js | diff --strip-trailing-cr recursive/1/1.js - | ||
143 | wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/1/2/2.js | diff --strip-trailing-cr recursive/1/2/2.js - |
Name | Value |
---|---|
svn:executable | * |
ViewVC Help | |
Powered by ViewVC 1.1.24 |