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

Diff of /trunk/tests/store.sh

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

revision 609 by siliconforks, Mon May 24 03:53:52 2010 UTC revision 610 by siliconforks, Fri Sep 24 20:35:36 2010 UTC
# Line 38  Line 38 
38  trap 'cleanup' 0 1 2 3 15  trap 'cleanup' 0 1 2 3 15
39    
40  rm -fr DIR  rm -fr DIR
41  $VALGRIND jscoverage-server --no-highlight --document-root=recursive --report-dir=DIR &  server_port=`perl unused-port.pl`
42    $VALGRIND jscoverage-server --port=$server_port --no-highlight --document-root=recursive --report-dir=DIR &
43  server_pid=$!  server_pid=$!
 server_port=8080  
44    
45  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
46    
47  cat store.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.json | sed "s/@PREFIX@/\\//g" > TMP
48  wget --post-file=TMP -q -O- http://127.0.0.1:8080/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- http://127.0.0.1:${server_port}/jscoverage-store > /dev/null
49  cat store.expected.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.expected.json | sed "s/@PREFIX@/\\//g" > TMP
50  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
51    
52  cat store.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.json | sed "s/@PREFIX@/\\//g" > TMP
53  wget --post-file=TMP -q -O- http://127.0.0.1:8080/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- http://127.0.0.1:${server_port}/jscoverage-store > /dev/null
54  cat store.expected.json | sed "s/@PREFIX@/\\//g" | sed "s/,1/,2/g" > TMP  cat store.expected.json | sed "s/@PREFIX@/\\//g" | sed "s/,1/,2/g" > TMP
55  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
56    
57  # try invalid method  # try invalid method
58  echo 405 > EXPECTED  echo 405 > EXPECTED
59  ! curl -f -w '%{http_code}\n' http://127.0.0.1:8080/jscoverage-store 2> /dev/null > ACTUAL  ! curl -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/jscoverage-store 2> /dev/null > ACTUAL
60  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL
61    
62  # try with a path  # try with a path
63  cat store.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.json | sed "s/@PREFIX@/\\//g" > TMP
64  wget --post-file=TMP -q -O- http://127.0.0.1:8080/jscoverage-store/DIR > /dev/null  wget --post-file=TMP -q -O- http://127.0.0.1:${server_port}/jscoverage-store/DIR > /dev/null
65  cat store.expected.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.expected.json | sed "s/@PREFIX@/\\//g" > TMP
66  json_cmp TMP DIR/DIR/jscoverage.json  json_cmp TMP DIR/DIR/jscoverage.json
67    
68  shutdown  shutdown
69    
70  cd recursive  cd recursive
71  perl ../server.pl > /dev/null 2> /dev/null &  origin_server_port=`perl ../unused-port.pl`
72    perl ../server.pl $origin_server_port > /dev/null 2> /dev/null &
73  origin_server_pid=$!  origin_server_pid=$!
74  cd ..  cd ..
75    
76  rm -fr DIR  rm -fr DIR
77  $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &  server_port=`perl unused-port.pl`
78    $VALGRIND jscoverage-server --port=$server_port --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &
79  server_pid=$!  server_pid=$!
 server_port=8080  
80    
81  wait_for_server http://127.0.0.1:8000/index.html  wait_for_server http://127.0.0.1:${origin_server_port}/index.html
82  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
83    
84  # test with proxy  # test with proxy
85  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:8000\\//g" > TMP  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:${origin_server_port}\\//g" > TMP
86  wget --post-file=TMP -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- -e "http_proxy=http://127.0.0.1:${server_port}/" http://127.0.0.1:${origin_server_port}/jscoverage-store > /dev/null
87  cat store.expected.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:8000\\//g" > TMP  cat store.expected.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:${origin_server_port}\\//g" > TMP
88  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
89    
90  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:8000\\//g" > TMP  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:${origin_server_port}\\//g" > TMP
91  wget --post-file=TMP -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- -e "http_proxy=http://127.0.0.1:${server_port}/" http://127.0.0.1:${origin_server_port}/jscoverage-store > /dev/null
92  cat store.expected.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:8000\\//g" | sed "s/,1/,2/g" > TMP  cat store.expected.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:${origin_server_port}\\//g" | sed "s/,1/,2/g" > TMP
93  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
94    
95  # test cached source  # test cached source
96  rm -fr DIR  rm -fr DIR
97  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:8000\\//g" > TMP  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:${origin_server_port}\\//g" > TMP
98  wget --post-file=TMP -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- -e "http_proxy=http://127.0.0.1:${server_port}/" http://127.0.0.1:${origin_server_port}/jscoverage-store > /dev/null
99  cat store.expected.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:8000\\//g" > TMP  cat store.expected.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:${origin_server_port}\\//g" > TMP
100  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
101    
102  shutdown  shutdown
103    
104  rm -fr DIR  rm -fr DIR
105  $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &  server_port=`perl unused-port.pl`
106    $VALGRIND jscoverage-server --port=$server_port --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &
107  server_pid=$!  server_pid=$!
 server_port=8080  
108    
109  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
110    
111  # store JSON with bad source URLs  # store JSON with bad source URLs
112  cat store.json | sed "s/@PREFIX@//g" > TMP  cat store.json | sed "s/@PREFIX@//g" > TMP
113  wget --post-file=TMP -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- -e "http_proxy=http://127.0.0.1:${server_port}/" http://127.0.0.1:${origin_server_port}/jscoverage-store > /dev/null
114  json_cmp store-bad-source-urls.expected.json DIR/jscoverage.json  json_cmp store-bad-source-urls.expected.json DIR/jscoverage.json
115  sort ERR -o ERR  sort ERR -o ERR
116  diff --strip-trailing-cr store-bad-source-urls.expected.err ERR  diff --strip-trailing-cr store-bad-source-urls.expected.err ERR
# Line 117  Line 118 
118  shutdown  shutdown
119    
120  rm -fr DIR  rm -fr DIR
121  $VALGRIND jscoverage-server --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &  server_port=`perl unused-port.pl`
122    $VALGRIND jscoverage-server --port=$server_port --no-highlight --proxy --report-dir=DIR > OUT 2> ERR &
123  server_pid=$!  server_pid=$!
 server_port=8080  
124    
125  wait_for_server http://127.0.0.1:8080/jscoverage.html  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
126    
127  unused_port=`perl unused-port.pl`  unused_port=`perl unused-port.pl`
128  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:$unused_port\\//g" > TMP  cat store.json | sed "s/@PREFIX@/http:\\/\\/127.0.0.1:$unused_port\\//g" > TMP
129  wget --post-file=TMP -q -O- -e 'http_proxy=http://127.0.0.1:8080/' http://127.0.0.1:8000/jscoverage-store > /dev/null  wget --post-file=TMP -q -O- -e "http_proxy=http://127.0.0.1:${server_port}/" http://127.0.0.1:${origin_server_port}/jscoverage-store > /dev/null
130  cat store-unreachable-source-urls.expected.json | sed "s/@PORT@/$unused_port/g" > TMP  cat store-unreachable-source-urls.expected.json | sed "s/@PORT@/$unused_port/g" > TMP
131  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
132  cat store-unreachable-source-urls.expected.err | sed "s/@PORT@/$unused_port/g" > TMP  cat store-unreachable-source-urls.expected.err | sed "s/@PORT@/$unused_port/g" > TMP

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

  ViewVC Help
Powered by ViewVC 1.1.24