4 $CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=600";
6 # List of the headers we are testing.
7 @headers = ("wordexp.h", "wctype.h", "wchar.h", "varargs.h", "utmpx.h",
8 "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "time.h",
9 "termios.h", "tar.h", "sys/wait.h", "sys/utsname.h", "sys/un.h",
10 "sys/uio.h", "sys/types.h", "sys/times.h", "sys/timeb.h",
11 "sys/time.h", "sys/statvfs.h", "sys/stat.h", "sys/socket.h",
12 "sys/shm.h", "sys/sem.h", "sys/resource.h", "sys/msg.h",
13 "sys/mman.h", "sys/ipc.h", "syslog.h", "stropts.h", "strings.h",
14 "string.h", "stdlib.h", "stdio.h", "stddef.h", "stdarg.h",
15 "spawn.h", "signal.h", "setjmp.h", "semaphore.h",
16 "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
17 "poll.h", "nl_types.h", "netinet/tcp.h", "netinet/in.h",
18 "net/if.h", "netdb.h", "ndbm.h", "mqueue.h", "monetary.h",
19 "math.h", "locale.h", "libgen.h", "limits.h", "langinfo.h",
20 "iso646.h", "inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h",
21 "fnmatch.h", "fmtmsg.h", "float.h", "fcntl.h", "errno.h",
22 "dlfcn.h", "dirent.h", "ctype.h", "cpio.h", "assert.h",
23 "arpa/inet.h", "aio.h");
25 # These are the ISO C99 keywords.
26 @keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
27 'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto',
28 'if', 'inline', 'int', 'long', 'register', 'restrict', 'return',
29 'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
30 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while');
32 # These are symbols which are known to pollute the namespace.
33 @knownproblems = ('unix', 'linux', 'i386');
35 # Some headers need a bit more attention.
36 $mustprepend{'regex.h'} = "#include <sys/types.h>\n";
37 $mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
39 # Make a hash table from this information.
40 while ($#keywords >= 0) {
41 $iskeyword{pop (@keywords)} = 1;
44 # Make a hash table from the known problems.
45 while ($#knownproblems >= 0) {
46 $isknown{pop (@knownproblems)} = 1;
66 my($pattern, $string) = @_;
67 my($strlen) = length ($string);
70 if (substr ($pattern, 0, 1) eq '*') {
71 my($patlen) = length ($pattern) - 1;
72 $res = ($strlen >= $patlen
73 && substr ($pattern, -$patlen, $patlen) eq substr ($string, -$patlen, $patlen));
74 } elsif (substr ($pattern, -1, 1) eq '*') {
75 my($patlen) = length ($pattern) - 1;
76 $res = ($strlen >= $patlen
77 && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen));
79 $res = $pattern eq $string;
87 my($fnamebase, $msg, $errmsg, $skip, $optional) = @_;
98 $ret = system "$CC $CFLAGS -c $fnamebase.c -o $fnamebase.o > $fnamebase.out 2>&1";
100 if ($optional != 0) {
101 printf (" $errmsg\n");
106 printf (" $errmsg Compiler message:\n");
114 if ($verbose > 1 && -s "$fnamebase.out") {
115 # We print all warnings issued.
119 if ($printlog != 0) {
120 printf (" " . "-" x 71 . "\n");
121 open (MESSAGE, "< $fnamebase.out");
126 printf (" " . "-" x 71 . "\n");
129 unlink "$fnamebase.c";
130 unlink "$fnamebase.o";
131 unlink "$fnamebase.out";
139 my($fnamebase, $msg, $errmsg, $skip) = @_;
150 $ret = system "$CC $CFLAGS -o $fnamebase $fnamebase.c > $fnamebase.out 2>&1";
154 printf (" $errmsg Compiler message:\n");
160 # Now run the program. If the exit code is not zero something is wrong.
161 $result = system "$fnamebase > $fnamebase.out2 2>&1";
164 if ($verbose > 1 && -s "$fnamebase.out") {
165 # We print all warnings issued.
167 system "cat $fnamebase.out2 >> $fnamebase.out";
172 unlink "$fnamebase.out";
173 rename "$fnamebase.out2", "$fnamebase.out";
176 if ($printlog != 0) {
177 printf (" " . "-" x 71 . "\n");
178 open (MESSAGE, "< $fnamebase.out");
183 printf (" " . "-" x 71 . "\n");
187 unlink "$fnamebase.c";
188 unlink "$fnamebase.o";
189 unlink "$fnamebase.out";
190 unlink "$fnamebase.out2";
197 my($token, @allow) = @_;
200 return if ($token =~ /^[0-9_]/ || $iskeyword{$token});
202 for ($idx = 0; $idx <= $#allow; ++$idx) {
203 return if (poorfnmatch ($allow[$idx], $token));
206 if ($isknown{$token}) {
211 printf ("FAIL\n " . "-" x 72 . "\n");
213 printf (" Namespace violation: \"%s\"\n", $token);
219 my($h, $fnamebase, @allow) = @_;
223 # Generate a program to get the contents of this header.
224 open (TESTFILE, ">$fnamebase.c");
225 print TESTFILE "#include <$h>\n";
230 open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
231 loop: while (<CONTENT>) {
232 next loop if (/^#undef /);
234 if (/^#define (.*)/) {
235 newtoken ($1, @allow);
237 # We have to tokenize the line.
240 my($len) = length ($str);
242 foreach $token (split(/[^a-zA-Z0-9_]/, $str)) {
244 newtoken ($token, @allow);
250 unlink "$fnamebase.c";
252 printf (" " . "-" x 72 . "\n");
254 } elsif ($nknown > 0) {
255 printf ("EXPECTED FAILURES\n");
263 while ($#headers >= 0) {
264 my($h) = pop (@headers);
267 my($fnamebase) = "$tmpdir/$hf-test";
270 my(@allowheader) = ();
271 my($prepend) = $mustprepend{$h};
273 printf ("Testing <$h>\n");
274 printf ("----------" . "-" x length ($h) . "\n");
276 # Generate a program to test for the availability of this header.
277 open (TESTFILE, ">$fnamebase.c");
278 print TESTFILE "$prepend";
279 print TESTFILE "#include <$h>\n";
282 $missing = compiletest ($fnamebase, "Checking whether <$h> is available",
283 "Header <$h> not available", 0, 0);
287 open (CONTROL, "$CC -E -D$dialect - < data/$h-data |");
288 control: while (<CONTROL>) {
290 next control if (/^#/);
291 next control if (/^[ ]*$/);
293 if (/^element *({([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
294 my($struct) = "$2$3";
300 # Remember that this name is allowed.
301 push @allow, $member;
303 # Generate a program to test for the availability of this member.
304 open (TESTFILE, ">$fnamebase.c");
305 print TESTFILE "$prepend";
306 print TESTFILE "#include <$h>\n";
307 print TESTFILE "$struct a;\n";
308 print TESTFILE "$struct b;\n";
309 print TESTFILE "extern void xyzzy (__typeof__ (&b.$member), __typeof__ (&a.$member), unsigned);\n";
310 print TESTFILE "void foobarbaz (void) {\n";
311 print TESTFILE " xyzzy (&a.$member, &b.$member, sizeof (a.$member));\n";
312 print TESTFILE "}\n";
315 $res = compiletest ($fnamebase, "Testing for member $member",
316 "Member \"$member\" not available.", $res, 0);
319 # Test the types of the members.
320 open (TESTFILE, ">$fnamebase.c");
321 print TESTFILE "$prepend";
322 print TESTFILE "#include <$h>\n";
323 print TESTFILE "$struct a;\n";
324 print TESTFILE "extern $type b$rest;\n";
325 print TESTFILE "extern __typeof__ (a.$member) b;\n";
328 compiletest ($fnamebase, "Testing for type of member $member",
329 "Member \"$member\" does not have the correct type.", $res);
330 } elsif (/^optional-constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) {
336 # Remember that this name is allowed.
339 # Generate a program to test for the availability of this constant.
340 open (TESTFILE, ">$fnamebase.c");
341 print TESTFILE "$prepend";
342 print TESTFILE "#include <$h>\n";
343 print TESTFILE "__typeof__ ($const) a = $const;\n";
346 $res = compiletest ($fnamebase, "Testing for constant $const",
347 "NOT PRESENT", $res, 1);
350 # Generate a program to test for the value of this constant.
351 open (TESTFILE, ">$fnamebase.c");
352 print TESTFILE "$prepend";
353 print TESTFILE "#include <$h>\n";
354 # Negate the value since 0 means ok
355 print TESTFILE "int main (void) { return !($const $op $value); }\n";
358 $res = runtest ($fnamebase, "Testing for value of constant $const",
359 "Constant \"$const\" has not the right value.", $res);
361 } elsif (/^constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) {
367 # Remember that this name is allowed.
370 # Generate a program to test for the availability of this constant.
371 open (TESTFILE, ">$fnamebase.c");
372 print TESTFILE "$prepend";
373 print TESTFILE "#include <$h>\n";
374 print TESTFILE "__typeof__ ($const) a = $const;\n";
377 $res = compiletest ($fnamebase, "Testing for constant $const",
378 "Constant \"$const\" not available.", $res, 0);
381 # Generate a program to test for the value of this constant.
382 open (TESTFILE, ">$fnamebase.c");
383 print TESTFILE "$prepend";
384 print TESTFILE "#include <$h>\n";
385 # Negate the value since 0 means ok
386 print TESTFILE "int main (void) { return !($const $op $value); }\n";
389 $res = runtest ($fnamebase, "Testing for value of constant $const",
390 "Constant \"$const\" has not the right value.", $res);
392 } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
398 # Remember that this name is allowed.
401 # Generate a program to test for the availability of this constant.
402 open (TESTFILE, ">$fnamebase.c");
403 print TESTFILE "$prepend";
404 print TESTFILE "#include <$h>\n";
405 print TESTFILE "__typeof__ ($const) a = $const;\n";
408 $res = compiletest ($fnamebase, "Testing for constant $const",
409 "Constant \"$const\" not available.", $res, 0);
411 # Test the types of the members.
412 open (TESTFILE, ">$fnamebase.c");
413 print TESTFILE "$prepend";
414 print TESTFILE "#include <$h>\n";
415 print TESTFILE "__typeof__ (($type) 0) a;\n";
416 print TESTFILE "extern __typeof__ ($const) a;\n";
419 compiletest ($fnamebase, "Testing for type of constant $const",
420 "Constant \"$const\" does not have the correct type.",
424 # Generate a program to test for the value of this constant.
425 open (TESTFILE, ">$fnamebase.c");
426 print TESTFILE "$prepend";
427 print TESTFILE "#include <$h>\n";
428 print TESTFILE "int main (void) { return $const != $value; }\n";
431 $res = runtest ($fnamebase, "Testing for value of constant $const",
432 "Constant \"$const\" has not the right value.", $res);
434 } elsif (/^optional-constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
439 # Remember that this name is allowed.
442 # Generate a program to test for the availability of this constant.
443 open (TESTFILE, ">$fnamebase.c");
444 print TESTFILE "$prepend";
445 print TESTFILE "#include <$h>\n";
446 print TESTFILE "__typeof__ ($const) a = $const;\n";
449 $res = compiletest ($fnamebase, "Testing for constant $const",
450 "NOT PRESENT", $res, 1);
453 # Generate a program to test for the value of this constant.
454 open (TESTFILE, ">$fnamebase.c");
455 print TESTFILE "$prepend";
456 print TESTFILE "#include <$h>\n";
457 print TESTFILE "int main (void) { return $const != $value; }\n";
460 $res = runtest ($fnamebase, "Testing for value of constant $const",
461 "Constant \"$const\" has not the right value.", $res);
463 } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
468 # Remember that this name is allowed.
471 # Generate a program to test for the availability of this constant.
472 open (TESTFILE, ">$fnamebase.c");
473 print TESTFILE "$prepend";
474 print TESTFILE "#include <$h>\n";
475 print TESTFILE "__typeof__ ($const) a = $const;\n";
478 $res = compiletest ($fnamebase, "Testing for constant $const",
479 "Constant \"$const\" not available.", $res, 0);
482 # Generate a program to test for the value of this constant.
483 open (TESTFILE, ">$fnamebase.c");
484 print TESTFILE "$prepend";
485 print TESTFILE "#include <$h>\n";
486 print TESTFILE "int main (void) { return $const != $value; }\n";
489 $res = runtest ($fnamebase, "Testing for value of constant $const",
490 "Constant \"$const\" has not the right value.", $res);
492 } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
498 # Remember that this name is allowed.
501 # Generate a program to test for the availability of this constant.
502 open (TESTFILE, ">$fnamebase.c");
503 print TESTFILE "$prepend";
504 print TESTFILE "#include <$h>\n";
505 print TESTFILE "__typeof__ ($const) a = $const;\n";
508 $res = compiletest ($fnamebase, "Testing for constant $const",
509 "Constant \"$const\" not available.", $res, 0);
511 # Test the types of the members.
512 open (TESTFILE, ">$fnamebase.c");
513 print TESTFILE "$prepend";
514 print TESTFILE "#include <$h>\n";
515 print TESTFILE "__typeof__ (($type) 0) a;\n";
516 print TESTFILE "extern __typeof__ ($const) a;\n";
519 compiletest ($fnamebase, "Testing for type of constant $const",
520 "Constant \"$const\" does not have the correct type.",
524 # Generate a program to test for the value of this constant.
525 open (TESTFILE, ">$fnamebase.c");
526 print TESTFILE "$prepend";
527 print TESTFILE "#include <$h>\n";
528 print TESTFILE "int main (void) { return $const != $value; }\n";
531 $res = runtest ($fnamebase, "Testing for value of constant $const",
532 "Constant \"$const\" has not the right value.", $res);
534 } elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
537 # Remember that this name is allowed.
538 if ($type =~ /^struct *(.*)/) {
540 } elsif ($type =~ /^union *(.*)/) {
546 # Remember that this name is allowed.
549 # Generate a program to test for the availability of this constant.
550 open (TESTFILE, ">$fnamebase.c");
551 print TESTFILE "$prepend";
552 print TESTFILE "#include <$h>\n";
553 print TESTFILE "$type *a;\n";
556 compiletest ($fnamebase, "Testing for type $type",
557 "Type \"$type\" not available.", $missing, 0);
558 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
559 my($rettype) = "$2$3";
564 # Remember that this name is allowed.
567 # Generate a program to test for availability of this function.
568 open (TESTFILE, ">$fnamebase.c");
569 print TESTFILE "$prepend";
570 print TESTFILE "#include <$h>\n";
571 # print TESTFILE "#undef $fname\n";
572 print TESTFILE "$rettype (*(*foobarbaz) $args = $fname;\n";
575 $res = compiletest ($fnamebase, "Test availability of function $fname",
576 "Function \"$fname\" is not available.", $res, 0);
578 # Generate a program to test for the type of this function.
579 open (TESTFILE, ">$fnamebase.c");
580 print TESTFILE "$prepend";
581 print TESTFILE "#include <$h>\n";
582 # print TESTFILE "#undef $fname\n";
583 print TESTFILE "extern $rettype (*(*foobarbaz) $args;\n";
584 print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
587 compiletest ($fnamebase, "Test for type of function $fname",
588 "Function \"$fname\" has incorrect type.", $res, 0);
589 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
590 my($rettype) = "$2$3";
595 # Remember that this name is allowed.
598 # Generate a program to test for availability of this function.
599 open (TESTFILE, ">$fnamebase.c");
600 print TESTFILE "$prepend";
601 print TESTFILE "#include <$h>\n";
602 # print TESTFILE "#undef $fname\n";
603 print TESTFILE "$rettype (*foobarbaz) $args = $fname;\n";
606 $res = compiletest ($fnamebase, "Test availability of function $fname",
607 "Function \"$fname\" is not available.", $res, 0);
609 # Generate a program to test for the type of this function.
610 open (TESTFILE, ">$fnamebase.c");
611 print TESTFILE "$prepend";
612 print TESTFILE "#include <$h>\n";
613 # print TESTFILE "#undef $fname\n";
614 print TESTFILE "extern $rettype (*foobarbaz) $args;\n";
615 print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
618 compiletest ($fnamebase, "Test for type of function $fname",
619 "Function \"$fname\" has incorrect type.", $res, 0);
620 } elsif (/^variable *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*)/) {
625 # Remember that this name is allowed.
628 # Generate a program to test for availability of this function.
629 open (TESTFILE, ">$fnamebase.c");
630 print TESTFILE "$prepend";
631 print TESTFILE "#include <$h>\n";
632 # print TESTFILE "#undef $fname\n";
633 print TESTFILE "$type *foobarbaz = &$vname;\n";
636 $res = compiletest ($fnamebase, "Test availability of variable $vname",
637 "Variable \"$vname\" is not available.", $res, 0);
639 # Generate a program to test for the type of this function.
640 open (TESTFILE, ">$fnamebase.c");
641 print TESTFILE "$prepend";
642 print TESTFILE "#include <$h>\n";
643 # print TESTFILE "#undef $fname\n";
644 print TESTFILE "extern $type $vname;\n";
647 compiletest ($fnamebase, "Test for type of variable $fname",
648 "Variable \"$vname\" has incorrect type.", $res, 0);
649 } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
650 my($rettype) = "$2$3";
655 # Remember that this name is allowed.
658 # Generate a program to test for availability of this function.
659 open (TESTFILE, ">$fnamebase.c");
660 print TESTFILE "$prepend";
661 print TESTFILE "#include <$h>\n";
662 print TESTFILE "#ifndef $fname\n";
663 print TESTFILE "$rettype (*foobarbaz) $args = $fname;\n";
664 print TESTFILE "#endif\n";
667 $res = compiletest ($fnamebase, "Test availability of function $fname",
668 "Function \"$fname\" is not available.", $res, 0);
670 # Generate a program to test for the type of this function.
671 open (TESTFILE, ">$fnamebase.c");
672 print TESTFILE "$prepend";
673 print TESTFILE "#include <$h>\n";
674 print TESTFILE "#ifndef $fname\n";
675 print TESTFILE "extern $rettype (*foobarbaz) $args;\n";
676 print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
677 print TESTFILE "#endif\n";
680 compiletest ($fnamebase, "Test for type of function $fname",
681 "Function \"$fname\" has incorrect type.", $res, 0);
682 } elsif (/^macro-str *([^ ]*)\s*(\".*\")/) {
683 # The above regex doesn't handle a \" in a string.
688 # Remember that this name is allowed.
691 # Generate a program to test for availability of this macro.
692 open (TESTFILE, ">$fnamebase.c");
693 print TESTFILE "$prepend";
694 print TESTFILE "#include <$h>\n";
695 print TESTFILE "#ifndef $macro\n";
696 print TESTFILE "# error \"Macro $macro not defined\"\n";
697 print TESTFILE "#endif\n";
700 compiletest ($fnamebase, "Test availability of macro $macro",
701 "Macro \"$macro\" is not available.", $missing, 0);
703 # Generate a program to test for the value of this macro.
704 open (TESTFILE, ">$fnamebase.c");
705 print TESTFILE "$prepend";
706 print TESTFILE "#include <$h>\n";
707 # We can't include <string.h> here.
708 print TESTFILE "extern int (strcmp)(const char *, const char *);\n";
709 print TESTFILE "int main (void) { return strcmp ($macro, $string) != 0;}\n";
712 $res = runtest ($fnamebase, "Testing for value of macro $macro",
713 "Macro \"$macro\" has not the right value.", $res);
714 } elsif (/^macro *([^ ]*)/) {
717 # Remember that this name is allowed.
720 # Generate a program to test for availability of this macro.
721 open (TESTFILE, ">$fnamebase.c");
722 print TESTFILE "$prepend";
723 print TESTFILE "#include <$h>\n";
724 print TESTFILE "#ifndef $macro\n";
725 print TESTFILE "# error \"Macro $macro not defined\"\n";
726 print TESTFILE "#endif\n";
729 compiletest ($fnamebase, "Test availability of macro $macro",
730 "Macro \"$macro\" is not available.", $missing, 0);
731 } elsif (/^allow-header *(.*)/) {
733 push @allowheader, $pattern;
735 } elsif (/^allow *(.*)/) {
737 push @allow, $pattern;
740 # printf ("line is `%s'\n", $_);
748 # Read the data files for the header files which are allowed to be included.
749 while ($#allowheader >= 0) {
750 my($ah) = pop @allowheader;
752 open (ALLOW, "$CC -E -D$dialect - < data/$ah-data |");
753 acontrol: while (<ALLOW>) {
754 next acontrol if (/^#/);
755 next acontrol if (/^[ ]*$/);
757 if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
759 } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
761 } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
763 } elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
766 # Remember that this name is allowed.
767 if ($type =~ /^struct *(.*)/) {
769 } elsif ($type =~ /^union *(.*)/) {
774 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
776 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
778 } elsif (/^variable *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*)/) {
780 } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
782 } elsif (/^macro *([^ ]*)/) {
784 } elsif (/^allow-header *(.*)/) {
785 # XXX We should have a test for recursive dependencies here.
786 push @allowheader, $1;
787 } elsif (/^allow *(.*)/) {
794 # Now check the namespace.
795 printf (" Checking the namespace of \"%s\"... ", $h);
800 checknamespace ($h, $fnamebase, @allow);
806 printf "-" x 76 . "\n";
807 printf (" Total number of tests : %4d\n", $total);
809 printf (" Number of known failures: %4d (", $known);
810 $percent = ($known * 100) / $total;
811 if ($known > 0 && $percent < 1.0) {
814 printf ("%3d%%)\n", $percent);
817 printf (" Number of failed tests : %4d (", $errors);
818 $percent = ($errors * 100) / $total;
819 if ($errors > 0 && $percent < 1.0) {
822 printf ("%3d%%)\n", $percent);
825 printf (" Number of skipped tests : %4d (", $skipped);
826 $percent = ($skipped * 100) / $total;
827 if ($skipped > 0 && $percent < 1.0) {
830 printf ("%3d%%)\n", $percent);