/[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 114 by siliconforks, Sat May 31 21:39:39 2008 UTC revision 250 by siliconforks, Sun Oct 5 18:07:32 2008 UTC
# Line 18  Line 18 
18    
19  set -e  set -e
20    
21  function shutdown() {  shutdown() {
22    wget -q -O- --post-data= "http://127.0.0.1:${proxy_server_port}/jscoverage-shutdown" > /dev/null    wget -q -O- --post-data= "http://127.0.0.1:${proxy_server_port}/jscoverage-shutdown" > /dev/null
23    wait $proxy_server_pid    wait $proxy_server_pid
24  }  }
25    
26  function cleanup() {  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    rm -fr EXPECTED ACTUAL DIR OUT
   kill $python_server_pid  
   # kill $proxy_server_pid  
33    shutdown    shutdown
34      shutdown_perl
35  }  }
36    
37  trap 'cleanup' 0 1 2 3 15  trap 'cleanup' 0 1 2 3 15
# Line 42  Line 46 
46  fi  fi
47    
48  cd recursive  cd recursive
49  python ../POSTServer.py > /dev/null 2> /dev/null &  perl ../server.pl > /dev/null 2> /dev/null &
50  python_server_pid=$!  origin_server_pid=$!
51  cd ..  cd ..
52    
53  rm -fr DIR  rm -fr DIR
54  mkdir DIR  mkdir DIR
55  $VALGRIND jscoverage-server --proxy --report-dir=DIR > OUT 2> ERR &  $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &
56  proxy_server_pid=$!  proxy_server_pid=$!
57  proxy_server_port=8080  proxy_server_port=8080
58    
# Line 59  Line 63 
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 -  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 -  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 -  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 -  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 -  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 -  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 -  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 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  # test query string  # 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 -  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    
# Line 72  Line 84 
84    
85  # test javascript  # test javascript
86  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:8080/' http://127.0.0.1:8000/script.js > OUT
87  cat recursive.expected/script.js ../report.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT  cat ../report.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT
88  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:8080/' http://127.0.0.1:8000/1/1.js > OUT
89  cat recursive.expected/1/1.js ../report.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT  cat ../report.js recursive.expected/1/1.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT
90  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:8080/' http://127.0.0.1:8000/1/2/2.js > OUT
91  cat recursive.expected/1/2/2.js ../report.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT  cat ../report.js recursive.expected/1/2/2.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT
92    
93  ## test jscoverage  ## test jscoverage
94  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:8080/' http://siliconforks.com/jscoverage.html | diff ../jscoverage.html -
# Line 91  Line 103 
103  diff ../jscoverage.html DIR/jscoverage.html  diff ../jscoverage.html DIR/jscoverage.html
104  diff ../jscoverage.css DIR/jscoverage.css  diff ../jscoverage.css DIR/jscoverage.css
105  diff ../jscoverage-throbber.gif DIR/jscoverage-throbber.gif  diff ../jscoverage-throbber.gif DIR/jscoverage-throbber.gif
 diff ../jscoverage-sh_main.js DIR/jscoverage-sh_main.js  
 diff ../jscoverage-sh_javascript.js DIR/jscoverage-sh_javascript.js  
 diff ../jscoverage-sh_nedit.css DIR/jscoverage-sh_nedit.css  
106  echo -e 'jscoverage_isReport = true;\r' | cat ../jscoverage.js - | diff - DIR/jscoverage.js  echo -e 'jscoverage_isReport = true;\r' | cat ../jscoverage.js - | diff - DIR/jscoverage.js
107    
108  ## send it an FTP request  # send it an FTP request
109  #echo 400 > EXPECTED  echo 400 > EXPECTED
110  #! 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:8080 ftp://ftp.example.com 2> /dev/null > ACTUAL
111  #diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
112  #  
113  ## nonexistent domain  # nonexistent domain
114  #echo 500 > EXPECTED  echo 504 > EXPECTED
115  #! 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:8080 http://nonexistent 2> /dev/null > ACTUAL
116  #diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
117    
118  # 404 not found  # 404 not found
119  echo 404 > EXPECTED  echo 404 > EXPECTED
# Line 122  Line 131 
131  # kill $proxy_server_pid  # kill $proxy_server_pid
132  shutdown  shutdown
133    
134  $VALGRIND jscoverage-server --port=8081 --proxy --report-dir=DIR --no-instrument=http://127.0.0.1:8000/1/ &  $VALGRIND jscoverage-server --no-highlight --port=8081 --proxy --report-dir=DIR --no-instrument=http://127.0.0.1:8000/1/ &
135  proxy_server_pid=$!  proxy_server_pid=$!
136  proxy_server_port=8081  proxy_server_port=8081
137    
138  sleep $delay  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  wget -q -O- -e 'http_proxy=http://127.0.0.1:8081/' http://127.0.0.1:8000/script.js > OUT
141  cat recursive.expected/script.js ../report.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT  cat ../report.js recursive.expected/script.js | sed 's/@PREFIX@/http:\/\/127.0.0.1:8000\//g' | diff - OUT
142  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 -  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 -
143  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 -  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 -

Legend:
Removed from v.114  
changed lines
  Added in v.250

  ViewVC Help
Powered by ViewVC 1.1.24