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