michael@0: #!/bin/sh michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # michael@0: # runtests.sh michael@0: # Bourne shell script for nspr tests michael@0: # michael@0: michael@0: SYSTEM_INFO=`uname -a` michael@0: OS_ARCH=`uname -s` michael@0: michael@0: if [ $OS_ARCH = "Windows_NT" ] || [ $OS_ARCH = "OS/2" ] michael@0: then michael@0: NULL_DEVICE=nul michael@0: else michael@0: NULL_DEVICE=/dev/null michael@0: FILE_D=`ulimit -n` michael@0: if [ $FILE_D -lt 512 ] michael@0: then michael@0: ulimit -n 512 michael@0: fi michael@0: fi michael@0: michael@0: # michael@0: # Irrevelant tests michael@0: # michael@0: #bug1test - used to demonstrate a bug on NT michael@0: #bigfile2 - requires 4Gig file creation. See BugZilla #5451 michael@0: #bigfile3 - requires 4Gig file creation. See BugZilla #5451 michael@0: #dbmalloc - obsolete; originally for testing debug version of nspr's malloc michael@0: #dbmalloc1 - obsolete; originally for testing debug version of nspr's malloc michael@0: #depend - obsolete; used to test a initial spec for library dependencies michael@0: #dceemu - used to tests special functions in NSPR for DCE emulation michael@0: #ipv6 - IPV6 not in use by NSPR clients michael@0: #mbcs - tests use of multi-byte charset for filenames. See BugZilla #25140 michael@0: #sproc_ch - obsolete; sproc-based tests for Irix michael@0: #sproc_p - obsolete; sproc-based tests for Irix michael@0: #io_timeoutk - obsolete; subsumed in io_timeout michael@0: #io_timeoutu - obsolete; subsumed in io_timeout michael@0: #prftest1 - obsolete; subsumed by prftest michael@0: #prftest2 - obsolete; subsumed by prftest michael@0: #prselect - obsolete; PR_Select is obsolete michael@0: #select2 - obsolete; PR_Select is obsolete michael@0: #sem - obsolete; PRSemaphore is obsolete michael@0: #stat - for OS2? michael@0: #suspend - private interfaces PR_SuspendAll, PR_ResumeAll, etc.. michael@0: #thruput - needs to be run manually as client/server michael@0: #time - used to measure time with native calls and nspr calls michael@0: #tmoacc - should be run with tmocon michael@0: #tmocon - should be run with tmoacc michael@0: #op_noacc - limited use michael@0: #yield - limited use for PR_Yield michael@0: michael@0: # michael@0: # Tests not run (but should) michael@0: # michael@0: michael@0: #forktest (failed on IRIX) michael@0: #nbconn - fails on some platforms michael@0: #poll_er - fails on some platforms? limited use? michael@0: #prpoll - the bad-FD test needs to be moved to a different test michael@0: #sleep - specific to OS/2 michael@0: michael@0: LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE} michael@0: michael@0: # michael@0: # Tests run on all platforms michael@0: # michael@0: michael@0: TESTS=" michael@0: accept michael@0: acceptread michael@0: acceptreademu michael@0: affinity michael@0: alarm michael@0: anonfm michael@0: atomic michael@0: attach michael@0: bigfile michael@0: cleanup michael@0: cltsrv michael@0: concur michael@0: cvar michael@0: cvar2 michael@0: dlltest michael@0: dtoa michael@0: errcodes michael@0: exit michael@0: fdcach michael@0: fileio michael@0: foreign michael@0: formattm michael@0: fsync michael@0: gethost michael@0: getproto michael@0: i2l michael@0: initclk michael@0: inrval michael@0: instrumt michael@0: intrio michael@0: intrupt michael@0: io_timeout michael@0: ioconthr michael@0: join michael@0: joinkk michael@0: joinku michael@0: joinuk michael@0: joinuu michael@0: layer michael@0: lazyinit michael@0: libfilename michael@0: lltest michael@0: lock michael@0: lockfile michael@0: logfile michael@0: logger michael@0: many_cv michael@0: multiwait michael@0: nameshm1 michael@0: nblayer michael@0: nonblock michael@0: ntioto michael@0: ntoh michael@0: op_2long michael@0: op_excl michael@0: op_filnf michael@0: op_filok michael@0: op_nofil michael@0: parent michael@0: parsetm michael@0: peek michael@0: perf michael@0: pipeping michael@0: pipeping2 michael@0: pipeself michael@0: poll_nm michael@0: poll_to michael@0: pollable michael@0: prftest michael@0: primblok michael@0: provider michael@0: prpollml michael@0: pushtop michael@0: ranfile michael@0: randseed michael@0: reinit michael@0: rwlocktest michael@0: sel_spd michael@0: selct_er michael@0: selct_nm michael@0: selct_to michael@0: selintr michael@0: sema michael@0: semaerr michael@0: semaping michael@0: sendzlf michael@0: server_test michael@0: servr_kk michael@0: servr_uk michael@0: servr_ku michael@0: servr_uu michael@0: short_thread michael@0: sigpipe michael@0: socket michael@0: sockopt michael@0: sockping michael@0: sprintf michael@0: stack michael@0: stdio michael@0: str2addr michael@0: strod michael@0: switch michael@0: system michael@0: testbit michael@0: testfile michael@0: threads michael@0: timemac michael@0: timetest michael@0: tpd michael@0: udpsrv michael@0: vercheck michael@0: version michael@0: writev michael@0: xnotify michael@0: zerolen" michael@0: michael@0: rval=0 michael@0: michael@0: michael@0: # michael@0: # When set, value of the environment variable TEST_TIMEOUT is the maximum michael@0: # time (secs) allowed for a test program beyond which it is terminated. michael@0: # If TEST_TIMEOUT is not set or if it's value is 0, then test programs michael@0: # don't timeout. michael@0: # michael@0: # Running runtests.ksh under MKS toolkit on NT, 95, 98 does not cause michael@0: # timeout detection correctly. For these platforms, do not attempt timeout michael@0: # test. (lth). michael@0: # michael@0: # michael@0: michael@0: OS_PLATFORM=`uname` michael@0: OBJDIR=`basename $PWD` michael@0: printf "\nNSPR Test Results - $OBJDIR\n\n" michael@0: printf "BEGIN\t\t\t`date`\n" michael@0: printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n" michael@0: printf "Test\t\t\tResult\n\n" michael@0: if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then michael@0: for prog in $TESTS michael@0: do michael@0: printf "$prog" michael@0: printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1 michael@0: ./$prog >> ${LOGFILE} 2>&1 michael@0: if [ 0 = $? ] ; then michael@0: printf "\t\t\tPassed\n"; michael@0: else michael@0: printf "\t\t\tFAILED\n"; michael@0: rval=1 michael@0: fi; michael@0: printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1 michael@0: done michael@0: else michael@0: for prog in $TESTS michael@0: do michael@0: printf "$prog" michael@0: printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1 michael@0: export test_rval michael@0: ./$prog >> ${LOGFILE} 2>&1 & michael@0: test_pid=$! michael@0: sleep_pid=0 michael@0: if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0 michael@0: then michael@0: (sleep $TEST_TIMEOUT; kill $test_pid >/dev/null 2>&1 ) & michael@0: sleep_pid=$! michael@0: fi michael@0: wait $test_pid michael@0: test_rval=$? michael@0: [ $sleep_pid -eq 0 ] || kill $sleep_pid >/dev/null 2>&1 michael@0: if [ 0 = $test_rval ] ; then michael@0: printf "\t\t\tPassed\n"; michael@0: else michael@0: printf "\t\t\tFAILED\n"; michael@0: rval=1 michael@0: fi; michael@0: printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1 michael@0: done michael@0: fi; michael@0: michael@0: printf "END\t\t\t`date`\n" michael@0: exit $rval michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: