Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Simple_Naming / process-m-output.pl
blob74275e3aa545a39558ba359bed17e0441ec3c1c6
1 # -*- perl -*-
2 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
3 & eval 'exec perl -S $0 $argv:q'
4 if 0;
6 # This is a Perl script that processes the output of the multithreaded
7 # client test. Usage: process-m-output.pl output-file-name number-of-threads
9 # The following checks are performed:
10 # 1) Number of sucessful binds equals to the number of sucessful
11 # unbinds.
12 # 2) Each thread id has 1 output line for each of the following: bind,
13 # resolve and unbind.
14 # 3) There are no unexpected output lines (e.g., more lines than
15 # expected or with unexpected content like Exceptions, seg faults).
17 # Open the output file.
18 $input_file = $ARGV[0];
19 if ($input_file and $ARGV[1])
21 open (DATA, $input_file);
23 else
25 die "Usage: process-m-output.pl output-file-name number-of-threads \n";
28 $errors = 0;
30 $binds = 0;
31 $unbinds = 0;
33 while ($line = <DATA>)
35 # Process the line.
36 chomp $line;
37 @words = split (/ /, $line);
39 # Ignore the empty line, the "CommandLine:" line and the "WARNING:" line
40 # from the orbsvcs/orbsvcs/Shutdown_Utilities.cpp.
41 if ($#words == -1 or
42 $words[0] eq "CommandLine:" or
43 $line =~ /WARNING: /) {
44 next;
47 # Make sure the line contains expected output.
48 if (not ($words[0] eq "Unbound" or
49 $words[0] eq "Bound" or
50 $words[0] eq "Resolved" or
51 $words[0] eq "Unable"))
53 close (DATA);
54 die "Error is detected in the output file <$input_file> \n";
57 # Keep track of sucessful binds/unbinds.
58 if ($words[0] eq "Bound")
60 ++$binds;
62 if ($words[0] eq "Unbound")
64 ++$unbinds;
67 # Keep track of output lines for each thread.
68 $count = $threads{$words[5]};
70 if ($count eq "" and
71 ($words[0] eq "Bound" or $words[2] eq "bind"))
73 ++$threads{$words[5]};
75 elsif ($count eq 1 and
76 ($words[0] eq "Resolved" or $words[2] eq "resolve"))
78 ++$threads{$words[5]};
80 elsif ($count eq 2 and
81 ($words[0] eq "Unbound" or $words[2] eq "unbind"))
83 ++$threads{$words[5]};
85 else
87 close (DATA);
88 die "Wrong output for thread $word[5]\n";
91 close (DATA);
92 # Check that each thread performed 3 operations.
93 if (grep {not $_ eq 3} values %threads)
95 die "Some thread has performed a wrong number of operations\n";
97 $number = values %threads;
98 if ($number ne $ARGV[1])
100 die "Not all threads performed operations\n";
103 # Check that number of binds equals to those of unbinds.
104 if ($binds == $unbinds)
106 print "Multithreaded output is ok \n";
108 else
110 print "Number of sucessfule binds is different from number of
111 sucessful unbinds\n";
114 exit $errors;