/[jscoverage]/trunk/tests/store-unreadable-json.sh
ViewVC logotype

Diff of /trunk/tests/store-unreadable-json.sh

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

revision 366 by siliconforks, Sun Oct 26 21:15:24 2008 UTC revision 610 by siliconforks, Fri Sep 24 20:35:36 2010 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #    store-unreadable-json.sh - test store when jscoverage.json is not readable  #    store-unreadable-json.sh - test store when jscoverage.json is not readable
3  #    Copyright (C) 2008 siliconforks.com  #    Copyright (C) 2008, 2009, 2010 siliconforks.com
4  #  #
5  #    This program is free software; you can redistribute it and/or modify  #    This program is free software; you can redistribute it and/or modify
6  #    it under the terms of the GNU General Public License as published by  #    it under the terms of the GNU General Public License as published by
# Line 18  Line 18 
18    
19  set -e  set -e
20    
21  . common.sh  . ./common.sh
22    
23  # skip on windows  # skip on windows
24  uname=`uname`  uname=`uname`
# Line 39  Line 39 
39    
40  trap 'cleanup' 0 1 2 3 15  trap 'cleanup' 0 1 2 3 15
41    
 if [ -z "$VALGRIND" ]  
 then  
   delay=0.2  
 else  
   delay=2  
 fi  
   
42  rm -fr DIR  rm -fr DIR
43  $VALGRIND jscoverage-server --no-highlight --document-root=recursive --report-dir=DIR > OUT 2> ERR &  server_port=`perl unused-port.pl`
44    $VALGRIND jscoverage-server --port=$server_port --no-highlight --document-root=recursive --report-dir=DIR > OUT 2> ERR &
45  server_pid=$!  server_pid=$!
 server_port=8080  
46    
47  sleep $delay  wait_for_server http://127.0.0.1:${server_port}/jscoverage.html
48    
49  cat store.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.json | sed "s/@PREFIX@/\\//g" > TMP
50  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
51  cat store.expected.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.expected.json | sed "s/@PREFIX@/\\//g" > TMP
52  json_cmp TMP DIR/jscoverage.json  json_cmp TMP DIR/jscoverage.json
53    
# Line 62  Line 55 
55    
56  cat store.json | sed "s/@PREFIX@/\\//g" > TMP  cat store.json | sed "s/@PREFIX@/\\//g" > TMP
57  echo 500 > EXPECTED  echo 500 > EXPECTED
58  ! curl -d @TMP -f -w '%{http_code}\n' http://127.0.0.1:8080/jscoverage-store 2> /dev/null > ACTUAL  ! curl -d @TMP -f -w '%{http_code}\n' http://127.0.0.1:${server_port}/jscoverage-store 2> /dev/null > ACTUAL
59  diff EXPECTED ACTUAL  diff EXPECTED ACTUAL

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

  ViewVC Help
Powered by ViewVC 1.1.24