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

Diff of /trunk/tests/server.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 42  Line 42 
42    
43  rm -fr EXPECTED ACTUAL DIR OUT  rm -fr EXPECTED ACTUAL DIR OUT
44  mkdir DIR  mkdir DIR
45  $VALGRIND jscoverage-server --no-highlight --document-root=recursive --report-dir=DIR &  server_port=`perl unused-port.pl`
46    $VALGRIND jscoverage-server --port=$server_port --no-highlight --document-root=recursive --report-dir=DIR &
47  server_pid=$!  server_pid=$!
 server_port=8080  
48    
49  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
50    
51  wget -q -O- http://127.0.0.1:8080/index.html | diff recursive/index.html -  wget -q -O- http://127.0.0.1:${server_port}/index.html | diff recursive/index.html -
52  wget -q -O- http://127.0.0.1:8080/style.css | diff recursive/style.css -  wget -q -O- http://127.0.0.1:${server_port}/style.css | diff recursive/style.css -
53  wget -q -O- http://127.0.0.1:8080/unix.txt | diff recursive/unix.txt -  wget -q -O- http://127.0.0.1:${server_port}/unix.txt | diff recursive/unix.txt -
54  wget -q -O- http://127.0.0.1:8080/windows.txt | diff recursive/windows.txt -  wget -q -O- http://127.0.0.1:${server_port}/windows.txt | diff recursive/windows.txt -
55  wget -q -O- http://127.0.0.1:8080/image.png | diff recursive/image.png -  wget -q -O- http://127.0.0.1:${server_port}/image.png | diff recursive/image.png -
56  wget -q -O- http://127.0.0.1:8080/x | diff recursive/x -  wget -q -O- http://127.0.0.1:${server_port}/x | diff recursive/x -
57  wget -q -O- http://127.0.0.1:8080/1/1.html | diff recursive/1/1.html -  wget -q -O- http://127.0.0.1:${server_port}/1/1.html | diff recursive/1/1.html -
58  wget -q -O- http://127.0.0.1:8080/1/1.css | diff recursive/1/1.css -  wget -q -O- http://127.0.0.1:${server_port}/1/1.css | diff recursive/1/1.css -
59  wget -q -O- http://127.0.0.1:8080/1/2/2.html | diff recursive/1/2/2.html -  wget -q -O- http://127.0.0.1:${server_port}/1/2/2.html | diff recursive/1/2/2.html -
60  wget -q -O- http://127.0.0.1:8080/1/2/2.css | diff recursive/1/2/2.css -  wget -q -O- http://127.0.0.1:${server_port}/1/2/2.css | diff recursive/1/2/2.css -
61    
62  # test query string  # test query string
63  wget -q -O- http://127.0.0.1:8080/index.html?foo | diff recursive/index.html -  wget -q -O- http://127.0.0.1:${server_port}/index.html?foo | diff recursive/index.html -
64    
65  # test javascript  # test javascript
66  wget -q -O- http://127.0.0.1:8080/script.js > OUT  wget -q -O- http://127.0.0.1:${server_port}/script.js > OUT
67  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT
68  wget -q -O- http://127.0.0.1:8080/1/1.js > OUT  wget -q -O- http://127.0.0.1:${server_port}/1/1.js > OUT
69  cat ../report.js ../header.txt ../header.js recursive.expected/1/1.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/1/1.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT
70  wget -q -O- http://127.0.0.1:8080/1/2/2.js > OUT  wget -q -O- http://127.0.0.1:${server_port}/1/2/2.js > OUT
71  cat ../report.js ../header.txt ../header.js recursive.expected/1/2/2.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/1/2/2.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT
72    
73  # test jscoverage  # test jscoverage
74  wget -q -O- http://127.0.0.1:8080/jscoverage.html | diff ../jscoverage.html -  wget -q -O- http://127.0.0.1:${server_port}/jscoverage.html | diff ../jscoverage.html -
75  wget -q -O- http://127.0.0.1:8080/jscoverage.css | diff ../jscoverage.css -  wget -q -O- http://127.0.0.1:${server_port}/jscoverage.css | diff ../jscoverage.css -
76  wget -q -O- http://127.0.0.1:8080/jscoverage-throbber.gif | diff ../jscoverage-throbber.gif -  wget -q -O- http://127.0.0.1:${server_port}/jscoverage-throbber.gif | diff ../jscoverage-throbber.gif -
77  wget -q -O- http://127.0.0.1:8080/jscoverage.js > OUT  wget -q -O- http://127.0.0.1:${server_port}/jscoverage.js > OUT
78  echo 'jscoverage_isServer = true;' | cat ../jscoverage.js - | diff --strip-trailing-cr - OUT  echo 'jscoverage_isServer = true;' | cat ../jscoverage.js - | diff --strip-trailing-cr - OUT
79    
80  # load/store  # load/store
81  wget --post-data='{}' -q -O- http://127.0.0.1:8080/jscoverage-store > /dev/null  wget --post-data='{}' -q -O- http://127.0.0.1:${server_port}/jscoverage-store > /dev/null
82  echo -n '{}' | diff - DIR/jscoverage.json  echo -n '{}' | diff - DIR/jscoverage.json
83  diff ../jscoverage.html DIR/jscoverage.html  diff ../jscoverage.html DIR/jscoverage.html
84  diff ../jscoverage.css DIR/jscoverage.css  diff ../jscoverage.css DIR/jscoverage.css
# Line 87  Line 87 
87    
88  # 404 not found  # 404 not found
89  echo 404 > EXPECTED  echo 404 > EXPECTED
90  ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/missing 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/missing 2> /dev/null > ACTUAL
91  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
92  echo 404 > EXPECTED  echo 404 > EXPECTED
93  ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/jscoverage-missing 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/jscoverage-missing 2> /dev/null > ACTUAL
94  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
95    
96  # 403 forbidden  # 403 forbidden
97  echo 403 > EXPECTED  echo 403 > EXPECTED
98  ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/../Makefile.am 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/../Makefile.am 2> /dev/null > ACTUAL
99  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
100    
101  ## send it a proxy request  ## send it a proxy request
102  #echo 400 > EXPECTED  #echo 400 > EXPECTED
103  #! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://siliconforks.com/ 2> /dev/null > ACTUAL  #! curl -f -w '%{http_code}\n' -x 127.0.0.1:${server_port} http://siliconforks.com/ 2> /dev/null > ACTUAL
104  #diff EXPECTED ACTUAL  #diff EXPECTED ACTUAL
105    
106  # kill $server_pid  # kill $server_pid
# Line 110  Line 110 
110  mkdir DIR  mkdir DIR
111  case `uname` in  case `uname` in
112    MINGW*)    MINGW*)
113      $VALGRIND jscoverage-server --no-highlight --port=8081 --document-root=recursive --report-dir=DIR --no-instrument=1/ &      $VALGRIND jscoverage-server --no-highlight --port=${server_port} --document-root=recursive --report-dir=DIR --no-instrument=1/ &
114      ;;      ;;
115    *)    *)
116      $VALGRIND jscoverage-server --no-highlight --port=8081 --document-root=recursive --report-dir=DIR --no-instrument=/1/ &      $VALGRIND jscoverage-server --no-highlight --port=${server_port} --document-root=recursive --report-dir=DIR --no-instrument=/1/ &
117      ;;      ;;
118  esac  esac
119  server_pid=$!  server_pid=$!
 server_port=8081  
