nsprpub/pr/tests/runtests.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/tests/runtests.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,270 @@
     1.4 +#!/bin/sh
     1.5 +# 
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +
    1.10 +#
    1.11 +# runtests.sh
    1.12 +#	Bourne shell script for nspr tests
    1.13 +#
    1.14 +
    1.15 +SYSTEM_INFO=`uname -a`
    1.16 +OS_ARCH=`uname -s`
    1.17 +
    1.18 +if [ $OS_ARCH = "Windows_NT" ] || [ $OS_ARCH = "OS/2" ]
    1.19 +then
    1.20 +	NULL_DEVICE=nul
    1.21 +else
    1.22 +	NULL_DEVICE=/dev/null
    1.23 +	FILE_D=`ulimit -n`
    1.24 +	if [ $FILE_D -lt 512 ]
    1.25 +	then
    1.26 +		ulimit -n 512
    1.27 +	fi
    1.28 +fi
    1.29 +
    1.30 +#
    1.31 +# Irrevelant tests
    1.32 +#
    1.33 +#bug1test 	- used to demonstrate a bug on NT
    1.34 +#bigfile2   - requires 4Gig file creation. See BugZilla #5451
    1.35 +#bigfile3   - requires 4Gig file creation. See BugZilla #5451
    1.36 +#dbmalloc	- obsolete; originally for testing debug version of nspr's malloc
    1.37 +#dbmalloc1	- obsolete; originally for testing debug version of nspr's malloc
    1.38 +#depend		- obsolete; used to test a initial spec for library dependencies
    1.39 +#dceemu		- used to tests special functions in NSPR for DCE emulation
    1.40 +#ipv6		- IPV6 not in use by NSPR clients
    1.41 +#mbcs       - tests use of multi-byte charset for filenames. See BugZilla #25140
    1.42 +#sproc_ch	- obsolete; sproc-based tests for Irix
    1.43 +#sproc_p	- obsolete; sproc-based tests for Irix
    1.44 +#io_timeoutk - obsolete; subsumed in io_timeout
    1.45 +#io_timeoutu - obsolete; subsumed in io_timeout
    1.46 +#prftest1	- obsolete; subsumed by prftest
    1.47 +#prftest2	- obsolete; subsumed by prftest
    1.48 +#prselect	- obsolete; PR_Select is obsolete
    1.49 +#select2	- obsolete; PR_Select is obsolete
    1.50 +#sem		- obsolete; PRSemaphore is obsolete
    1.51 +#stat		- for OS2?
    1.52 +#suspend	- private interfaces PR_SuspendAll, PR_ResumeAll, etc..
    1.53 +#thruput	- needs to be run manually as client/server
    1.54 +#time		- used to measure time with native calls and nspr calls
    1.55 +#tmoacc		- should be run with tmocon
    1.56 +#tmocon		- should be run with tmoacc
    1.57 +#op_noacc	- limited use
    1.58 +#yield		- limited use for PR_Yield
    1.59 +
    1.60 +#
    1.61 +# Tests not run (but should)
    1.62 +#
    1.63 +
    1.64 +#forktest (failed on IRIX)
    1.65 +#nbconn - fails on some platforms 
    1.66 +#poll_er - fails on some platforms? limited use?
    1.67 +#prpoll -  the bad-FD test needs to be moved to a different test
    1.68 +#sleep	-  specific to OS/2
    1.69 +
    1.70 +LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
    1.71 +
    1.72 +#
    1.73 +# Tests run on all platforms
    1.74 +#
    1.75 +
    1.76 +TESTS="
    1.77 +accept
    1.78 +acceptread
    1.79 +acceptreademu
    1.80 +affinity
    1.81 +alarm
    1.82 +anonfm
    1.83 +atomic
    1.84 +attach
    1.85 +bigfile
    1.86 +cleanup
    1.87 +cltsrv
    1.88 +concur
    1.89 +cvar
    1.90 +cvar2
    1.91 +dlltest
    1.92 +dtoa
    1.93 +errcodes
    1.94 +exit
    1.95 +fdcach
    1.96 +fileio
    1.97 +foreign
    1.98 +formattm
    1.99 +fsync
   1.100 +gethost
   1.101 +getproto
   1.102 +i2l
   1.103 +initclk
   1.104 +inrval
   1.105 +instrumt
   1.106 +intrio
   1.107 +intrupt
   1.108 +io_timeout
   1.109 +ioconthr
   1.110 +join
   1.111 +joinkk
   1.112 +joinku
   1.113 +joinuk
   1.114 +joinuu
   1.115 +layer
   1.116 +lazyinit
   1.117 +libfilename
   1.118 +lltest
   1.119 +lock
   1.120 +lockfile
   1.121 +logfile
   1.122 +logger
   1.123 +many_cv
   1.124 +multiwait
   1.125 +nameshm1
   1.126 +nblayer
   1.127 +nonblock
   1.128 +ntioto
   1.129 +ntoh
   1.130 +op_2long
   1.131 +op_excl
   1.132 +op_filnf
   1.133 +op_filok
   1.134 +op_nofil
   1.135 +parent
   1.136 +parsetm
   1.137 +peek
   1.138 +perf
   1.139 +pipeping
   1.140 +pipeping2
   1.141 +pipeself
   1.142 +poll_nm
   1.143 +poll_to
   1.144 +pollable
   1.145 +prftest
   1.146 +primblok
   1.147 +provider
   1.148 +prpollml
   1.149 +pushtop
   1.150 +ranfile
   1.151 +randseed
   1.152 +reinit
   1.153 +rwlocktest
   1.154 +sel_spd
   1.155 +selct_er
   1.156 +selct_nm
   1.157 +selct_to
   1.158 +selintr
   1.159 +sema
   1.160 +semaerr
   1.161 +semaping
   1.162 +sendzlf
   1.163 +server_test
   1.164 +servr_kk
   1.165 +servr_uk
   1.166 +servr_ku
   1.167 +servr_uu
   1.168 +short_thread
   1.169 +sigpipe
   1.170 +socket
   1.171 +sockopt
   1.172 +sockping
   1.173 +sprintf
   1.174 +stack
   1.175 +stdio
   1.176 +str2addr
   1.177 +strod
   1.178 +switch
   1.179 +system
   1.180 +testbit
   1.181 +testfile
   1.182 +threads
   1.183 +timemac
   1.184 +timetest
   1.185 +tpd
   1.186 +udpsrv
   1.187 +vercheck
   1.188 +version
   1.189 +writev
   1.190 +xnotify
   1.191 +zerolen"
   1.192 +
   1.193 +rval=0
   1.194 +
   1.195 +
   1.196 +#
   1.197 +# When set, value of the environment variable TEST_TIMEOUT is the maximum
   1.198 +# time (secs) allowed for a test program beyond which it is terminated.
   1.199 +# If TEST_TIMEOUT is not set or if it's value is 0, then test programs
   1.200 +# don't timeout.
   1.201 +#
   1.202 +# Running runtests.ksh under MKS toolkit on NT, 95, 98 does not cause
   1.203 +# timeout detection correctly. For these platforms, do not attempt timeout
   1.204 +# test. (lth).
   1.205 +#
   1.206 +#
   1.207 +
   1.208 +OS_PLATFORM=`uname`
   1.209 +OBJDIR=`basename $PWD`
   1.210 +printf "\nNSPR Test Results - $OBJDIR\n\n"
   1.211 +printf "BEGIN\t\t\t`date`\n"
   1.212 +printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n"
   1.213 +printf "Test\t\t\tResult\n\n"
   1.214 +if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then
   1.215 +	for prog in $TESTS
   1.216 +	do
   1.217 +		printf "$prog"
   1.218 +		printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
   1.219 +		./$prog >> ${LOGFILE} 2>&1
   1.220 +		if [ 0 = $? ] ; then
   1.221 +			printf "\t\t\tPassed\n";
   1.222 +		else
   1.223 +			printf "\t\t\tFAILED\n";
   1.224 +			rval=1
   1.225 +		fi;
   1.226 +		printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
   1.227 +	done
   1.228 +else
   1.229 +	for prog in $TESTS
   1.230 +	do
   1.231 +		printf "$prog"
   1.232 +		printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
   1.233 +		export test_rval
   1.234 +		./$prog >> ${LOGFILE} 2>&1 &
   1.235 +		test_pid=$!
   1.236 +		sleep_pid=0
   1.237 +		if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0
   1.238 +		then
   1.239 +		(sleep  $TEST_TIMEOUT; kill $test_pid >/dev/null 2>&1 ) &
   1.240 +		sleep_pid=$!
   1.241 +		fi
   1.242 +		wait $test_pid
   1.243 +		test_rval=$?
   1.244 +		[ $sleep_pid -eq 0 ] || kill $sleep_pid >/dev/null 2>&1
   1.245 +		if [ 0 = $test_rval ] ; then
   1.246 +			printf "\t\t\tPassed\n";
   1.247 +		else
   1.248 +			printf "\t\t\tFAILED\n";
   1.249 +			rval=1
   1.250 +		fi;
   1.251 +		printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
   1.252 +	done
   1.253 +fi;
   1.254 +
   1.255 +printf "END\t\t\t`date`\n"
   1.256 +exit $rval
   1.257 +
   1.258 +
   1.259 +
   1.260 +
   1.261 +
   1.262 +
   1.263 +
   1.264 +
   1.265 +
   1.266 +
   1.267 +
   1.268 +
   1.269 +
   1.270 +
   1.271 +
   1.272 +
   1.273 +

mercurial