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;
65 my($pattern, $string) = @_;
66 my($strlen) = length ($string);
69 if (substr ($pattern, 0, 1) eq '*') {
70 my($patlen) = length ($pattern) - 1;
71 $res = ($strlen >= $patlen
72 && substr ($pattern, -$patlen, $patlen) eq substr ($string, -$patlen, $patlen));
73 } elsif (substr ($pattern, -1, 1) eq '*') {
74 my($patlen) = length ($pattern) - 1;
75 $res = ($strlen >= $patlen
76 && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen));
78 $res = $pattern eq $string;
86 my($fnamebase, $msg, $errmsg, $skip, $optional) = @_;
97 $ret = system "$CC $CFLAGS -c $fnamebase.c -o $fnamebase.o > $fnamebase.out 2>&1";
100 printf (" $errmsg\n");
105 printf (" $errmsg Compiler message:\n");
113 if ($verbose > 1 && -s "$fnamebase.out") {
114 # We print all warnings issued.
118 if ($printlog != 0) {
119 printf (" " . "-" x 71 . "\n");
120 open (MESSAGE, "< $fnamebase.out");
125 printf (" " . "-" x 71 . "\n");
128 unlink "$fnamebase.c";
129 unlink "$fnamebase.o";
130 unlink "$fnamebase.out";
138 my($fnamebase, $msg, $errmsg, $skip) = @_;
149 $ret = system "$CC $CFLAGS -o $fnamebase $fnamebase.c > $fnamebase.out 2>&1";
153 printf (" $errmsg Compiler message:\n");
159 # Now run the program. If the exit code is not zero something is wrong.
160 $result = system "$fnamebase > $fnamebase.out2 2>&1";
163 if ($verbose > 1 && -s "$fnamebase.out") {
164 # We print all warnings issued.
166 system "cat $fnamebase.out2 >> $fnamebase.out";
171 unlink "$fnamebase.out";
172 rename "$fnamebase.out2", "$fnamebase.out";
175 if ($printlog != 0) {
176 printf (" " . "-" x 71 . "\n");
177 open (MESSAGE, "< $fnamebase.out");
182 printf (" " . "-" x 71 . "\n");
186 unlink "$fnamebase.c";
187 unlink "$fnamebase.o";
188 unlink "$fnamebase.out";
189 unlink "$fnamebase.out2";
196 my($token, @allow) = @_;
199 return if ($token =~ /^[0-9_]/ || $iskeyword{$token});
201 for ($idx = 0; $idx <= $#allow; ++$idx) {
202 return if (poorfnmatch ($allow[$idx], $token));
205 if ($isknown{$token}) {
210 printf ("FAIL\n " . "-" x 72 . "\n");
212 printf (" Namespace violation: \"%s\"\n", $token);
218 my($h, $fnamebase, @allow) = @_;
222 # Generate a program to get the contents of this header.
223 open (TESTFILE, ">$fnamebase.c");
224 print TESTFILE "#include <$h>\n";
229 open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
230 loop: while (<CONTENT>) {
231 next loop if (/^#undef /);
233 if (/^#define (.*)/) {
234 newtoken ($1, @allow);
236 # We have to tokenize the line.
239 my($len) = length ($str);
241 foreach $token (split(/[^a-zA-Z0-9_]/, $str)) {
243 newtoken ($token, @allow);
249 unlink "$fnamebase.c";
251 printf (" " . "-" x 72 . "\n");
253 } elsif ($nknown > 0) {
254 printf ("EXPECTED FAILURES\n");
262 while ($#headers >= 0) {
263 my($h) = pop (@headers);
266 my($fnamebase) = "$tmpdir/$hf-test";
269 my(@allowheader) = ();
270 my($prepend) = $mustprepend{$h};
272 printf ("Testing <$h>\n");
273 printf ("----------" . "-" x length ($h) . "\n");
275 # Generate a program to test for the availability of this header.
276 open (TESTFILE, ">$fnamebase.c");
277 print TESTFILE "$prepend";
278 print TESTFILE "#include <$h>\n";
281 $missing = compiletest ($fnamebase, "Checking whether <$h> is available",
282 "Header <$h> not available", 0, 0);
286 open (CONTROL, "$CC -E -D$dialect - < data/$h-data |");
287 control: while (<CONTROL>) {
289 next control if (/^#/);
290 next control if (/^[ ]*$/);
292 if (/^element *({([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
293 my($struct) = "$2$3";
299 # Remember that this name is allowed.
300 push @allow, $member;
302 # Generate a program to test for the availability of this member.
303 open (TESTFILE, ">$fnamebase.c");
304 print TESTFILE "$prepend";
305 print TESTFILE "#include <$h>\n";
306 print TESTFILE "$struct a;\n";
307 print TESTFILE "$struct b;\n";
308 print TESTFILE "extern void xyzzy (__typeof__ (&b.$member), __typeof__ (&a.$member), unsigned);\n";
309 print TESTFILE "void foobarbaz (void) {\n";
310 print TESTFILE " xyzzy (&a.$member, &b.$member, sizeof (a.$member));\n";
311 print TESTFILE "}\n";
314 $res = compiletest ($fnamebase, "Testing for member $member",
315 "Member \"$member\" not available.", $res, 0);
318 # Test the types of the members.
319 open (TESTFILE, ">$fnamebase.c");
320 print TESTFILE "$prepend";
321 print TESTFILE "#include <$h>\n";
322 print TESTFILE "$struct a;\n";
323 print TESTFILE "extern $type b$rest;\n";
324 print TESTFILE "extern __typeof__ (a.$member) b;\n";
327 compiletest ($fnamebase, "Testing for type of member $member",
328 "Member \"$member\" does not have the correct type.", $res);
329 } elsif (/^optional-constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) {
335 # Remember that this name is allowed.
338 # Generate a program to test for the availability of this constant.
339 open (TESTFILE, ">$fnamebase.c");
340 print TESTFILE "$prepend";
341 print TESTFILE "#include <$h>\n";
342 print TESTFILE "__typeof__ ($const) a = $const;\n";
345 $res = compiletest ($fnamebase, "Testing for constant $const",
346 "NOT PRESENT", $res, 1);
349 # Generate a program to test for the value of this constant.
350 open (TESTFILE, ">$fnamebase.c");
351 print TESTFILE "$prepend";
352 print TESTFILE "#include <$h>\n";
353 # Negate the value since 0 means ok
354 print TESTFILE "int main (void) { return !($const $op $value); }\n";
357 $res = runtest ($fnamebase, "Testing for value of constant $const",
358 "Constant \"$const\" has not the right value.", $res);
360 } elsif (/^constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) {
366 # Remember that this name is allowed.
369 # Generate a program to test for the availability of this constant.
370 open (TESTFILE, ">$fnamebase.c");
371 print TESTFILE "$prepend";
372 print TESTFILE "#include <$h>\n";
373 print TESTFILE "__typeof__ ($const) a = $const;\n";
376 $res = compiletest ($fnamebase, "Testing for constant $const",
377 "Constant \"$const\" not available.", $res, 0);
380 # Generate a program to test for the value of this constant.
381 open (TESTFILE, ">$fnamebase.c");
382 print TESTFILE "$prepend";
383 print TESTFILE "#include <$h>\n";
384 # Negate the value since 0 means ok
385 print TESTFILE "int main (void) { return !($const $op $value); }\n";
388 $res = runtest ($fnamebase, "Testing for value of constant $const",
389 "Constant \"$const\" has not the right value.", $res);
391 } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
397 # Remember that this name is allowed.
400 # Generate a program to test for the availability of this constant.
401 open (TESTFILE, ">$fnamebase.c");
402 print TESTFILE "$prepend";
403 print TESTFILE "#include <$h>\n";
404 print TESTFILE "__typeof__ ($const) a = $const;\n";
407 $res = compiletest ($fnamebase, "Testing for constant $const",
408 "Constant \"$const\" not available.", $res, 0);
410 # Test the types of the members.
411 open (TESTFILE, ">$fnamebase.c");
412 print TESTFILE "$prepend";
413 print TESTFILE "#include <$h>\n";
414 print TESTFILE "__typeof__ (($type) 0) a;\n";
415 print TESTFILE "extern __typeof__ ($const) a;\n";
418 compiletest ($fnamebase, "Testing for type of constant $const",
419 "Constant \"$const\" does not have the correct type.",
423 # Generate a program to test for the value of this constant.
424 open (TESTFILE, ">$fnamebase.c");
425 print TESTFILE "$prepend";
426 print TESTFILE "#include <$h>\n";
427 print TESTFILE "int main (void) { return $const != $value; }\n";
430 $res = runtest ($fnamebase, "Testing for value of constant $const",
431 "Constant \"$const\" has not the right value.", $res);
433 } elsif (/^optional-constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
438 # Remember that this name is allowed.
441 # Generate a program to test for the availability of this constant.
442 open (TESTFILE, ">$fnamebase.c");
443 print TESTFILE "$prepend";
444 print TESTFILE "#include <$h>\n";
445 print TESTFILE "__typeof__ ($const) a = $const;\n";
448 $res = compiletest ($fnamebase, "Testing for constant $const",
449 "NOT PRESENT", $res, 1);
452 # Generate a program to test for the value of this constant.
453 open (TESTFILE, ">$fnamebase.c");
454 print TESTFILE "$prepend";
455 print TESTFILE "#include <$h>\n";
456 print TESTFILE "int main (void) { return $const != $value; }\n";
459 $res = runtest ($fnamebase, "Testing for value of constant $const",
460 "Constant \"$const\" has not the right value.", $res);
462 } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
467 # Remember that this name is allowed.
470 # Generate a program to test for the availability of this constant.
471 open (TESTFILE, ">$fnamebase.c");
472 print TESTFILE "$prepend";
473 print TESTFILE "#include <$h>\n";
474 print TESTFILE "__typeof__ ($const) a = $const;\n";
477 $res = compiletest ($fnamebase, "Testing for constant $const",
478 "Constant \"$const\" not available.", $res, 0);
481 # Generate a program to test for the value of this constant.
482 open (TESTFILE, ">$fnamebase.c");
483 print TESTFILE "$prepend";
484 print TESTFILE "#include <$h>\n";
485 print TESTFILE "int main (void) { return $const != $value; }\n";
488 $res = runtest ($fnamebase, "Testing for value of constant $const",
489 "Constant \"$const\" has not the right value.", $res);
491 } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
497 # Remember that this name is allowed.
500 # Generate a program to test for the availability of this constant.
501 open (TESTFILE, ">$fnamebase.c");
502 print TESTFILE "$prepend";
503 print TESTFILE "#include <$h>\n";
504 print TESTFILE "__typeof__ ($const) a = $const;\n";
507 $res = compiletest ($fnamebase, "Testing for constant $const",
508 "Constant \"$const\" not available.", $res, 0);
510 # Test the types of the members.
511 open (TESTFILE, ">$fnamebase.c");
512 print TESTFILE "$prepend";
513 print TESTFILE "#include <$h>\n";
514 print TESTFILE "__typeof__ (($type) 0) a;\n";
515 print TESTFILE "extern __typeof__ ($const) a;\n";
518 compiletest ($fnamebase, "Testing for type of constant $const",
519 "Constant \"$const\" does not have the correct type.",
523 # Generate a program to test for the value of this constant.
524 open (TESTFILE, ">$fnamebase.c");
525 print TESTFILE "$prepend";
526 print TESTFILE "#include <$h>\n";
527 print TESTFILE "int main (void) { return $const != $value; }\n";
530 $res = runtest ($fnamebase, "Testing for value of constant $const",
531 "Constant \"$const\" has not the right value.", $res);
533 } elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
536 # Remember that this name is allowed.
537 if ($type =~ /^struct *(.*)/) {
539 } elsif ($type =~ /^union *(.*)/) {
545 # Remember that this name is allowed.
548 # Generate a program to test for the availability of this constant.
549 open (TESTFILE, ">$fnamebase.c");
550 print TESTFILE "$prepend";
551 print TESTFILE "#include <$h>\n";
552 print TESTFILE "$type *a;\n";
555 compiletest ($fnamebase, "Testing for type $type",
556 "Type \"$type\" not available.", $missing, 0);
557 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
558 my($rettype) = "$2$3";
563 # Remember that this name is allowed.
566 # Generate a program to test for availability of this function.
567 open (TESTFILE, ">$fnamebase.c");
568 print TESTFILE "$prepend";
569 print TESTFILE "#include <$h>\n";
570 # print TESTFILE "#undef $fname\n";
571 print TESTFILE "$rettype (*(*foobarbaz) $args = $fname;\n";
574 $res = compiletest ($fnamebase, "Test availability of function $fname",
575 "Function \"$fname\" is not available.", $res, 0);
577 # Generate a program to test for the type of this function.
578 open (TESTFILE, ">$fnamebase.c");
579 print TESTFILE "$prepend";
580 print TESTFILE "#include <$h>\n";
581 # print TESTFILE "#undef $fname\n";
582 print TESTFILE "extern $rettype (*(*foobarbaz) $args;\n";
583 print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
586 compiletest ($fnamebase, "Test for type of function $fname",
587 "Function \"$fname\" has incorrect type.", $res, 0);
588 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
589 my($rettype) = "$2$3";
594 # Remember that this name is allowed.
597 # Generate a program to test for availability of this function.
598 open (TESTFILE, ">$fnamebase.c");
599 print TESTFILE "$prepend";
600 print TESTFILE "#include <$h>\n";
601 # print TESTFILE "#undef $fname\n";
602 print TESTFILE "$rettype (*foobarbaz) $args = $fname;\n";
605 $res = compiletest ($fnamebase, "Test availability of function $fname",
606 "Function \"$fname\" is not available.", $res, 0);
608 # Generate a program to test for the type of this function.
609 open (TESTFILE, ">$fnamebase.c");
610 print TESTFILE "$prepend";
611 print TESTFILE "#include <$h>\n";
612 # print TESTFILE "#undef $fname\n";
613 print TESTFILE "extern $rettype (*foobarbaz) $args;\n";
614 print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
617 compiletest ($fnamebase, "Test for type of function $fname",
618 "Function \"$fname\" has incorrect type.", $res, 0);
619 } elsif (/^variable *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*)/) {
624 # Remember that this name is allowed.
627 # Generate a program to test for availability of this function.
628 open (TESTFILE, ">$fnamebase.c");
629 print TESTFILE "$prepend";
630 print TESTFILE "#include <$h>\n";
631 # print TESTFILE "#undef $fname\n";
632 print TESTFILE "$type *foobarbaz = &$vname;\n";
635 $res = compiletest ($fnamebase, "Test availability of variable $vname",
636 "Variable \"$vname\" is not available.", $res, 0);
638 # Generate a program to test for the type of this function.
639 open (TESTFILE, ">$fnamebase.c");
640 print TESTFILE "$prepend";
641 print TESTFILE "#include <$h>\n";
642 # print TESTFILE "#undef $fname\n";
643 print TESTFILE "extern $type $vname;\n";
646 compiletest ($fnamebase, "Test for type of variable $fname",
647 "Variable \"$vname\" has incorrect type.", $res, 0);
648 } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
649 my($rettype) = "$2$3";
654 # Remember that this name is allowed.
657 # Generate a program to test for availability of this function.
658 open (TESTFILE, ">$fnamebase.c");
659 print TESTFILE "$prepend";
660 print TESTFILE "#include <$h>\n";
661 print TESTFILE "#ifndef $fname\n";
662 print TESTFILE "$rettype (*foobarbaz) $args = $fname;\n";
663 print TESTFILE "#endif\n";
666 $res = compiletest ($fnamebase, "Test availability of function $fname",
667 "Function \"$fname\" is not available.", $res, 0);
669 # Generate a program to test for the type of this function.
670 open (TESTFILE, ">$fnamebase.c");
671 print TESTFILE "$prepend";
672 print TESTFILE "#include <$h>\n";
673 print TESTFILE "#ifndef $fname\n";
674 print TESTFILE "extern $rettype (*foobarbaz) $args;\n";
675 print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
676 print TESTFILE "#endif\n";
679 compiletest ($fnamebase, "Test for type of function $fname",
680 "Function \"$fname\" has incorrect type.", $res, 0);
681 } elsif (/^macro-str *([^ ]*)\s*(\".*\")/) {
682 # The above regex doesn't handle a \" in a string.
687 # Remember that this name is allowed.
690 # Generate a program to test for availability of this macro.
691 open (TESTFILE, ">$fnamebase.c");
692 print TESTFILE "$prepend";
693 print TESTFILE "#include <$h>\n";
694 print TESTFILE "#ifndef $macro\n";
695 print TESTFILE "# error \"Macro $macro not defined\"\n";
696 print TESTFILE "#endif\n";
699 compiletest ($fnamebase, "Test availability of macro $macro",
700 "Macro \"$macro\" is not available.", $missing, 0);
702 # Generate a program to test for the value of this macro.
703 open (TESTFILE, ">$fnamebase.c");
704 print TESTFILE "$prepend";
705 print TESTFILE "#include <$h>\n";
706 # We can't include <string.h> here.
707 print TESTFILE "extern int (strcmp)(const char *, const char *);\n";
708 print TESTFILE "int main (void) { return strcmp ($macro, $string) != 0;}\n";
711 $res = runtest ($fnamebase, "Testing for value of macro $macro",
712 "Macro \"$macro\" has not the right value.", $res);
713 } elsif (/^macro *([^ ]*)/) {
716 # Remember that this name is allowed.
719 # Generate a program to test for availability of this macro.
720 open (TESTFILE, ">$fnamebase.c");
721 print TESTFILE "$prepend";
722 print TESTFILE "#include <$h>\n";
723 print TESTFILE "#ifndef $macro\n";
724 print TESTFILE "# error \"Macro $macro not defined\"\n";
725 print TESTFILE "#endif\n";
728 compiletest ($fnamebase, "Test availability of macro $macro",
729 "Macro \"$macro\" is not available.", $missing, 0);
730 } elsif (/^allow-header *(.*)/) {
732 push @allowheader, $pattern;
734 } elsif (/^allow *(.*)/) {
736 push @allow, $pattern;
739 # printf ("line is `%s'\n", $_);
747 # Read the data files for the header files which are allowed to be included.
748 while ($#allowheader >= 0) {
749 my($ah) = pop @allowheader;
751 open (ALLOW, "$CC -E -D$dialect - < data/$ah-data |");
752 acontrol: while (<ALLOW>) {
753 next acontrol if (/^#/);
754 next acontrol if (/^[ ]*$/);
756 if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
758 } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
760 } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
762 } elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
765 # Remember that this name is allowed.
766 if ($type =~ /^struct *(.*)/) {
768 } elsif ($type =~ /^union *(.*)/) {
773 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
775 } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
777 } elsif (/^variable *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*)/) {
779 } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
781 } elsif (/^macro *([^ ]*)/) {
783 } elsif (/^allow *(.*)/) {
785 } elsif (/^allow-header *(.*)/) {
786 # XXX We should have a test for recursive dependencies here.
787 push @allowheader, $1;
793 # Now check the namespace.
794 printf (" Checking the namespace of \"%s\"... ", $h);
799 checknamespace ($h, $fnamebase, @allow);
805 printf "-" x 76 . "\n";
806 printf (" Total number of tests : %4d\n", $total);
808 printf (" Number of known failures: %4d (", $known);
809 $percent = ($known * 100) / $total;
810 if ($known > 0 && $percent < 1.0) {
813 printf ("%3d%%)\n", $percent);
816 printf (" Number of failed tests : %4d (", $errors);
817 $percent = ($errors * 100) / $total;
818 if ($errors > 0 && $percent < 1.0) {
821 printf ("%3d%%)\n", $percent);
824 printf (" Number of skipped tests : %4d (", $skipped);
825 $percent = ($skipped * 100) / $total;
826 if ($skipped > 0 && $percent < 1.0) {
829 printf ("%3d%%)\n", $percent);