120    
121  wait_for_server http://127.0.0.1:8081/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
122    
123  wget -q -O- http://127.0.0.1:8081/script.js > OUT  wget -q -O- http://127.0.0.1:${server_port}/script.js > OUT
124  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT
125  wget -q -O- http://127.0.0.1:8081/1/1.js | diff --strip-trailing-cr recursive/1/1.js -  wget -q -O- http://127.0.0.1:${server_port}/1/1.js | diff --strip-trailing-cr recursive/1/1.js -
126  wget -q -O- http://127.0.0.1:8081/1/2/2.js | diff --strip-trailing-cr recursive/1/2/2.js -  wget -q -O- http://127.0.0.1:${server_port}/1/2/2.js | diff --strip-trailing-cr recursive/1/2/2.js -
127    
128  # kill $server_pid  # kill $server_pid
129  shutdown  shutdown
130    
131  $VALGRIND jscoverage-server --no-highlight --port 8082 --document-root recursive --report-dir DIR --no-instrument 1/ &  $VALGRIND jscoverage-server --no-highlight --port ${server_port} --document-root recursive --report-dir DIR --no-instrument 1/ &
132  server_pid=$!  server_pid=$!
 server_port=8082  
133    
134  wait_for_server http://127.0.0.1:8082/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
135    
136  wget -q -O- http://127.0.0.1:8082/script.js > OUT  wget -q -O- http://127.0.0.1:${server_port}/script.js > OUT
137  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT  cat ../report.js ../header.txt ../header.js recursive.expected/script.js | sed 's/@PREFIX@/\//g' | diff --strip-trailing-cr - OUT
138  wget -q -O- http://127.0.0.1:8082/1/1.js | diff --strip-trailing-cr recursive/1/1.js -  wget -q -O- http://127.0.0.1:${server_port}/1/1.js | diff --strip-trailing-cr recursive/1/1.js -
139  wget -q -O- http://127.0.0.1:8082/1/2/2.js | diff --strip-trailing-cr recursive/1/2/2.js -  wget -q -O- http://127.0.0.1:${server_port}/1/2/2.js | diff --strip-trailing-cr recursive/1/2/2.js -
140    
141  # kill $server_pid  # kill $server_pid
142  shutdown  shutdown
143    
144  $VALGRIND jscoverage-server --port 8080 --encoding iso-8859-1 --document-root javascript &  $VALGRIND jscoverage-server --port ${server_port} --encoding iso-8859-1 --document-root javascript &
145  server_pid=$!  server_pid=$!
 server_port=8080  
