about summary refs log tree commit diff
path: root/conform
diff options
context:
space:
mode:
Diffstat (limited to 'conform')
-rw-r--r--conform/conformtest.pl112
-rw-r--r--conform/data/unistd.h-data15
2 files changed, 82 insertions, 45 deletions
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index e98975bc3f..0f8cbd286f 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -1,26 +1,28 @@
 #! /usr/bin/perl
 
 $CC = "gcc";
-$CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
+$CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=600";
 
 # List of the headers we are testing.
 @headers = ("wordexp.h", "wctype.h", "wchar.h", "varargs.h", "utmpx.h",
-	     "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "time.h",
-	     "termios.h", "tar.h", "sys/wait.h", "sys/utsname.h", "sys/un.h",
-	     "sys/uio.h", "sys/types.h", "sys/times.h", "sys/timeb.h",
-	     "sys/time.h", "sys/statvfs.h", "sys/stat.h", "sys/socket.h",
-	     "sys/shm.h", "sys/sem.h", "sys/resource.h", "sys/msg.h",
-	     "sys/mman.h", "sys/ipc.h", "syslog.h", "stropts.h", "strings.h",
-	     "string.h", "stdlib.h", "stdio.h", "stddef.h", "stdarg.h",
-	     "spawn.h", "signal.h", "setjmp.h", "semaphore.h",
-	     "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
-	     "poll.h", "nl_types.h", "netinet/tcp.h", "netinet/in.h",
-	     "net/if.h", "netdb.h", "ndbm.h", "mqueue.h", "monetary.h",
-	     "math.h", "locale.h", "libgen.h", "limits.h", "langinfo.h",
-	     "iso646.h", "inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h",
-	     "fnmatch.h", "fmtmsg.h", "float.h", "fcntl.h", "errno.h",
-	     "dlfcn.h", "dirent.h", "ctype.h", "cpio.h", "assert.h",
-	     "arpa/inet.h", "aio.h");
+	    "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "time.h",
+	    "termios.h", "tar.h", "sys/wait.h", "sys/utsname.h", "sys/un.h",
+	    "sys/uio.h", "sys/types.h", "sys/times.h", "sys/timeb.h",
+	    "sys/time.h", "sys/statvfs.h", "sys/stat.h", "sys/socket.h",
+	    "sys/shm.h", "sys/sem.h", "sys/resource.h", "sys/msg.h",
+	    "sys/mman.h", "sys/ipc.h", "syslog.h", "stropts.h", "strings.h",
+	    "string.h", "stdlib.h", "stdio.h", "stddef.h", "stdarg.h",
+	    "spawn.h", "signal.h", "setjmp.h", "semaphore.h",
+	    "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
+	    "poll.h", "nl_types.h", "netinet/tcp.h", "netinet/in.h",
+	    "net/if.h", "netdb.h", "ndbm.h", "mqueue.h", "monetary.h",
+	    "math.h", "locale.h", "libgen.h", "limits.h", "langinfo.h",
+	    "iso646.h", "inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h",
+	    "fnmatch.h", "fmtmsg.h", "float.h", "fcntl.h", "errno.h",
+	    "dlfcn.h", "dirent.h", "ctype.h", "cpio.h", "assert.h",
+	    "arpa/inet.h", "aio.h");
+
+@headers = ('unistd.h');
 
 # These are the ISO C99 keywords.
 @keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
@@ -29,14 +31,23 @@ $CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
 	     'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
 	     'typedef', 'union', 'unsigned', 'void', 'volatile', 'while');
 
+# These are symbols which are known to pollute the namespace.
+@knownproblems = ('unix', 'linux', 'i386');
+
 # Some headers need a bit more attention.
 $mustprepend{'regex.h'} = "#include <sys/types.h>\n";
+$mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
 
