Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #!/bin/sh
2 #
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 #
8 # runtests.sh
9 # Bourne shell script for nspr tests
10 #
12 SYSTEM_INFO=`uname -a`
13 OS_ARCH=`uname -s`
15 if [ $OS_ARCH = "Windows_NT" ] || [ $OS_ARCH = "OS/2" ]
16 then
17 NULL_DEVICE=nul
18 else
19 NULL_DEVICE=/dev/null
20 FILE_D=`ulimit -n`
21 if [ $FILE_D -lt 512 ]
22 then
23 ulimit -n 512
24 fi
25 fi
27 #
28 # Irrevelant tests
29 #
30 #bug1test - used to demonstrate a bug on NT
31 #bigfile2 - requires 4Gig file creation. See BugZilla #5451
32 #bigfile3 - requires 4Gig file creation. See BugZilla #5451
33 #dbmalloc - obsolete; originally for testing debug version of nspr's malloc
34 #dbmalloc1 - obsolete; originally for testing debug version of nspr's malloc
35 #depend - obsolete; used to test a initial spec for library dependencies
36 #dceemu - used to tests special functions in NSPR for DCE emulation
37 #ipv6 - IPV6 not in use by NSPR clients
38 #mbcs - tests use of multi-byte charset for filenames. See BugZilla #25140
39 #sproc_ch - obsolete; sproc-based tests for Irix
40 #sproc_p - obsolete; sproc-based tests for Irix
41 #io_timeoutk - obsolete; subsumed in io_timeout
42 #io_timeoutu - obsolete; subsumed in io_timeout
43 #prftest1 - obsolete; subsumed by prftest
44 #prftest2 - obsolete; subsumed by prftest
45 #prselect - obsolete; PR_Select is obsolete
46 #select2 - obsolete; PR_Select is obsolete
47 #sem - obsolete; PRSemaphore is obsolete
48 #stat - for OS2?
49 #suspend - private interfaces PR_SuspendAll, PR_ResumeAll, etc..
50 #thruput - needs to be run manually as client/server
51 #time - used to measure time with native calls and nspr calls
52 #tmoacc - should be run with tmocon
53 #tmocon - should be run with tmoacc
54 #op_noacc - limited use
55 #yield - limited use for PR_Yield
57 #
58 # Tests not run (but should)
59 #
61 #forktest (failed on IRIX)
62 #nbconn - fails on some platforms
63 #poll_er - fails on some platforms? limited use?
64 #prpoll - the bad-FD test needs to be moved to a different test
65 #sleep - specific to OS/2
67 LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
69 #
70 # Tests run on all platforms
71 #
73 TESTS="
74 accept
75 acceptread
76 acceptreademu
77 affinity
78 alarm
79 anonfm
80 atomic
81 attach
82 bigfile
83 cleanup
84 cltsrv
85 concur
86 cvar
87 cvar2
88 dlltest
89 dtoa
90 errcodes
91 exit
92 fdcach
93 fileio
94 foreign
95 formattm
96 fsync
97 gethost
98 getproto
99 i2l
100 initclk
101 inrval
102 instrumt
103 intrio
104 intrupt
105 io_timeout
106 ioconthr
107 join
108 joinkk
109 joinku
110 joinuk
111 joinuu
112 layer
113 lazyinit
114 libfilename
115 lltest
116 lock
117 lockfile
118 logfile
119 logger
120 many_cv
121 multiwait
122 nameshm1
123 nblayer
124 nonblock
125 ntioto
126 ntoh
127 op_2long
128 op_excl
129 op_filnf
130 op_filok
131 op_nofil
132 parent
133 parsetm
134 peek
135 perf
136 pipeping
137 pipeping2
138 pipeself
139 poll_nm
140 poll_to
141 pollable
142 prftest
143 primblok
144 provider
145 prpollml
146 pushtop
147 ranfile
148 randseed
149 reinit
150 rwlocktest
151 sel_spd
152 selct_er
153 selct_nm
154 selct_to
155 selintr
156 sema
157 semaerr
158 semaping
159 sendzlf
160 server_test
161 servr_kk
162 servr_uk
163 servr_ku
164 servr_uu
165 short_thread
166 sigpipe
167 socket
168 sockopt
169 sockping
170 sprintf
171 stack
172 stdio
173 str2addr
174 strod
175 switch
176 system
177 testbit
178 testfile
179 threads
180 timemac
181 timetest
182 tpd
183 udpsrv
184 vercheck
185 version
186 writev
187 xnotify
188 zerolen"
190 rval=0
193 #
194 # When set, value of the environment variable TEST_TIMEOUT is the maximum
195 # time (secs) allowed for a test program beyond which it is terminated.
196 # If TEST_TIMEOUT is not set or if it's value is 0, then test programs
197 # don't timeout.
198 #
199 # Running runtests.ksh under MKS toolkit on NT, 95, 98 does not cause
200 # timeout detection correctly. For these platforms, do not attempt timeout
201 # test. (lth).
202 #
203 #
205 OS_PLATFORM=`uname`
206 OBJDIR=`basename $PWD`
207 printf "\nNSPR Test Results - $OBJDIR\n\n"
208 printf "BEGIN\t\t\t`date`\n"
209 printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n"
210 printf "Test\t\t\tResult\n\n"
211 if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then
212 for prog in $TESTS
213 do
214 printf "$prog"
215 printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
216 ./$prog >> ${LOGFILE} 2>&1
217 if [ 0 = $? ] ; then
218 printf "\t\t\tPassed\n";
219 else
220 printf "\t\t\tFAILED\n";
221 rval=1
222 fi;
223 printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
224 done
225 else
226 for prog in $TESTS
227 do
228 printf "$prog"
229 printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
230 export test_rval
231 ./$prog >> ${LOGFILE} 2>&1 &
232 test_pid=$!
233 sleep_pid=0
234 if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0
235 then
236 (sleep $TEST_TIMEOUT; kill $test_pid >/dev/null 2>&1 ) &
237 sleep_pid=$!
238 fi
239 wait $test_pid
240 test_rval=$?
241 [ $sleep_pid -eq 0 ] || kill $sleep_pid >/dev/null 2>&1
242 if [ 0 = $test_rval ] ; then
243 printf "\t\t\tPassed\n";
244 else
245 printf "\t\t\tFAILED\n";
246 rval=1
247 fi;
248 printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
249 done
250 fi;
252 printf "END\t\t\t`date`\n"
253 exit $rval