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

Diff of /trunk/tests/charset.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 39  Line 39 
39    character_encoding_support=no    character_encoding_support=no
40  fi  fi
41    
42  $VALGRIND jscoverage-server --proxy --no-highlight > OUT 2> ERR &  proxy_server_port=`perl unused-port.pl`
43    $VALGRIND jscoverage-server --port=$proxy_server_port --proxy --no-highlight > OUT 2> ERR &
44  proxy_server_pid=$!  proxy_server_pid=$!
 proxy_server_port=8080  
45    
46  ./http-server-charset &  origin_server_port=`perl unused-port.pl`
47    ./http-server-charset $origin_server_port &
48  origin_server_pid=$!  origin_server_pid=$!
49    
50  wait_for_server http://127.0.0.1:8000/utf-8.js  wait_for_server http://127.0.0.1:${origin_server_port}/utf-8.js
51  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${proxy_server_port}/jscoverage.html
52    
53  case "$character_encoding_support" in  case "$character_encoding_support" in
54    yes)    yes)
55      rm -fr TMP      rm -fr TMP
56      cat javascript-utf-8.expected/javascript-utf-8.js | sed 's/javascript-utf-8.js/http:\/\/127.0.0.1:8000\/utf-8.js/g' > TMP      cat javascript-utf-8.expected/javascript-utf-8.js | sed "s/javascript-utf-8.js/http:\/\/127.0.0.1:${origin_server_port}\/utf-8.js/g" > TMP
57      add_header_to_file TMP EXPECTED      add_header_to_file TMP EXPECTED
58      cat ../report.js EXPECTED > TMP      cat ../report.js EXPECTED > TMP
59      mv TMP EXPECTED      mv TMP EXPECTED
60      curl -s -x 127.0.0.1:8080 http://127.0.0.1:8000/utf-8.js > ACTUAL      curl -s -x 127.0.0.1:${proxy_server_port} http://127.0.0.1:${origin_server_port}/utf-8.js > ACTUAL
61      diff EXPECTED ACTUAL      diff EXPECTED ACTUAL
62      ;;      ;;
63    *)    *)
64      echo 500 > EXPECTED      echo 500 > EXPECTED
65      ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/utf-8.js 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}/utf-8.js 2> /dev/null > ACTUAL
66      diff EXPECTED ACTUAL      diff EXPECTED ACTUAL
67      ;;      ;;
68  esac  esac
69    
70  shutdown  shutdown
71    
72  $VALGRIND jscoverage-server --proxy > OUT 2> ERR &  proxy_server_port=`perl unused-port.pl`
73    $VALGRIND jscoverage-server --port=$proxy_server_port --proxy > OUT 2> ERR &
74  proxy_server_pid=$!  proxy_server_pid=$!
 proxy_server_port=8080  
75    
76  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${proxy_server_port}/jscoverage.html
77    
78  case "$character_encoding_support" in  case "$character_encoding_support" in
79    yes)    yes)
80      rm -fr TMP      rm -fr TMP
81      cat javascript.expected/javascript-iso-8859-1.js | sed 's/javascript-iso-8859-1.js/http:\/\/127.0.0.1:8000\/iso-8859-1.js/g' > TMP      cat javascript.expected/javascript-iso-8859-1.js | sed "s/javascript-iso-8859-1.js/http:\/\/127.0.0.1:${origin_server_port}\/iso-8859-1.js/g" > TMP
82      add_header_to_file TMP EXPECTED      add_header_to_file TMP EXPECTED
83      cat ../report.js EXPECTED > TMP      cat ../report.js EXPECTED > TMP
84      mv TMP EXPECTED      mv TMP EXPECTED
85      curl -s -x 127.0.0.1:8080 http://127.0.0.1:8000/iso-8859-1.js > ACTUAL      curl -s -x 127.0.0.1:${proxy_server_port} http://127.0.0.1:${origin_server_port}/iso-8859-1.js > ACTUAL
86      diff EXPECTED ACTUAL      diff EXPECTED ACTUAL
87      ;;      ;;
88    *)    *)
89      echo 500 > EXPECTED      echo 500 > EXPECTED
90      ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/iso-8859-1.js 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}/iso-8859-1.js 2> /dev/null > ACTUAL
91      diff EXPECTED ACTUAL      diff EXPECTED ACTUAL
92      ;;      ;;
93  esac  esac
94    
95  # bogus charset  # bogus charset
96  echo 500 > EXPECTED  echo 500 > EXPECTED
97  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/bogus.js 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}/bogus.js 2> /dev/null > ACTUAL
98  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
99    
100  # malformed encoding  # malformed encoding
# Line 106  Line 107 
107      ;;      ;;
108  esac  esac
109  echo $status > EXPECTED  echo $status > EXPECTED
110  ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:8000/malformed.js 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}/malformed.js 2> /dev/null > ACTUAL
111  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