/[jscoverage]/trunk/tests/proxy.sh
ViewVC logotype

Diff of /trunk/tests/proxy.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 609 by siliconforks, Mon May 24 03:13:28 2010 UTC revision 610 by siliconforks, Fri Sep 24 20:35:36 2010 UTC
# Line 24  Line 24 
24  }  }
25    
26  shutdown_perl() {  shutdown_perl() {
27    wget -q -O- --post-data= http://127.0.0.1:8000/perl-shutdown > /dev/null    wget -q -O- --post-data= http://127.0.0.1:${origin_server_port}/perl-shutdown > /dev/null
28    wait $origin_server_pid    wait $origin_server_pid
29  }  }
30    
# Line 39  Line 39 
39  . ./common.sh  . ./common.sh
40    
41  cd recursive  cd recursive
42  perl ../server.pl > /dev/null 2> /dev/null &  origin_server_port=`perl ../unused-port.pl`
43    perl ../server.pl $origin_server_port > /dev/null 2> /dev/null &
44  origin_server_pid=$!  origin_server_pid=$!
45  cd ..  cd ..
46    
47  rm -fr DIR  rm -fr DIR
48  mkdir DIR  mkdir DIR
49  $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &  proxy_server_port=`perl unused-port.pl`
50    $VALGRIND jscoverage-server --port=$proxy_server_port --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &
51  proxy_server_pid=$!  proxy_server_pid=$!
 proxy_server_port=8080  