146    
147  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
148    
149  case "$character_encoding_support" in  case "$character_encoding_support" in
150    yes)    yes)
151      rm -fr EXPECTED      rm -fr EXPECTED
152      wget -q -O- http://127.0.0.1:8080/javascript-iso-8859-1.js > OUT      wget -q -O- http://127.0.0.1:${server_port}/javascript-iso-8859-1.js > OUT
153      add_header_to_files javascript.expected      add_header_to_files javascript.expected
154      cat ../report.js EXPECTED/javascript-iso-8859-1.js | sed 's/javascript-iso-8859-1.js/\/javascript-iso-8859-1.js/g' | diff --strip-trailing-cr - OUT      cat ../report.js EXPECTED/javascript-iso-8859-1.js | sed 's/javascript-iso-8859-1.js/\/javascript-iso-8859-1.js/g' | diff --strip-trailing-cr - OUT
155      rm -fr EXPECTED      rm -fr EXPECTED
156      ;;      ;;
157    *)    *)
158      echo 500 > EXPECTED      echo 500 > EXPECTED
159      ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/javascript-iso-8859-1.js 2> /dev/null > ACTUAL      ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/javascript-iso-8859-1.js 2> /dev/null > ACTUAL
160      diff EXPECTED ACTUAL      diff EXPECTED ACTUAL
161      ;;      ;;
162  esac  esac
# Line 167  Line 164 
164  # kill $server_pid  # kill $server_pid
165  shutdown  shutdown
166    
167  $VALGRIND jscoverage-server --no-highlight --port=8080 --encoding=utf-8 --document-root=javascript-utf-8 &  $VALGRIND jscoverage-server --no-highlight --port=${server_port} --encoding=utf-8 --document-root=javascript-utf-8 &
168  server_pid=$!  server_pid=$!
 server_port=8080  
169    
170  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
171    
172  case "$character_encoding_support" in  case "$character_encoding_support" in
173    yes)    yes)
174      rm -fr EXPECTED      rm -fr EXPECTED
175      wget -q -O- http://127.0.0.1:8080/javascript-utf-8.js > OUT      wget -q -O- http://127.0.0.1:${server_port}/javascript-utf-8.js > OUT
176      add_header_to_files javascript-utf-8.expected      add_header_to_files javascript-utf-8.expected
177      cat ../report.js EXPECTED/javascript-utf-8.js | sed 's/javascript-utf-8.js/\/javascript-utf-8.js/g' | diff --strip-trailing-cr - OUT      cat ../report.js EXPECTED/javascript-utf-8.js | sed 's/javascript-utf-8.js/\/javascript-utf-8.js/g' | diff --strip-trailing-cr - OUT
178      rm -fr EXPECTED      rm -fr EXPECTED
179      ;;      ;;
180    *)    *)
181      echo 500 > EXPECTED      echo 500 > EXPECTED
182      ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/javascript-utf-8.js 2> /dev/null > ACTUAL      ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/javascript-utf-8.js 2> /dev/null > ACTUAL
183      diff EXPECTED ACTUAL      diff EXPECTED ACTUAL
184      ;;      ;;
185  esac  esac
# Line 191  Line 187 
187  # kill $server_pid  # kill $server_pid
188  shutdown  shutdown
189    
190  $VALGRIND jscoverage-server --port 8080 --encoding BOGUS --document-root javascript &  $VALGRIND jscoverage-server --port ${server_port} --encoding BOGUS --document-root javascript &
191  server_pid=$!  server_pid=$!
 server_port=8080  
192    
193  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
194    
195  echo 500 > EXPECTED  echo 500 > EXPECTED
196  ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/javascript-iso-8859-1.js 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/javascript-iso-8859-1.js 2> /dev/null > ACTUAL
197  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
198    
199  # kill $server_pid  # kill $server_pid
200  shutdown  shutdown
201    
202  $VALGRIND jscoverage-server --port 8080 --encoding utf-8 --document-root javascript &  $VALGRIND jscoverage-server --port ${server_port} --encoding utf-8 --document-root javascript &
203  server_pid=$!  server_pid=$!
 server_port=8080  
204    
205  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
206    
207  echo 500 > EXPECTED  echo 500 > EXPECTED
208  ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/javascript-iso-8859-1.js 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/javascript-iso-8859-1.js 2> /dev/null > ACTUAL
209  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL

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

  ViewVC Help
Powered by ViewVC 1.1.24