1$!
2$! Analyze bntest output file.
3$!
4$! Exit status = 1 (success) if all tests passed,
5$!               0 (warning) if any test failed.
6$!
7$! 2011-02-20 SMS.  Added code to skip "#" comments in the input file.
8$!
9$! 2010-04-05 SMS.  New.  Based (loosely) on perl code in bntest-vms.sh.
10$!
11$!                  Expect data like:
12$!                        test test_name1
13$!                        0
14$!                        [...]
15$!                        test test_name2
16$!                        0
17$!                        [...]
18$!                        [...]
19$!
20$!                  Some tests have no following "0" lines.
21$!
22$ result_file_name = f$edit( p1, "TRIM")
23$ if (result_file_name .eqs. "")
24$ then
25$     result_file_name = "bntest-vms.out"
26$ endif
27$!
28$ fail = 0
29$ passed = 0
30$ tests = 0
31$!
32$ on control_c then goto tidy
33$ on error then goto tidy
34$!
35$ open /read result_file 'result_file_name'
36$!
37$ read_loop:
38$     read /end = read_loop_end /error = tidy result_file line
39$     t1 = f$element( 0, " ", line)
40$!
41$!    Skip "#" comment lines.
42$     if (f$extract( 0, 1, f$edit( line, "TRIM")) .eqs. "#") then -
43       goto read_loop
44$!
45$     if (t1 .eqs. "test")
46$     then
47$         passed = passed+ 1
48$         tests = tests+ 1
49$         fail = 1
50$         t2 = f$extract( 5, 1000, line)
51$         write sys$output "verify ''t2'"
52$     else
53$         if (t1 .nes. "0")
54$         then
55$             write sys$output "Failed! bc: ''line'"
56$             passed = passed- fail
57$             fail = 0
58$         endif
59$     endif
60$ goto read_loop
61$ read_loop_end:
62$ write sys$output "''passed'/''tests' tests passed"
63$!
64$ tidy:
65$ if f$trnlnm( "result_file", "LNM$PROCESS_TABLE", , "SUPERVISOR", , "CONFINE")
66$ then
67$     close result_file
68$ endif
69$!
70$ if ((tests .gt. 0) .and. (tests .eq. passed))
71$ then
72$    exit 1
73$ else
74$    exit 0
75$ endif
76$!
77