1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ***** BEGIN LICENSE BLOCK *****
|
---|
4 | # Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
5 | #
|
---|
6 | # The contents of this file are subject to the Mozilla Public License Version
|
---|
7 | # 1.1 (the "License"); you may not use this file except in compliance with
|
---|
8 | # the License. You may obtain a copy of the License at
|
---|
9 | # http://www.mozilla.org/MPL/
|
---|
10 | #
|
---|
11 | # Software distributed under the License is distributed on an "AS IS" basis,
|
---|
12 | # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
13 | # for the specific language governing rights and limitations under the
|
---|
14 | # License.
|
---|
15 | #
|
---|
16 | # The Original Code is the Netscape Portable Runtime (NSPR).
|
---|
17 | #
|
---|
18 | # The Initial Developer of the Original Code is
|
---|
19 | # Netscape Communications Corporation.
|
---|
20 | # Portions created by the Initial Developer are Copyright (C) 1998-2000
|
---|
21 | # the Initial Developer. All Rights Reserved.
|
---|
22 | #
|
---|
23 | # Contributor(s):
|
---|
24 | #
|
---|
25 | # Alternatively, the contents of this file may be used under the terms of
|
---|
26 | # either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
27 | # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
28 | # in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
29 | # of those above. If you wish to allow use of your version of this file only
|
---|
30 | # under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
31 | # use your version of this file under the terms of the MPL, indicate your
|
---|
32 | # decision by deleting the provisions above and replace them with the notice
|
---|
33 | # and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
34 | # the provisions above, a recipient may use your version of this file under
|
---|
35 | # the terms of any one of the MPL, the GPL or the LGPL.
|
---|
36 | #
|
---|
37 | # ***** END LICENSE BLOCK *****
|
---|
38 |
|
---|
39 | #
|
---|
40 | # tests.ksh
|
---|
41 | # korn shell script for nspr tests
|
---|
42 | #
|
---|
43 |
|
---|
44 | SYSTEM_INFO=`uname -a`
|
---|
45 | OS_ARCH=`uname -s`
|
---|
46 | if [ $OS_ARCH = "Windows_NT" ] || [ $OS_ARCH = "OS/2" ]
|
---|
47 | then
|
---|
48 | NULL_DEVICE=nul
|
---|
49 | else
|
---|
50 | NULL_DEVICE=/dev/null
|
---|
51 | fi
|
---|
52 |
|
---|
53 | #
|
---|
54 | # Irrevelant tests
|
---|
55 | #
|
---|
56 | #bug1test - used to demonstrate a bug on NT
|
---|
57 | #bigfile2 - requires 4Gig file creation. See BugZilla #5451
|
---|
58 | #bigfile3 - requires 4Gig file creation. See BugZilla #5451
|
---|
59 | #dbmalloc - obsolete; originally for testing debug version of nspr's malloc
|
---|
60 | #dbmalloc1 - obsolete; originally for testing debug version of nspr's malloc
|
---|
61 | #depend - obsolete; used to test a initial spec for library dependencies
|
---|
62 | #dceemu - used to tests special functions in NSPR for DCE emulation
|
---|
63 | #ipv6 - IPV6 not in use by NSPR clients
|
---|
64 | #mbcs - tests use of multi-byte charset for filenames. See BugZilla #25140
|
---|
65 | #sproc_ch - obsolete; sproc-based tests for Irix
|
---|
66 | #sproc_p - obsolete; sproc-based tests for Irix
|
---|
67 | #io_timeoutk - obsolete; subsumed in io_timeout
|
---|
68 | #io_timeoutu - obsolete; subsumed in io_timeout
|
---|
69 | #prftest1 - obsolete; subsumed by prftest
|
---|
70 | #prftest2 - obsolete; subsumed by prftest
|
---|
71 | #prselect - obsolete; PR_Select is obsolete
|
---|
72 | #select2 - obsolete; PR_Select is obsolete
|
---|
73 | #sem - obsolete; PRSemaphore is obsolete
|
---|
74 | #stat - for OS2?
|
---|
75 | #suspend - private interfaces PR_SuspendAll, PR_ResumeAll, etc..
|
---|
76 | #thruput - needs to be run manually as client/server
|
---|
77 | #time - used to measure time with native calls and nspr calls
|
---|
78 | #tmoacc - should be run with tmocon
|
---|
79 | #tmocon - should be run with tmoacc
|
---|
80 | #op_noacc - limited use
|
---|
81 | #yield - limited use for PR_Yield
|
---|
82 |
|
---|
83 | #
|
---|
84 | # Tests not run (but should)
|
---|
85 | #
|
---|
86 |
|
---|
87 | #forktest (failed on IRIX)
|
---|
88 | #nbconn - fails on some platforms
|
---|
89 | #poll_er - fails on some platforms? limited use?
|
---|
90 | #prpoll - the bad-FD test needs to be moved to a different test
|
---|
91 | #sleep - specific to OS/2
|
---|
92 |
|
---|
93 | LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
|
---|
94 |
|
---|
95 | #
|
---|
96 | # Tests run on all platforms
|
---|
97 | #
|
---|
98 |
|
---|
99 | TESTS="
|
---|
100 | accept
|
---|
101 | acceptread
|
---|
102 | acceptreademu
|
---|
103 | affinity
|
---|
104 | alarm
|
---|
105 | anonfm
|
---|
106 | atomic
|
---|
107 | attach
|
---|
108 | bigfile
|
---|
109 | cleanup
|
---|
110 | cltsrv
|
---|
111 | concur
|
---|
112 | cvar
|
---|
113 | cvar2
|
---|
114 | dlltest
|
---|
115 | dtoa
|
---|
116 | errcodes
|
---|
117 | exit
|
---|
118 | fdcach
|
---|
119 | fileio
|
---|
120 | foreign
|
---|
121 | formattm
|
---|
122 | fsync
|
---|
123 | gethost
|
---|
124 | getproto
|
---|
125 | i2l
|
---|
126 | initclk
|
---|
127 | inrval
|
---|
128 | instrumt
|
---|
129 | intrio
|
---|
130 | intrupt
|
---|
131 | io_timeout
|
---|
132 | ioconthr
|
---|
133 | join
|
---|
134 | joinkk
|
---|
135 | joinku
|
---|
136 | joinuk
|
---|
137 | joinuu
|
---|
138 | layer
|
---|
139 | lazyinit
|
---|
140 | libfilename
|
---|
141 | lltest
|
---|
142 | lock
|
---|
143 | lockfile
|
---|
144 | logger
|
---|
145 | many_cv
|
---|
146 | multiwait
|
---|
147 | nameshm1
|
---|
148 | nblayer
|
---|
149 | nonblock
|
---|
150 | ntioto
|
---|
151 | ntoh
|
---|
152 | op_2long
|
---|
153 | op_excl
|
---|
154 | op_filnf
|
---|
155 | op_filok
|
---|
156 | op_nofil
|
---|
157 | parent
|
---|
158 | peek
|
---|
159 | perf
|
---|
160 | pipeping
|
---|
161 | pipeping2
|
---|
162 | pipeself
|
---|
163 | poll_nm
|
---|
164 | poll_to
|
---|
165 | pollable
|
---|
166 | prftest
|
---|
167 | primblok
|
---|
168 | provider
|
---|
169 | prpollml
|
---|
170 | ranfile
|
---|
171 | randseed
|
---|
172 | rwlocktest
|
---|
173 | sel_spd
|
---|
174 | selct_er
|
---|
175 | selct_nm
|
---|
176 | selct_to
|
---|
177 | selintr
|
---|
178 | sema
|
---|
179 | semaerr
|
---|
180 | semaping
|
---|
181 | sendzlf
|
---|
182 | server_test
|
---|
183 | servr_kk
|
---|
184 | servr_uk
|
---|
185 | servr_ku
|
---|
186 | servr_uu
|
---|
187 | short_thread
|
---|
188 | sigpipe
|
---|
189 | socket
|
---|
190 | sockopt
|
---|
191 | sockping
|
---|
192 | sprintf
|
---|
193 | stack
|
---|
194 | stdio
|
---|
195 | str2addr
|
---|
196 | strod
|
---|
197 | switch
|
---|
198 | system
|
---|
199 | testbit
|
---|
200 | testfile
|
---|
201 | threads
|
---|
202 | timemac
|
---|
203 | timetest
|
---|
204 | tpd
|
---|
205 | udpsrv
|
---|
206 | vercheck
|
---|
207 | version
|
---|
208 | writev
|
---|
209 | xnotify
|
---|
210 | zerolen"
|
---|
211 |
|
---|
212 | rval=0
|
---|
213 |
|
---|
214 |
|
---|
215 | #
|
---|
216 | # When set, value of the environment variable TEST_TIMEOUT is the maximum
|
---|
217 | # time (secs) allowed for a test program beyond which it is terminated.
|
---|
218 | # If TEST_TIMEOUT is not set or if it's value is 0, then test programs
|
---|
219 | # don't timeout.
|
---|
220 | #
|
---|
221 | # Running runtests.ksh under MKS toolkit on NT, 95, 98 does not cause
|
---|
222 | # timeout detection correctly. For these platforms, do not attempt timeout
|
---|
223 | # test. (lth).
|
---|
224 | #
|
---|
225 | #
|
---|
226 |
|
---|
227 | OS_PLATFORM=`uname`
|
---|
228 | OBJDIR=`basename $PWD`
|
---|
229 | printf "\nNSPR Test Results - $OBJDIR\n\n"
|
---|
230 | printf "BEGIN\t\t\t`date`\n"
|
---|
231 | printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n"
|
---|
232 | printf "Test\t\t\tResult\n\n"
|
---|
233 | if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then
|
---|
234 | for prog in $TESTS
|
---|
235 | do
|
---|
236 | printf "$prog"
|
---|
237 | printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
|
---|
238 | ./$prog >> ${LOGFILE} 2>&1
|
---|
239 | if [ 0 = $? ] ; then
|
---|
240 | printf "\t\t\tPassed\n";
|
---|
241 | else
|
---|
242 | printf "\t\t\tFAILED\n";
|
---|
243 | rval=1
|
---|
244 | fi;
|
---|
245 | printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
|
---|
246 | done
|
---|
247 | else
|
---|
248 | for prog in $TESTS
|
---|
249 | do
|
---|
250 | printf "$prog"
|
---|
251 | printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
|
---|
252 | export test_rval
|
---|
253 | ./$prog >> ${LOGFILE} 2>&1 &
|
---|
254 | test_pid=$!
|
---|
255 | sleep_pid=0
|
---|
256 | if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0
|
---|
257 | then
|
---|
258 | (sleep $TEST_TIMEOUT; kill $test_pid >/dev/null 2>&1 ) &
|
---|
259 | sleep_pid=$!
|
---|
260 | fi
|
---|
261 | wait $test_pid
|
---|
262 | test_rval=$?
|
---|
263 | [ $sleep_pid -eq 0 ] || kill $sleep_pid >/dev/null 2>&1
|
---|
264 | if [ 0 = $test_rval ] ; then
|
---|
265 | printf "\t\t\tPassed\n";
|
---|
266 | else
|
---|
267 | printf "\t\t\tFAILED\n";
|
---|
268 | rval=1
|
---|
269 | fi;
|
---|
270 | printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
|
---|
271 | done
|
---|
272 | fi;
|
---|
273 |
|
---|
274 | printf "END\t\t\t`date`\n"
|
---|
275 | exit $rval
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 |
|
---|
281 |
|
---|
282 |
|
---|
283 |
|
---|
284 |
|
---|
285 |
|
---|
286 |
|
---|
287 |
|
---|
288 |
|
---|
289 |
|
---|
290 |
|
---|
291 |
|
---|
292 |
|
---|