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

Contents of /trunk/tests/common.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 570 - (show annotations)
Mon May 24 03:13:28 2010 UTC (10 years, 6 months ago) by siliconforks
File MIME type: application/x-sh
File size: 997 byte(s)
Remove all timing dependencies.

1 export PATH=.:..:../js:$PATH
2
3 json_cmp() {
4 echo 'EXPECTED = ' | cat - $1 > EXPECTED
5 echo 'ACTUAL = ' | cat - $2 > ACTUAL
6 js -f EXPECTED -f ACTUAL -f json-cmp.js
7 }
8
9 add_header_to_file() {
10 source=$1
11 destination=$2
12 cat ../header.txt ../header.js $source > $destination
13 }
14
15 add_header_to_files() {
16 directory=$1
17 cp -R $directory EXPECTED
18 find EXPECTED -name .svn | xargs rm -fr
19 for i in `find EXPECTED -name '*.js'`
20 do
21 add_header_to_file $i TMP-common.js
22 mv TMP-common.js $i
23 done
24 }
25
26 wait_for_server() {
27 url=$1
28 i=0
29 while [ $i -lt 20 ] && ! wget -q -O- $url > /dev/null 2> /dev/null
30 do
31 i=`expr $i + 1`
32 sleep 0.5
33 done
34 if [ $i = 20 ]
35 then
36 echo 'server failed to start, giving up'
37 exit 1
38 fi
39 }
40
41 wait_for_server_shutdown() {
42 url=$1
43 i=0
44 while [ $i -lt 20 ] && wget -q -O- $url > /dev/null 2> /dev/null
45 do
46 counter=`expr $i + 1`
47 sleep 0.5
48 done
49 if [ $i = 20 ]
50 then
51 echo 'server failed to stop, giving up'
52 exit 1
53 fi
54 }

  ViewVC Help
Powered by ViewVC 1.1.24