PageRenderTime 28ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/js/nsprpub/pr/tests/runtests.ksh

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