PageRenderTime 68ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/src/ksh/api/tcm.ksh

#
Korn Shell | 734 lines | 480 code | 42 blank | 212 comment | 28 complexity | e7f4f8608d0593733f5aef5906bf59fa MD5 | raw file
  1. #
  2. # SCCS: @(#)tcm.ksh 1.6 (98/12/11)
  3. #
  4. # UniSoft Ltd., London, England
  5. #
  6. # (C) Copyright 1996 X/Open Company Limited
  7. #
  8. # All rights reserved. No part of this source code may be reproduced,
  9. # stored in a retrieval system, or transmitted, in any form or by any
  10. # means, electronic, mechanical, photocopying, recording or otherwise,
  11. # except as stated in the end-user licence agreement, without the prior
  12. # permission of the copyright owners.
  13. # A copy of the end-user licence agreement is contained in the file
  14. # Licence which accompanies this distribution.
  15. #
  16. # X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
  17. # the UK and other countries.
  18. #
  19. # ************************************************************************
  20. # Copyright 1990 Open Software Foundation (OSF)
  21. # Copyright 1990 Unix International (UI)
  22. # Copyright 1990 X/Open Company Limited (X/Open)
  23. # Copyright 1991 Hewlett-Packard Co. (HP)
  24. #
  25. # Permission to use, copy, modify, and distribute this software and its
  26. # documentation for any purpose and without fee is hereby granted, provided
  27. # that the above copyright notice appear in all copies and that both that
  28. # copyright notice and this permission notice appear in supporting
  29. # documentation, and that the name of HP, OSF, UI or X/Open not be used in
  30. # advertising or publicity pertaining to distribution of the software
  31. # without specific, written prior permission. HP, OSF, UI and X/Open make
  32. # no representations about the suitability of this software for any purpose.
  33. # It is provided "as is" without express or implied warranty.
  34. #
  35. # HP, OSF, UI and X/Open DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  36. # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  37. # EVENT SHALL HP, OSF, UI or X/Open BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  38. # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  39. # USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  40. # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  41. # PERFORMANCE OF THIS SOFTWARE.
  42. #
  43. # ***********************************************************************
  44. #
  45. # SCCS: @(#)tcm.sh 1.9 03/09/92
  46. # NAME: Shell Test Case Manager
  47. # PRODUCT: TET (Test Environment Toolkit)
  48. # as supplied with TETware release 3.3
  49. # AUTHOR: Andrew Dingwall, UniSoft Ltd.
  50. # DATE CREATED: 1 November 1990
  51. #
  52. # DESCRIPTION:
  53. # This file contains the support routines for the sequencing and control
  54. # of invocable components and test purposes.
  55. # It should be sourced (by means of the shell . command) into a shell
  56. # script containing definitions of the invocable components and test
  57. # purposes that may be executed, after those definitions have been made.
  58. # Test purposes may be written as shell functions or executable
  59. # shell scripts.
  60. #
  61. # This file sources tetapi.sh which contains the shell API functions.
  62. # Test purposes written as separate shell scripts must also source
  63. # tetapi.sh in order to use those functions.
  64. #
  65. # The user-supplied shell variable iclist should contain a list of all
  66. # the invocable components in the testset;
  67. # these are named ic1, ic2 ... etc.
  68. # For each invocable component thus specified, the user should define
  69. # a variable whose name is the same as that of the component.
  70. # Each such variable should contain the names of the test purposes
  71. # associated with each invocable component; for example:
  72. # iclist="ic1 ic2"
  73. # ic1="test1-1 test1-2 test1-3"
  74. # ic2="test2-1 test2-2"
  75. #
  76. # The NUMBERS of the invocable components to be executed are specified
  77. # on the command line.
  78. # In addition, the user may define the variables tet_startup and
  79. # tet_cleanup; if defined, the related functions (or shell scripts)
  80. # are executed at the start and end of processing, respectively.
  81. #
  82. # The TCM makes the NAME of the currently executing test purpose
  83. # available in the environment variable tet_thistest.
  84. #
  85. # The TCM reads configuration variables from the file specified by the
  86. # TET_CONFIG environment variable; these are placed in the environment
  87. # and marked as readonly.
  88. #
  89. # MODIFICATIONS:
  90. #
  91. # Geoff Clare, 11 Oct 1991
  92. # Replace signal lists with markers to be edited by make INSTALL.
  93. # Remove local TET_VERSION to avoid conflict with env. variable.
  94. #
  95. # Kevin Currey Friday, November 15, 1991
  96. # For HP-PA OSF/1 and Domain/OS and HP-UX
  97. # converted to ksh bindings
  98. # Thursday, December 12, 1991
  99. # enhanced tet_setsigs functionality
  100. # Wednesday, July 20, 1992
  101. # added exec to make sure tests do not grap TCM's stdin
  102. # Thursday, October 8, 1992
  103. # fixed {1-3,5-7} scenario bug
  104. #
  105. # Geoff Clare, 29 Jan 1992
  106. # Implement TET_TRAP_FUNCTION in place of tet_setsigs(), and
  107. # TET_DEFAULT_SIGS in place of tet_defaultsigs().
  108. #
  109. # Andrew Josey, UNIX System Labs. Inc. October 1993
  110. # ETET 1.10.2 Update. Add TET_NSIG_NUM to allow NSIG to
  111. # be set in the makefile. Other ETET enhancements are
  112. # in TP numbering and in journal path handling.
  113. #
  114. # Andrew Josey, UNIX System Labs. Inc. November 1993.
  115. # ETET1.10.2'. Bug fix to tet_xres handling.
  116. #
  117. # Andrew Josey, UNIX System Labs. Inc. January 1994.
  118. # ETET1.10.2 Patch level 4. Further bug fixes for
  119. # xpg3sh binding compatibility (jss@apollo.hp.com).
  120. #
  121. # Andrew Josey, Novell UNIX System Labs, February 1994
  122. # Bug fix as per xpg3sh/api. It was possible for grep -s
  123. # to produce unwanted output in some situations.
  124. # Also add support for TET_EXTENDED=T/F
  125. #
  126. # Andrew Josey, Novell UNIX System Labs, March 1994
  127. # Increment TET_VERSION to 1.10.3
  128. #
  129. # Geoff Clare, UniSoft Ltd., 3 Sept 1996
  130. # Improved (all-builtin) TP number calculations.
  131. # Only give non-existent IC message for requested IC numbers (not
  132. # for ICs executed via an "all" in the IC list).
  133. #
  134. # Andrew Dingwall, UniSoft Ltd., October 1996
  135. # Port to NT
  136. #
  137. # Andrew Dingwall, UniSoft Ltd., June 1998
  138. # Use an absolute path name for the TET_PRIVATE_TMP directory so as
  139. # to avoid problems if a TP changes directory to somewhere else.
  140. #
  141. # Andrew Dingwall, UniSoft Ltd., July 1998
  142. # Updated to support versions of ksh which interpret numbers
  143. # starting with 0 and 0x as octal and hex numbers.
  144. # Note that specifying an IC number with a leading 0 won't work
  145. # in this type of shell.
  146. #
  147. # Andrew Dingwall, UniSoft Ltd., December 1998
  148. # Work around a "feature" of ksh93 whereby use of a file
  149. # descriptor in a child shell (i.e., in a sequence of commands
  150. # enclosed in parentheses) changes the file descriptor's disposition
  151. # in the parent shell as well.
  152. # This was causing problems with "exec 3< file; read -u3 ..."
  153. # in the TCM when the test case also used fd 3.
  154. #
  155. # ***********************************************************************
  156. if let TET_XXXXX=1
  157. then unset TET_XXXXX
  158. else echo "ERROR: this is not a Korn Shell"
  159. exit 2
  160. fi
  161. #
  162. # TCM signal definitions
  163. #
  164. # The XXX_SIGNAL_LIST markers are replaced with proper lists by make INSTALL
  165. #
  166. # standard signals - may not be specified in TET_SIG_IGN and TET_SIG_LEAVE
  167. TET_STD_SIGNALS="STD_SIGNAL_LIST"
  168. # signals that are always unhandled
  169. TET_SPEC_SIGNALS="SPEC_SIGNAL_LIST"
  170. ## TET_EXTENDED
  171. if [ "$TET_EXTENDED" != "" ] ; then
  172. TET_EXTENDED=`echo $TET_EXTENDED|tr "[a-z]" "[A-Z]"|cut -c1`
  173. fi
  174. #
  175. # TCM global variables
  176. #
  177. tet_thistest=""; export tet_thistest
  178. #
  179. # "private" TCM variables
  180. #
  181. TET_CWD=`pwd`
  182. TET_OSNAME=`uname -s`; readonly TET_OSNAME; export TET_OSNAME
  183. #start ETET additions
  184. TET_HOSTNAME=`uname -n`
  185. # work out where we should put private data files -
  186. # if TET_TMP_DIR specifies a full path name, we create the private
  187. # temporary directory below there;
  188. # otherwise, we must create it in the current directory
  189. # (we perform this check because TET_TMP_DIR isn't a communication variable
  190. # and thus isn't guaranteed to be a full path name)
  191. case $TET_OSNAME in
  192. Windows_NT|Windows_95|DOS)
  193. case "$TET_TMP_DIR" in
  194. [A-Za-z]:/*|[A-Za-z]:\\*)
  195. TET_PTMP_PATH=$TET_TMP_DIR
  196. ;;
  197. *)
  198. TET_PTMP_PATH=$TET_CWD
  199. ;;
  200. esac
  201. ;;
  202. *)
  203. case "$TET_TMP_DIR" in
  204. /*)
  205. TET_PTMP_PATH=$TET_TMP_DIR
  206. ;;
  207. *)
  208. TET_PTMP_PATH=$TET_CWD
  209. ;;
  210. esac
  211. ;;
  212. esac
  213. TET_PRIVATE_TMP=$TET_PTMP_PATH/${TET_HOSTNAME}$$; readonly TET_PRIVATE_TMP
  214. export TET_PRIVATE_TMP
  215. rm -rf $TET_PRIVATE_TMP
  216. mkdir $TET_PRIVATE_TMP
  217. if [ $? != 0 ]; then
  218. echo Cannot Make temporary directory
  219. exit 1
  220. fi
  221. TET_DELETES=$TET_PRIVATE_TMP/tet_deletes; readonly TET_DELETES; export TET_DELETES
  222. TET_RESFILE=$TET_CWD/tet_xres; readonly TET_RESFILE; export TET_RESFILE
  223. TET_STDERR=$TET_PRIVATE_TMP/tet_stderr; readonly TET_STDERR; export TET_STDERR
  224. TET_TESTS=$TET_PRIVATE_TMP/tet_tests; readonly TET_TESTS
  225. TET_TMPRES=$TET_PRIVATE_TMP/tet_tmpres; readonly TET_TMPRES; export TET_TMPRES
  226. #end ETET additions
  227. TET_BLOCK=0; export TET_BLOCK
  228. TET_CONTEXT=0; export TET_CONTEXT
  229. TET_EXITVAL=0
  230. TET_SEQUENCE=0; export TET_SEQUENCE
  231. TET_TPCOUNT=0; export TET_TPCOUNT
  232. TET_TPNUMBER=0; export TET_TPNUMBER
  233. TET_TMP1=$TET_PRIVATE_TMP/tet1.$$
  234. TET_TMP2=$TET_PRIVATE_TMP/tet2.$$
  235. # ***********************************************************************
  236. #
  237. # "private" TCM date and tr functions
  238. #
  239. # initialize $SECONDS
  240. TET_date1=`date`
  241. TET_temp=${TET_date1%??:??:??*}
  242. TET_date1=${TET_date1#$TET_temp}
  243. TET_temp=${TET_date1#??:??:??}
  244. TET_date1=${TET_date1%$TET_temp}
  245. TET_h1=${TET_date1%:??:??}
  246. TET_s1=${TET_date1#??:??:}
  247. TET_m1=${TET_date1#$TET_h1:}
  248. TET_m1=${TET_m1%:$TET_s1}
  249. let SECONDS=TET_s1+60*TET_m1+3600*TET_h1
  250. typeset -RZ2 TET_h1 TET_m1 TET_s1
  251. # update $TET_DATE using $SECONDS
  252. tet_getdate(){
  253. let TET_s1=SECONDS%60
  254. let TET_m1=SECONDS/60%60
  255. let TET_h1=SECONDS/3600%24
  256. TET_DATE=${TET_h1}:${TET_m1}:$TET_s1
  257. }
  258. #
  259. # this function emulates the command tr for simple substitutions
  260. # Usage: ksh_tr $1 $2 $3
  261. # where ksh_tr substitutes $2 for $1 in $3
  262. #
  263. tet_ksh_tr(){
  264. unset TET_out
  265. TET_in=$3
  266. TET_token=${TET_in%%$1*}
  267. while test ${#TET_token} -ne ${#TET_in}
  268. do
  269. TET_in=${TET_in##${TET_token}$1}
  270. TET_out=${TET_out}${TET_token}$2
  271. TET_token=${TET_in%%$1*}
  272. done
  273. TET_out=${TET_out}$TET_in
  274. print -R "$TET_out"
  275. }
  276. #
  277. # "private" TCM function definitions
  278. # these interfaces may go away one day
  279. #
  280. # tet_ismember - return 0 if $1 is in the set $2 ...
  281. # otherwise return 1
  282. tet_ismember(){
  283. TET_X=${1:?}
  284. shift
  285. for TET_Y in $*
  286. do
  287. if test $(( 0 + $TET_X )) -eq $TET_Y
  288. then
  289. TET_MEMBER=$TET_Y
  290. return 0
  291. fi
  292. done
  293. return 1
  294. }
  295. # tet_abandon - signal handler used during startup and cleanup
  296. tet_abandon(){
  297. TET_CAUGHTSIG=$1
  298. if test 15 -eq ${TET_CAUGHTSIG:?}
  299. then
  300. tet_sigterm $TET_CAUGHTSIG
  301. else
  302. tet_error "Abandoning testset: caught unexpected signal $TET_CAUGHTSIG"
  303. fi
  304. TET_EXITVAL=$TET_CAUGHTSIG exit
  305. }
  306. # tet_sigterm - signal handler for SIGTERM
  307. tet_sigterm(){
  308. TET_CAUGHTSIG=$1
  309. tet_error "Abandoning test case: received signal ${TET_CAUGHTSIG:?}"
  310. tet_docleanup
  311. TET_EXITVAL=$TET_CAUGHTSIG exit
  312. }
  313. # tet_sigskip - signal handler used during test execution
  314. tet_sigskip(){
  315. TET_CAUGHTSIG=$1
  316. tet_infoline "unexpected signal ${TET_CAUGHTSIG:?} received"
  317. tet_result UNRESOLVED
  318. if test 15 -eq ${TET_CAUGHTSIG:?}
  319. then
  320. tet_sigterm $TET_CAUGHTSIG
  321. else
  322. continue
  323. fi
  324. }
  325. # tet_tpend - report on a test purpose
  326. tet_tpend(){
  327. TET_TPARG1=${1:?}
  328. TET_RESULT=
  329. while read TET_NEXTRES
  330. do
  331. if test -z "$TET_RESULT"
  332. then
  333. TET_RESULT="$TET_NEXTRES"
  334. continue
  335. fi
  336. case "$TET_NEXTRES" in
  337. PASS)
  338. ;;
  339. FAIL)
  340. TET_RESULT="$TET_NEXTRES"
  341. ;;
  342. UNRESOLVED|UNINITIATED)
  343. if test FAIL != "$TET_RESULT"
  344. then
  345. TET_RESULT="$TET_NEXTRES"
  346. fi
  347. ;;
  348. NORESULT)
  349. if test FAIL != "$TET_RESULT" -a \
  350. UNRESOLVED != "$TET_RESULT" -a \
  351. UNINITIATED != "$TET_RESULT"
  352. then
  353. TET_RESULT="$TET_NEXTRES"
  354. fi
  355. ;;
  356. UNSUPPORTED|NOTINUSE|UNTESTED)
  357. if test PASS = "$TET_RESULT"
  358. then
  359. TET_RESULT="$TET_NEXTRES"
  360. fi
  361. ;;
  362. *)
  363. if test PASS = "$TET_RESULT" -o \
  364. UNSUPPORTED = "$TET_RESULT" -o \
  365. NOTINUSE = "$TET_RESULT" -o \
  366. UNTESTED = "$TET_RESULT"
  367. then
  368. TET_RESULT="$TET_NEXTRES"
  369. fi
  370. ;;
  371. esac
  372. done < $TET_TMPRES
  373. TET_RESULT=$TET_RESULT
  374. > $TET_TMPRES
  375. TET_ABORT=NO
  376. if test -z "$TET_RESULT"
  377. then
  378. TET_RESULT=NORESULT
  379. TET_RESNUM=7
  380. elif tet_getcode "$TET_RESULT" # sets TET_RESNUM, TET_ABORT
  381. then
  382. : ok
  383. else
  384. TET_RESULT="NO RESULT NAME"
  385. TET_RESNUM=-1
  386. fi
  387. tet_getdate
  388. tet_output 220 "$TET_TPARG1 $TET_RESNUM $TET_DATE" "$TET_RESULT"
  389. if test YES = "$TET_ABORT"
  390. then
  391. TET_TRAP_FUNCTION=tet_abandon
  392. tet_output 510 "" \
  393. "ABORT on result code $TET_RESNUM \"$TET_RESULT\""
  394. if test -n "$tet_cleanup"
  395. then
  396. tet_docleanup
  397. fi
  398. TET_EXITVAL=1 exit
  399. fi
  400. }
  401. # tet_docleanup - execute the tet_cleanup function
  402. tet_docleanup(){
  403. tet_thistest=
  404. TET_TPCOUNT=0
  405. TET_BLOCK=0
  406. tet_setblock
  407. eval $tet_cleanup
  408. }
  409. # ***********************************************************************
  410. # read in API functions
  411. . ${TET_ROOT:?}/lib/ksh/tetapi.ksh
  412. # ***********************************************************************
  413. #
  414. # TCM main flow
  415. #
  416. # capture command line args before they disappear
  417. TET_TCM_ARGC=$#
  418. TET_TCM_ARGS="$*"
  419. TET_PNAME="$0"; readonly TET_PNAME; export TET_PNAME
  420. # arrange to clean up on exit
  421. unset TET_TMPFILES
  422. trap 'exit 1' 1 2 3 15
  423. trap 'rm -f $TET_TMPFILES; rm -rf $TET_PRIVATE_TMP; exit $TET_EXITVAL' 0
  424. # open execution results file
  425. umask 0; rm -f $TET_RESFILE $TET_DELETES $TET_STDERR $TET_TESTS $TET_TMP1 $TET_TMPRES; > $TET_RESFILE
  426. if [ -s $TET_RESFILE ]
  427. then TET_EXITVAL=1; exit 1
  428. fi
  429. # open other local files
  430. for TET_A in $TET_DELETES $TET_STDERR $TET_TESTS \
  431. $TET_TMP1 $TET_TMPRES
  432. do
  433. TET_TMPFILES=${TET_TMPFILES}' '$TET_A
  434. > $TET_A
  435. done
  436. # read in configuration variables and make them readonly
  437. # strip comments and other non-variable assignments
  438. # protect embedded spaces and single quotes in the value part
  439. if test -n "$TET_CONFIG"
  440. then
  441. if test ! -r "$TET_CONFIG"
  442. then
  443. tet_error "can't read config file" $TET_CONFIG
  444. else
  445. while read TET_line
  446. do
  447. TET_nline=${TET_line%%\#*}
  448. if test ${#TET_nline} -ne 0
  449. then readonly "$TET_nline"
  450. fi
  451. done < $TET_CONFIG
  452. fi
  453. fi
  454. # set current context to process ID
  455. tet_setcontext
  456. # set up default results code file if so required
  457. if test ! -r ${TET_CODE:=tet_code}
  458. then
  459. if test tet_code != "$TET_CODE"
  460. then
  461. tet_error "could not open results code file" \"$TET_CODE\"
  462. fi
  463. TET_TMPFILES=${TET_TMPFILES}' '$TET_TMP2
  464. echo "
  465. 0 PASS Continue
  466. 1 FAIL Continue
  467. 2 UNRESOLVED Continue
  468. 3 NOTINUSE Continue
  469. 4 UNSUPPORTED Continue
  470. 5 UNTESTED Continue
  471. 6 UNINITIATED Continue
  472. 7 NORESULT Continue" > $TET_TMP2
  473. TET_CODE=$TET_TMP2
  474. fi
  475. # determine the full path name of the results code file
  476. case $TET_OSNAME in
  477. Windows_NT|Windows_95|DOS)
  478. case $TET_CODE in
  479. [A-Za-z]:/*)
  480. ;;
  481. *)
  482. TET_CODE=`pwd`/$TET_CODE
  483. ;;
  484. esac
  485. ;;
  486. *)
  487. case $TET_CODE in
  488. /*)
  489. ;;
  490. *)
  491. TET_CODE=`pwd`/$TET_CODE
  492. ;;
  493. esac
  494. ;;
  495. esac
  496. readonly TET_CODE; export TET_CODE
  497. # process command-line args
  498. if test 1 -gt $TET_TCM_ARGC
  499. then
  500. TET_TCM_ARGS=all
  501. fi
  502. TET_ICLAST=-1
  503. TET_ICLIST=$(tet_ksh_tr ic "" "$iclist")
  504. : ${TET_ICLIST:=0}
  505. TET_ICLIST=$(print $TET_ICLIST)
  506. TET_ICFIRST_DEF=${TET_ICLIST%%\ *}
  507. for TET_A in $(tet_ksh_tr , " " "$TET_TCM_ARGS")
  508. do
  509. case $TET_A in
  510. all*)
  511. if test 0 -ge $TET_ICLAST
  512. then
  513. TET_ICFIRST=$TET_ICFIRST_DEF
  514. for TET_B in $TET_ICLIST
  515. do
  516. if test $TET_B -le $TET_ICFIRST
  517. then
  518. TET_ICFIRST=$TET_B
  519. fi
  520. done
  521. else
  522. let TET_ICFIRST=TET_ICLAST+1
  523. fi
  524. TET_ICLAST=$TET_ICFIRST
  525. for TET_B in $TET_ICLIST
  526. do
  527. if test $TET_B -gt $TET_ICLAST
  528. then
  529. TET_ICLAST=$TET_B
  530. fi
  531. done
  532. if test $TET_ICLAST -gt ${TET_B:=0}
  533. then
  534. TET_ICLAST=$TET_B
  535. fi
  536. ;;
  537. *)
  538. TET_ICFIRST=${TET_A%%-*}
  539. TET_ICLAST=${TET_A##*-}
  540. if [ X$TET_ICFIRST = X$TET_ICLAST ]
  541. then TET_ICLAST=
  542. fi
  543. ;;
  544. esac
  545. TET_ICNO=${TET_ICFIRST:-$TET_ICFIRST_DEF}
  546. while test $TET_ICNO -le ${TET_ICLAST:=$TET_ICNO}
  547. do
  548. if tet_ismember $TET_ICNO $TET_ICLIST
  549. then
  550. test -n "`eval echo \\${ic$TET_MEMBER}`" && \
  551. echo ic$TET_MEMBER
  552. else
  553. # only report if the IC was requested
  554. case $TET_A in
  555. all*) ;;
  556. *) tet_error "IC $TET_ICNO is not defined" \
  557. "for this test case"
  558. esac
  559. fi
  560. let TET_ICNO=TET_ICNO+1
  561. done >> $TET_TESTS
  562. done
  563. TET_ICCOUNT=0
  564. while read -r TET_line
  565. do
  566. let TET_ICCOUNT=TET_ICCOUNT+1
  567. done < $TET_TESTS
  568. # print startup message to execution results file
  569. tet_output 15 "3.3 $TET_ICCOUNT" "TCM Start"
  570. # do initial signal list processing
  571. if test $(( ${#TET_SIG_LEAVE} + ${#TET_SIG_IGN} )) -eq 0
  572. then print TET_SIG_LEAVE2=\"\\n\"\\nTET_SIG_IGN2=\"\\n\" > $TET_TMP1
  573. else for TET_A in TET_SIG_LEAVE TET_SIG_IGN
  574. do
  575. echo ${TET_A}2=\"
  576. eval TET_temp="\$$TET_A"
  577. tet_ksh_tr , "
  578. " "$TET_temp" | while read TET_B TET_JUNK
  579. do
  580. if test -z "$TET_B"
  581. then
  582. continue
  583. elif tet_ismember $TET_B $TET_STD_SIGNALS $TET_SPEC_SIGNALS
  584. then
  585. tet_error "warning: illegal entry $TET_B" \
  586. "in $TET_A ignored"
  587. else
  588. echo $TET_B
  589. fi
  590. done
  591. echo \"
  592. done > $TET_TMP1
  593. fi
  594. . $TET_TMP1
  595. TET_SIG_LEAVE2="$TET_SIG_LEAVE2 $TET_SPEC_SIGNALS"
  596. TET_A=1
  597. if [ -z "$TET_NSIG" ] ; then
  598. TET_NSIG=TET_NSIG_NUM; export TET_NSIG
  599. fi
  600. TET_TRAP_FUNCTION=tet_abandon
  601. TET_DEFAULT_SIGS=
  602. while test $TET_A -lt $TET_NSIG
  603. do
  604. if tet_ismember $TET_A $TET_SIG_LEAVE2
  605. then
  606. :
  607. elif tet_ismember $TET_A $TET_SIG_IGN2
  608. then
  609. trap "" $TET_A
  610. else
  611. trap "trap \"\" $TET_A; \$TET_TRAP_FUNCTION $TET_A" $TET_A
  612. TET_DEFAULT_SIGS="$TET_DEFAULT_SIGS $TET_A"
  613. fi
  614. let TET_A=TET_A+1
  615. done
  616. # calculate starting TP number for each IC
  617. TET_A=
  618. for TET_B in $TET_ICLIST
  619. do
  620. # TET_A holds concatenation of TP lists for all previous ICs
  621. set -- $TET_A
  622. eval TET_TP_ADDNUM_$TET_B=$#
  623. eval TET_A=\"\$TET_A \$ic$TET_B\"
  624. done
  625. # do startup processing
  626. eval $tet_startup
  627. # do main loop processing
  628. for TET_ICNAME in `cat $TET_TESTS`
  629. do
  630. eval TET_TPLIST=\"\$$TET_ICNAME\"
  631. TET_ICNUMBER=${TET_ICNAME##?[!0123456789]}
  632. let TET_TPCOUNT=0
  633. for TET_temp in $TET_TPLIST
  634. do
  635. let TET_TPCOUNT=TET_TPCOUNT+1
  636. done
  637. tet_getdate
  638. tet_output 400 "$TET_ICNUMBER $TET_TPCOUNT $TET_DATE" "IC Start"
  639. TET_TPCOUNT=0
  640. for tet_thistest in $TET_TPLIST
  641. do
  642. let TET_TPCOUNT=TET_TPCOUNT+1
  643. eval let TET_TPNUMBER=TET_TP_ADDNUM_${TET_ICNUMBER}+TET_TPCOUNT
  644. # this forces BLOCK and SEQUENCE to 1
  645. TET_CONTEXT=0
  646. tet_setcontext
  647. tet_getdate
  648. tet_output 200 "$TET_TPNUMBER $TET_DATE" "TP Start"
  649. # > $TET_TMPRES
  650. TET_REASON="`tet_reason $tet_thistest`"
  651. if test $? -eq 0
  652. then
  653. tet_infoline "$TET_REASON"
  654. tet_result UNINITIATED
  655. else
  656. TET_TRAP_FUNCTION=tet_sigskip
  657. (
  658. trap $TET_DEFAULT_SIGS
  659. unset TET_DEFAULT_SIGS
  660. "$tet_thistest"
  661. )
  662. fi
  663. tet_tpend $TET_TPNUMBER
  664. done
  665. TET_TPNUMBER=0
  666. tet_getdate
  667. tet_output 410 "$TET_ICNUMBER $TET_TPCOUNT $TET_DATE" "IC End"
  668. done
  669. # do cleanup processing
  670. TET_TRAP_FUNCTION=tet_abandon
  671. if test -n "$tet_cleanup"
  672. then
  673. tet_docleanup
  674. fi
  675. # successful exit
  676. TET_EXITVAL=0 exit