-# Make an hash table from this information.
-while ($#keywords) {
+# Make a hash table from this information.
+while ($#keywords >= 0) {
   $iskeyword{pop (@keywords)} = 1;
 }
 
+# Make a hash table from the known problems.
+while ($#knownproblems >= 0) {
+  $isknown{pop (@knownproblems)} = 1;
+}
+
 $tmpdir = "/tmp";
 
 $verbose = 1;
@@ -179,31 +190,29 @@ sub runtest
 
 
 sub newtoken {
-  my($token, $nerrors, @allow) = @_;
+  my($token, @allow) = @_;
   my($idx);
 
-  if ($token =~ /^[0-9_]/ || $iskeyword{$token}) {
-    return $nerrors;
-  }
+  return if ($token =~ /^[0-9_]/ || $iskeyword{$token});
 
   for ($idx = 0; $idx <= $#allow; ++$idx) {
-    if (poorfnmatch ($allow[$idx], $token)) {
-      return $nerrors;
-    }
+    return if (poorfnmatch ($allow[$idx], $token));
   }
 
-  ++$nerrors;
-  if ($nerrors == 1) {
-    printf ("FAIL\n    " . "-" x 72 . "\n");
+  if ($isknown{$token}) {
+    ++$nknown;
+  } else {
+    ++$nerrors;
+    if ($nerrors == 1) {
+      printf ("FAIL\n    " . "-" x 72 . "\n");
+    }
+    printf ("    Namespace violation: \"%s\"\n", $token);
   }
-  printf ("    Namespace violation: \"%s\"\n", $token);
-  return $nerrors;
 }
 
 
 sub checknamespace {
   my($h, $fnamebase, @allow) = @_;
-  my($nerrors) = 0;
 
   ++$total;
 
@@ -212,12 +221,14 @@ sub checknamespace {
   print TESTFILE "#include <$h>\n";
   close (TESTFILE);
 
+  $nerrors = 0;
+  $nknown = 0;
   open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
   loop: while (<CONTENT>) {
     next loop if (/^#undef /);
     chop;
     if (/^#define (.*)/) {
-      $nerrors = newtoken ($1, $nerrors, @allow);
+      newtoken ($1, @allow);
     } else {
       # We have to tokenize the line.
       my($str) = $_;
@@ -226,7 +237,7 @@ sub checknamespace {
 
       foreach $token (split(/[^a-zA-Z0-9_]/, $str)) {
 	if ($token ne "") {
-	  $nerrors = newtoken ($token, $nerrors, @allow);
+	  newtoken ($token, @allow);
 	}
       }
     }
@@ -236,6 +247,9 @@ sub checknamespace {
   if ($nerrors != 0) {
     printf ("    " . "-" x 72 . "\n");
     ++$errors;
+  } elsif ($nknown > 0) {
+    printf ("EXPECTED FAILURES\n");
+    ++$known;
   } else {
     printf ("OK\n");
   }
@@ -272,7 +286,7 @@ while ($#headers >= 0) {
     next control if (/^#/);
     next control if (/^[	]*$/);
 
-    if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
+    if (/^element *({([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
       my($struct) = "$2$3";
       my($type) = "$5$6";
       my($member) = "$7";
@@ -726,8 +740,30 @@ while ($#headers >= 0) {
 }
 
 printf "-" x 76 . "\n";
-printf ("  Total number of tests  : %4d\n", $total);
-printf ("  Number of failed tests : %4d (%3d%%)\n", $errors, ($errors * 100) / $total);
-printf ("  Number of skipped tests: %4d (%3d%%)\n", $skipped, ($skipped * 100) / $total);
+printf ("  Total number of tests   : %4d\n", $total);
+
+printf ("  Number of known failures: %4d (", $known);
+$percent = ($known * 100) / $total;
+if ($percent < 1.0) {
+  printf (" <1%%)\n");
+} else {
+  printf ("%3d%%)\n", $percent);
+}
+
+printf ("  Number of failed tests  : %4d (", $errors);
+$percent = ($errors * 100) / $total;
+if ($percent < 1.0) {
+  printf (" <1%%)\n");
+} else {
+  printf ("%3d%%)\n", $percent);
+}
+
+printf ("  Number of skipped tests : %4d (", $skipped);
+$percent = ($skipped * 100) / $total;
+if ($percent < 1.0) {
+  printf (" <1%%)\n");
+} else {
+  printf ("%3d%%)\n", $percent);
+}
 
 exit $errors != 0;
diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data
index 5bec906ebd..70f598b3e4 100644
--- a/conform/data/unistd.h-data
+++ b/conform/data/unistd.h-data
@@ -5,7 +5,7 @@ constant _XOPEN_XCU_VERSION
 
 constant _POSIX2_C_BIND
 constant _POSIX2_CHAR_TERM
-constant _POSIX2_LOCALDEF
+constant _POSIX2_LOCALEDEF
 constant _POSIX2_UPE
 constant _POSIX2_VERSION
 
@@ -232,8 +232,8 @@ constant _SC_XOPEN_REALTIME_THREADS
 constant _SC_STREAMS
 constant _SC_XBS5_ILP32_OFF32
 constant _SC_XBS5_ILP32_OFFBIG
-constant _SC_XBS5_ILP64_OFF64
-constant _SC_XBS5_ILPIBIG_OFFBIG
+constant _SC_XBS5_LP64_OFF64
+constant _SC_XBS5_LPBIG_OFFBIG
 
 constant F_LOCK
 constant F_ULOCK
@@ -283,7 +283,8 @@ function int close (int)
 function size_t confstr (int, char*, size_t)
 function {char*} crypt (const char*, const char*)
 function {char*} ctermid (char*)
-function {char*} cuserid (char*)
+// cuserid got removed in XPG6
+allow cuserid
 function int dup (int)
 function int dup2 (int, int)
 function void encrypt (char[64], int)
@@ -291,7 +292,7 @@ function int execl (const char*, const char*, ...)
 function int execle (const char*, const char*, ...)
 function int execlp (const char*, const char*, ...)
 function int execv (const char*, char *const[])
-function int execve (const char*, char *const[])
+function int execve (const char*, char *const[], char *const[])
 function int execvp (const char*, char *const[])
 function void _exit (int)
 function int fchown (int, uid_t, gid_t)
@@ -317,7 +318,7 @@ function pid_t getpgid (pid_t)
 function pid_t getpgrp (void)
 function pid_t getpid (void)
 function pid_t getppid (void)
-function pid_t getsid (void)
+function pid_t getsid (pid_t)
 function uid_t getuid (void)
 function {char*} getwd (char*)
 function int isatty (int)
@@ -346,7 +347,7 @@ function int setreuid (uid_t, uid_t)
 function pid_t setsid (void)
 function int setuid (uid_t)
 function {unsigned int} sleep (unsigned int)
-function void swab (const char*, void*, ssize_t)
+function void swab (const void*, void*, ssize_t)
 function int symlink (const char*, const char*)
 function void sync (void)
 function {long int} sysconf (int)