Update copyright notices with scripts/update-copyrights
[glibc.git] / math / gen-libm-test.pl
blobd5fb278d413dbbf0e03ad7a8492ca9a4fad8c4f2
1 #!/usr/bin/perl -w
2 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4 # Contributed by Andreas Jaeger <aj@suse.de>, 1999.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
20 # This file needs to be tidied up
21 # Note that functions and tests share the same namespace.
23 # Information about tests are stored in: %results
24 # $results{$test}{"kind"} is either "fct" or "test" and flags whether this
25 # is a maximal error of a function or a single test.
26 # $results{$test}{"type"} is the result type, e.g. normal or complex.
27 # $results{$test}{"has_ulps"} is set if deltas exist.
28 # In the following description $type and $float are:
29 # - $type is either "normal", "real" (for the real part of a complex number)
30 # or "imag" (for the imaginary part # of a complex number).
31 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
32 # It represents the underlying floating point type (float, double or long
33 # double) and if inline functions (the leading i stands for inline)
34 # are used.
35 # $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
38 use Getopt::Std;
40 use strict;
42 use vars qw ($input $output $auto_input);
43 use vars qw (%results);
44 use vars qw (%beautify @all_floats);
45 use vars qw ($output_dir $ulps_file);
46 use vars qw (%auto_tests);
48 # all_floats is sorted and contains all recognised float types
49 @all_floats = ('double', 'float', 'idouble',
50 'ifloat', 'ildouble', 'ldouble');
52 %beautify =
53 ( "minus_zero" => "-0",
54 "plus_zero" => "+0",
55 "-0x0p+0f" => "-0",
56 "-0x0p+0" => "-0",
57 "-0x0p+0L" => "-0",
58 "0x0p+0f" => "+0",
59 "0x0p+0" => "+0",
60 "0x0p+0L" => "+0",
61 "minus_infty" => "-inf",
62 "plus_infty" => "inf",
63 "qnan_value" => "qNaN",
67 # get Options
68 # Options:
69 # u: ulps-file
70 # h: help
71 # o: output-directory
72 # n: generate new ulps file
73 use vars qw($opt_u $opt_h $opt_o $opt_n);
74 getopts('u:o:nh');
76 $ulps_file = 'libm-test-ulps';
77 $output_dir = '';
79 if ($opt_h) {
80 print "Usage: gen-libm-test.pl [OPTIONS]\n";
81 print " -h print this help, then exit\n";
82 print " -o DIR directory where generated files will be placed\n";
83 print " -n only generate sorted file NewUlps from libm-test-ulps\n";
84 print " -u FILE input file with ulps\n";
85 exit 0;
88 $ulps_file = $opt_u if ($opt_u);
89 $output_dir = $opt_o if ($opt_o);
91 $input = "libm-test.inc";
92 $auto_input = "auto-libm-test-out";
93 $output = "${output_dir}libm-test.c";
95 &parse_ulps ($ulps_file);
96 &parse_auto_input ($auto_input);
97 &generate_testfile ($input, $output) unless ($opt_n);
98 &output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
99 &print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
101 # Return a nicer representation
102 sub beautify {
103 my ($arg) = @_;
104 my ($tmp);
106 if (exists $beautify{$arg}) {
107 return $beautify{$arg};
109 if ($arg =~ /^-/) {
110 $tmp = $arg;
111 $tmp =~ s/^-//;
112 if (exists $beautify{$tmp}) {
113 return '-' . $beautify{$tmp};
116 if ($arg =~ /^-?0x[0-9a-f.]*p[-+][0-9]+f$/) {
117 $arg =~ s/f$//;
119 if ($arg =~ /[0-9]L$/) {
120 $arg =~ s/L$//;
122 return $arg;
125 # Return a nicer representation of a complex number
126 sub build_complex_beautify {
127 my ($r, $i) = @_;
128 my ($str1, $str2);
130 $str1 = &beautify ($r);
131 $str2 = &beautify ($i);
132 if ($str2 =~ /^-/) {
133 $str2 =~ s/^-//;
134 $str1 .= ' - ' . $str2;
135 } else {
136 $str1 .= ' + ' . $str2;
138 $str1 .= ' i';
139 return $str1;
142 # Return the text to put in an initializer for a test's exception
143 # information.
144 sub show_exceptions {
145 my ($ignore_result, $exception) = @_;
146 $ignore_result = ($ignore_result ? "IGNORE_RESULT|" : "");
147 if (defined $exception) {
148 return ", ${ignore_result}$exception";
149 } else {
150 return ", ${ignore_result}0";
154 # Parse the arguments to TEST_x_y
155 sub parse_args {
156 my ($file, $descr, $args) = @_;
157 my (@args, $descr_args, $descr_res, @descr);
158 my ($current_arg, $cline, $i);
159 my (@special);
160 my ($call_args);
161 my ($ignore_result_any, $ignore_result_all);
163 ($descr_args, $descr_res) = split /_/,$descr, 2;
165 @args = split /,\s*/, $args;
167 $call_args = "";
169 # Generate first the string that's shown to the user
170 $current_arg = 1;
171 @descr = split //,$descr_args;
172 for ($i = 0; $i <= $#descr; $i++) {
173 my $comma = "";
174 if ($current_arg > 1) {
175 $comma = ', ';
177 # FLOAT, int, long int, long long int
178 if ($descr[$i] =~ /f|i|l|L/) {
179 $call_args .= $comma . &beautify ($args[$current_arg]);
180 ++$current_arg;
181 next;
183 # &FLOAT, &int - simplify call by not showing argument.
184 if ($descr[$i] =~ /F|I/) {
185 next;
187 # complex
188 if ($descr[$i] eq 'c') {
189 $call_args .= $comma . &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
190 $current_arg += 2;
191 next;
194 die ("$descr[$i] is unknown");
197 # Result
198 @descr = split //,$descr_res;
199 foreach (@descr) {
200 if ($_ =~ /f|i|l|L/) {
201 ++$current_arg;
202 } elsif ($_ eq 'c') {
203 $current_arg += 2;
204 } elsif ($_ eq 'b') {
205 # boolean
206 ++$current_arg;
207 } elsif ($_ eq '1') {
208 ++$current_arg;
209 } else {
210 die ("$_ is unknown");
213 # consistency check
214 if ($current_arg == $#args) {
215 die ("wrong number of arguments")
216 unless ($args[$current_arg] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL_TEST/);
217 } elsif ($current_arg < $#args) {
218 die ("wrong number of arguments");
219 } elsif ($current_arg > ($#args+1)) {
220 die ("wrong number of arguments");
224 # Put the C program line together
225 # Reset some variables to start again
226 $current_arg = 1;
227 $cline = "{ \"$call_args\"";
228 @descr = split //,$descr_args;
229 for ($i=0; $i <= $#descr; $i++) {
230 # FLOAT, int, long int, long long int
231 if ($descr[$i] =~ /f|i|l|L/) {
232 $cline .= ", $args[$current_arg]";
233 $current_arg++;
234 next;
236 # &FLOAT, &int
237 if ($descr[$i] =~ /F|I/) {
238 next;
240 # complex
241 if ($descr[$i] eq 'c') {
242 $cline .= ", $args[$current_arg], $args[$current_arg+1]";
243 $current_arg += 2;
244 next;
248 @descr = split //,$descr_res;
249 $ignore_result_any = 0;
250 $ignore_result_all = 1;
251 foreach (@descr) {
252 if ($_ =~ /b|f|i|l|L/ ) {
253 my ($result) = $args[$current_arg];
254 if ($result eq "IGNORE") {
255 $ignore_result_any = 1;
256 $result = "0";
257 } else {
258 $ignore_result_all = 0;
260 $cline .= ", $result";
261 $current_arg++;
262 } elsif ($_ eq 'c') {
263 my ($result1) = $args[$current_arg];
264 if ($result1 eq "IGNORE") {
265 $ignore_result_any = 1;
266 $result1 = "0";
267 } else {
268 $ignore_result_all = 0;
270 my ($result2) = $args[$current_arg + 1];
271 if ($result2 eq "IGNORE") {
272 $ignore_result_any = 1;
273 $result2 = "0";
274 } else {
275 $ignore_result_all = 0;
277 $cline .= ", $result1, $result2";
278 $current_arg += 2;
279 } elsif ($_ eq '1') {
280 push @special, $args[$current_arg];
281 ++$current_arg;
284 if ($ignore_result_any && !$ignore_result_all) {
285 die ("some but not all function results ignored\n");
287 # Add exceptions.
288 $cline .= show_exceptions ($ignore_result_any,
289 ($current_arg <= $#args)
290 ? $args[$current_arg]
291 : undef);
293 # special treatment for some functions
294 $i = 0;
295 foreach (@special) {
296 ++$i;
297 my ($extra_expected) = $_;
298 my ($run_extra) = ($extra_expected ne "IGNORE" ? 1 : 0);
299 if (!$run_extra) {
300 $extra_expected = "0";
302 $cline .= ", $run_extra, $extra_expected";
304 print $file " $cline },\n";
307 # Convert a condition from auto-libm-test-out to C form.
308 sub convert_condition {
309 my ($cond) = @_;
310 my (@conds, $ret);
311 @conds = split /:/, $cond;
312 foreach (@conds) {
313 s/-/_/g;
314 s/^/TEST_COND_/;
316 $ret = join " && ", @conds;
317 return "($ret)";
320 # Return text to OR a value into an accumulated flags string.
321 sub or_value {
322 my ($cond) = @_;
323 if ($cond eq "0") {
324 return "";
325 } else {
326 return " | $cond";
330 # Return text to OR a conditional expression between two values into
331 # an accumulated flags string.
332 sub or_cond_value {
333 my ($cond, $if, $else) = @_;
334 if ($cond eq "1") {
335 return or_value ($if);
336 } elsif ($cond eq "0") {
337 return or_value ($else);
338 } else {
339 return or_value ("($cond ? $if : $else)");
343 # Generate libm-test.c
344 sub generate_testfile {
345 my ($input, $output) = @_;
347 open INPUT, $input or die ("Can't open $input: $!");
348 open OUTPUT, ">$output" or die ("Can't open $output: $!");
350 # Replace the special macros
351 while (<INPUT>) {
352 # AUTO_TESTS (function, mode),
353 if (/^\s*AUTO_TESTS_/) {
354 my ($descr, $func, $mode, $auto_test, $num_auto_tests);
355 ($descr, $func, $mode) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+),\s*(\w+)\)/);
356 $num_auto_tests = 0;
357 foreach $auto_test (sort keys %{$auto_tests{$func}{$mode}}) {
358 my ($finputs, $format, $inputs, $outputs, $flags);
359 my ($format_conv, $flags_conv, @flags, %flag_cond);
360 $num_auto_tests++;
361 ($finputs, $outputs, $flags) = split / : */, $auto_test;
362 ($format, $inputs) = split / /, $finputs, 2;
363 $inputs =~ s/ /, /g;
364 $outputs =~ s/ /, /g;
365 $format_conv = convert_condition ($format);
366 print OUTPUT "#if $format_conv\n";
367 @flags = split / /, $flags;
368 foreach (@flags) {
369 if (/^([^:]*):(.*)$/) {
370 my ($flag, $cond);
371 $flag = $1;
372 $cond = convert_condition ($2);
373 if (defined ($flag_cond{$flag})) {
374 if ($flag_cond{$flag} ne "1") {
375 $flag_cond{$flag} .= " || $cond";
377 } else {
378 $flag_cond{$flag} = $cond;
380 } else {
381 $flag_cond{$_} = "1";
384 $flags_conv = "";
385 if (defined ($flag_cond{"no-test-inline"})) {
386 $flags_conv .= or_cond_value ($flag_cond{"no-test-inline"},
387 "NO_TEST_INLINE", "0");
389 if (defined ($flag_cond{"xfail"})) {
390 $flags_conv .= or_cond_value ($flag_cond{"xfail"},
391 "XFAIL_TEST", "0");
393 my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
394 my ($exc);
395 foreach $exc (@exc_list) {
396 my ($exc_expected, $exc_ok, $no_exc);
397 $exc_expected = "\U$exc\E_EXCEPTION";
398 $exc_ok = "\U$exc\E_EXCEPTION_OK";
399 $no_exc = "0";
400 if ($exc eq "inexact") {
401 $exc_ok = "0";
402 $no_exc = "NO_INEXACT_EXCEPTION";
404 if (defined ($flag_cond{$exc})) {
405 if ($flag_cond{$exc} ne "1") {
406 die ("unexpected condition for $exc\n");
408 if (defined ($flag_cond{"$exc-ok"})) {
409 $flags_conv .= or_cond_value ($flag_cond{"$exc-ok"},
410 $exc_ok, $exc_expected);
411 } else {
412 $flags_conv .= or_value ($exc_expected);
414 } else {
415 if (defined ($flag_cond{"$exc-ok"})) {
416 $flags_conv .= or_cond_value ($flag_cond{"$exc-ok"},
417 $exc_ok, $no_exc);
418 } else {
419 $flags_conv .= or_value ($no_exc);
423 my ($errno_expected, $errno_unknown_cond);
424 if (defined ($flag_cond{"errno-edom"})) {
425 if ($flag_cond{"errno-edom"} ne "1") {
426 die ("unexpected condition for errno-edom");
428 if (defined ($flag_cond{"errno-erange"})) {
429 die ("multiple errno values expected");
431 $errno_expected = "ERRNO_EDOM";
432 } elsif (defined ($flag_cond{"errno-erange"})) {
433 if ($flag_cond{"errno-erange"} ne "1") {
434 die ("unexpected condition for errno-erange");
436 $errno_expected = "ERRNO_ERANGE";
437 } else {
438 $errno_expected = "ERRNO_UNCHANGED";
440 if (defined ($flag_cond{"errno-edom-ok"})) {
441 if (defined ($flag_cond{"errno-erange-ok"})
442 && $flag_cond{"errno-erange-ok"} ne $flag_cond{"errno-edom-ok"}) {
443 $errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
444 } else {
445 $errno_unknown_cond = $flag_cond{"errno-edom-ok"};
447 } elsif (defined ($flag_cond{"errno-erange-ok"})) {
448 $errno_unknown_cond = $flag_cond{"errno-erange-ok"};
449 } else {
450 $errno_unknown_cond = "0";
452 $flags_conv .= or_cond_value ($errno_unknown_cond,
453 "0", $errno_expected);
454 if ($flags_conv ne "") {
455 $flags_conv =~ s/^ \|/,/;
457 &parse_args (\*OUTPUT, $descr,
458 "$func, $inputs, $outputs$flags_conv");
459 print OUTPUT "#endif\n";
461 if ($num_auto_tests == 0) {
462 die ("no automatic tests for $func, $mode\n");
464 next;
467 # TEST_...
468 if (/^\s*TEST_/) {
469 my ($descr, $args);
470 chop;
471 ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
472 &parse_args (\*OUTPUT, $descr, $args);
473 next;
475 print OUTPUT;
477 close INPUT;
478 close OUTPUT;
483 # Parse ulps file
484 sub parse_ulps {
485 my ($file) = @_;
486 my ($test, $type, $float, $eps, $kind);
488 # $type has the following values:
489 # "normal": No complex variable
490 # "real": Real part of complex result
491 # "imag": Imaginary part of complex result
492 open ULP, $file or die ("Can't open $file: $!");
493 while (<ULP>) {
494 chop;
495 # ignore comments and empty lines
496 next if /^#/;
497 next if /^\s*$/;
498 if (/^Test/) {
499 if (/Real part of:/) {
500 s/Real part of: //;
501 $type = 'real';
502 } elsif (/Imaginary part of:/) {
503 s/Imaginary part of: //;
504 $type = 'imag';
505 } else {
506 $type = 'normal';
508 s/^.+\"(.*)\".*$/$1/;
509 $test = $_;
510 $kind = 'test';
511 next;
513 if (/^Function: /) {
514 if (/Real part of/) {
515 s/Real part of //;
516 $type = 'real';
517 } elsif (/Imaginary part of/) {
518 s/Imaginary part of //;
519 $type = 'imag';
520 } else {
521 $type = 'normal';
523 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
524 $kind = 'fct';
525 next;
527 if (/^i?(float|double|ldouble):/) {
528 ($float, $eps) = split /\s*:\s*/,$_,2;
530 if ($eps eq "0") {
531 # ignore
532 next;
533 } else {
534 $results{$test}{$type}{'ulp'}{$float} = $eps;
535 $results{$test}{'has_ulps'} = 1;
537 if ($type =~ /^real|imag$/) {
538 $results{$test}{'type'} = 'complex';
539 } elsif ($type eq 'normal') {
540 $results{$test}{'type'} = 'normal';
542 $results{$test}{'kind'} = $kind;
543 next;
545 print "Skipping unknown entry: `$_'\n";
547 close ULP;
551 # Clean up a floating point number
552 sub clean_up_number {
553 my ($number) = @_;
555 # Remove trailing zeros after the decimal point
556 if ($number =~ /\./) {
557 $number =~ s/0+$//;
558 $number =~ s/\.$//;
560 return $number;
563 # Output a file which can be read in as ulps file.
564 sub print_ulps_file {
565 my ($file) = @_;
566 my ($test, $type, $float, $eps, $fct, $last_fct);
568 $last_fct = '';
569 open NEWULP, ">$file" or die ("Can't open $file: $!");
570 print NEWULP "# Begin of automatic generation\n";
571 # first the function calls
572 foreach $test (sort keys %results) {
573 next if ($results{$test}{'kind'} ne 'test');
574 foreach $type ('real', 'imag', 'normal') {
575 if (exists $results{$test}{$type}) {
576 if (defined $results{$test}) {
577 ($fct) = ($test =~ /^(\w+)\s/);
578 if ($fct ne $last_fct) {
579 $last_fct = $fct;
580 print NEWULP "\n# $fct\n";
583 if ($type eq 'normal') {
584 print NEWULP "Test \"$test\":\n";
585 } elsif ($type eq 'real') {
586 print NEWULP "Test \"Real part of: $test\":\n";
587 } elsif ($type eq 'imag') {
588 print NEWULP "Test \"Imaginary part of: $test\":\n";
590 foreach $float (@all_floats) {
591 if (exists $results{$test}{$type}{'ulp'}{$float}) {
592 print NEWULP "$float: ",
593 &clean_up_number ($results{$test}{$type}{'ulp'}{$float}),
594 "\n";
600 print NEWULP "\n# Maximal error of functions:\n";
602 foreach $fct (sort keys %results) {
603 next if ($results{$fct}{'kind'} ne 'fct');
604 foreach $type ('real', 'imag', 'normal') {
605 if (exists $results{$fct}{$type}) {
606 if ($type eq 'normal') {
607 print NEWULP "Function: \"$fct\":\n";
608 } elsif ($type eq 'real') {
609 print NEWULP "Function: Real part of \"$fct\":\n";
610 } elsif ($type eq 'imag') {
611 print NEWULP "Function: Imaginary part of \"$fct\":\n";
613 foreach $float (@all_floats) {
614 if (exists $results{$fct}{$type}{'ulp'}{$float}) {
615 print NEWULP "$float: ",
616 &clean_up_number ($results{$fct}{$type}{'ulp'}{$float}),
617 "\n";
620 print NEWULP "\n";
624 print NEWULP "# end of automatic generation\n";
625 close NEWULP;
628 sub get_ulps {
629 my ($test, $type, $float) = @_;
631 return (exists $results{$test}{$type}{'ulp'}{$float}
632 ? $results{$test}{$type}{'ulp'}{$float} : "0");
635 # Return the ulps value for a single test.
636 sub get_all_ulps_for_test {
637 my ($test, $type) = @_;
638 my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
640 if (exists $results{$test}{'has_ulps'}) {
641 # XXX use all_floats (change order!)
642 $ldouble = &get_ulps ($test, $type, "ldouble");
643 $double = &get_ulps ($test, $type, "double");
644 $float = &get_ulps ($test, $type, "float");
645 $ildouble = &get_ulps ($test, $type, "ildouble");
646 $idouble = &get_ulps ($test, $type, "idouble");
647 $ifloat = &get_ulps ($test, $type, "ifloat");
648 return "CHOOSE ($ldouble, $double, $float, $ildouble, $idouble, $ifloat)";
649 } else {
650 die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
654 # Print include file
655 sub output_ulps {
656 my ($file, $ulps_filename) = @_;
657 my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag);
658 my (%test_ulps, %func_ulps, %func_real_ulps, %func_imag_ulps);
660 open ULP, ">$file" or die ("Can't open $file: $!");
662 print ULP "/* This file is automatically generated\n";
663 print ULP " from $ulps_filename with gen-libm-test.pl.\n";
664 print ULP " Don't change it - change instead the master files. */\n\n";
666 foreach $fct (keys %results) {
667 $type = $results{$fct}{'type'};
668 if ($type eq 'normal') {
669 $ulp = get_all_ulps_for_test ($fct, 'normal');
670 } elsif ($type eq 'complex') {
671 $ulp_real = get_all_ulps_for_test ($fct, 'real');
672 $ulp_imag = get_all_ulps_for_test ($fct, 'imag');
673 } else {
674 die "unknown results ($fct) type $type\n";
676 if ($results{$fct}{'kind'} eq 'fct') {
677 if ($type eq 'normal') {
678 $func_ulps{$fct} = $ulp;
679 } else {
680 $func_real_ulps{$fct} = $ulp_real;
681 $func_imag_ulps{$fct} = $ulp_imag;
683 } elsif ($results{$fct}{'kind'} eq 'test') {
684 if ($type eq 'normal') {
685 $test_ulps{$fct} = $ulp;
686 } else {
687 $test_ulps{"Real part of: $fct"} = $ulp_real;
688 $test_ulps{"Imaginary part of: $fct"} = $ulp_imag;
690 } else {
691 die "unknown results ($fct) kind $results{$fct}{'kind'}\n";
694 print ULP "\n/* Maximal error of functions. */\n";
695 print ULP "static const struct ulp_data func_ulps[] =\n {\n";
696 foreach $fct (sort keys %func_ulps) {
697 print ULP " { \"$fct\", $func_ulps{$fct} },\n";
699 print ULP " };\n";
700 print ULP "static const struct ulp_data func_real_ulps[] =\n {\n";
701 foreach $fct (sort keys %func_real_ulps) {
702 print ULP " { \"$fct\", $func_real_ulps{$fct} },\n";
704 print ULP " };\n";
705 print ULP "static const struct ulp_data func_imag_ulps[] =\n {\n";
706 foreach $fct (sort keys %func_imag_ulps) {
707 print ULP " { \"$fct\", $func_imag_ulps{$fct} },\n";
709 print ULP " };\n";
711 print ULP "\n/* Error of single function calls. */\n";
712 print ULP "static const struct ulp_data test_ulps[] =\n {\n";
713 foreach $fct (sort keys %test_ulps) {
714 print ULP " { \"$fct\", $test_ulps{$fct} },\n";
716 print ULP " };\n";
717 close ULP;
720 # Parse auto-libm-test-out.
721 sub parse_auto_input {
722 my ($file) = @_;
723 open AUTO, $file or die ("Can't open $file: $!");
724 while (<AUTO>) {
725 chop;
726 next if !/^= /;
727 s/^= //;
728 if (/^(\S+) (\S+) (.*)$/) {
729 $auto_tests{$1}{$2}{$3} = 1;
730 } else {
731 die ("bad automatic test line: $_\n");
734 close AUTO;