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