runtests.sh 5.1 KB

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