52    
53  wait_for_server http://127.0.0.1:8000/index.html  wait_for_server http://127.0.0.1:${origin_server_port}/index.html
54  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${proxy_server_port}/jscoverage.html
55    
56  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/index.html | diff recursive/index.html -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/index.html | diff recursive/index.html -
57  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/style.css | diff recursive/style.css -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/style.css | diff recursive/style.css -
58  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/unix.txt | diff recursive/unix.txt -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/unix.txt | diff recursive/unix.txt -
59  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/windows.txt | diff recursive/windows.txt -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/windows.txt | diff recursive/windows.txt -
60  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/image.png | diff recursive/image.png -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/image.png | diff recursive/image.png -
61  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/x | diff recursive/x -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/x | diff recursive/x -
62  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/1.html | diff recursive/1/1.html -
63  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/1.css | diff recursive/1/1.css -
64  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/2/2.html | diff recursive/1/2/2.html -
65  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/2/2.css | diff recursive/1/2/2.css -
66    
67  # test localhost  # test localhost
68  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://localhost:8000/index.html | diff recursive/index.html -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://localhost:${origin_server_port}/index.html | diff recursive/index.html -
69    
70  # test actual hostname  # test actual hostname
71  h=`hostname`  h=`hostname`
72  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://${h}:8000/index.html | diff recursive/index.html -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://${h}:${origin_server_port}/index.html | diff recursive/index.html -
73    
74  # test query string  # test query string
75  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/index.html?foo | diff recursive/index.html -
76    
77  # test POST  # test POST
78  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" --post-file=recursive/index.html http://127.0.0.1:${origin_server_port}/ | diff recursive/index.html -
79    
80  # test javascript  # test javascript
81  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/script.js > OUT  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/script.js > OUT
82  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed "s/@PREFIX@/http:\/\/127.0.0.1:${origin_server_port}\//g" | diff --strip-trailing-cr - OUT
83  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/1.js > OUT  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/1.js > OUT
84  cat ../report.js ../header.txt ../header.js recursive.expected/1/1.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/1/1.js | sed "s/@PREFIX@/http:\/\/127.0.0.1:${origin_server_port}\//g" | diff --strip-trailing-cr - OUT
85  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/1/2/2.js > OUT  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/2/2.js > OUT
86  cat ../report.js ../header.txt ../header.js recursive.expected/1/2/2.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/1/2/2.js | sed "s/@PREFIX@/http:\/\/127.0.0.1:${origin_server_port}\//g" | diff --strip-trailing-cr - OUT
87    
88  ## test jscoverage  ## test jscoverage
89  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.html | diff ../jscoverage.html -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://siliconforks.com/jscoverage.html | diff ../jscoverage.html -
90  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.css | diff ../jscoverage.css -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://siliconforks.com/jscoverage.css | diff ../jscoverage.css -
91  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage-throbber.gif | diff ../jscoverage-throbber.gif -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://siliconforks.com/jscoverage-throbber.gif | diff ../jscoverage-throbber.gif -
92  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://siliconforks.com/jscoverage.js > OUT  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://siliconforks.com/jscoverage.js > OUT
93  echo 'jscoverage_isServer = true;' | cat ../jscoverage.js - | diff --strip-trailing-cr - OUT  echo 'jscoverage_isServer = true;' | cat ../jscoverage.js - | diff --strip-trailing-cr - OUT
94    
95  # load/store  # load/store
96  wget -q -O- -e 'http_proxy=http://127.0.0.1:8080/' --post-data='{}' http://siliconforks.com/jscoverage-store > /dev/null  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" --post-data='{}' http://siliconforks.com/jscoverage-store > /dev/null
97  echo -n '{}' | diff - DIR/jscoverage.json  echo -n '{}' | diff - DIR/jscoverage.json
98  diff ../jscoverage.html DIR/jscoverage.html  diff ../jscoverage.html DIR/jscoverage.html
99  diff ../jscoverage.css DIR/jscoverage.css  diff ../jscoverage.css DIR/jscoverage.css
# Line 101  Line 102 
102    
103  # send it an FTP request  # send it an FTP request
104  echo 400 > EXPECTED  echo 400 > EXPECTED
105  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 ftp://ftp.example.com 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:${proxy_server_port} ftp://ftp.example.com 2> /dev/null > ACTUAL
106  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
107    
108  # nonexistent domain  # nonexistent domain
109  echo 504 > EXPECTED  echo 504 > EXPECTED
110  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://nonexistent 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:${proxy_server_port} http://nonexistent 2> /dev/null > ACTUAL
111  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
112    
113  # 404 not found  # 404 not found
114  echo 404 > EXPECTED  echo 404 > EXPECTED
115  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/missing 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:${proxy_server_port} http://127.0.0.1:${origin_server_port}/missing 2> /dev/null > ACTUAL
116  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
117  echo 404 > EXPECTED  echo 404 > EXPECTED
118  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://siliconforks.com/jscoverage-missing 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:${proxy_server_port} http://siliconforks.com/jscoverage-missing 2> /dev/null > ACTUAL
119  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
120    
121  ## send it a server request  ## send it a server request
122  #echo 400 > EXPECTED  #echo 400 > EXPECTED
123  #! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/ 2> /dev/null > ACTUAL  #! curl -f -w '%{http_code}\n' http://127.0.0.1:${proxy_server_port}/ 2> /dev/null > ACTUAL
124  #diff EXPECTED ACTUAL  #diff EXPECTED ACTUAL
125    
126  # kill $proxy_server_pid  # kill $proxy_server_pid
127  shutdown  shutdown
128    
129  $VALGRIND jscoverage-server --no-highlight --port=8081 --proxy --report-dir=DIR --no-instrument=http://127.0.0.1:8000/1/ &  proxy_server_port=`perl unused-port.pl`
130    $VALGRIND jscoverage-server --no-highlight --port=$proxy_server_port --proxy --report-dir=DIR --no-instrument=http://127.0.0.1:${origin_server_port}/1/ &
131  proxy_server_pid=$!  proxy_server_pid=$!
 proxy_server_port=8081  
132    
133  wait_for_server http://127.0.0.1:8081/jscoverage.html  wait_for_server http://127.0.0.1:${proxy_server_port}/jscoverage.html
134    
135  wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/script.js > OUT  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/script.js > OUT
136  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed "s/@PREFIX@/http:\/\/127.0.0.1:${origin_server_port}\//g" | diff --strip-trailing-cr - OUT
137  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/1.js | diff --strip-trailing-cr recursive/1/1.js -
138  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 -  wget -q -O- -e "http_proxy=http://127.0.0.1:${proxy_server_port}/" http://127.0.0.1:${origin_server_port}/1/2/2.js | diff --strip-trailing-cr recursive/1/2/2.js -

Legend:
Removed from v.609  
changed lines
  Added in v.610

  ViewVC Help
Powered by ViewVC 1.1.24