nsprpub/pr/tests/runtests.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial