diff options
Diffstat (limited to 'conform')
-rw-r--r-- | conform/conformtest.pl | 145 | ||||
-rw-r--r-- | conform/data/cpio.h-data | 4 | ||||
-rw-r--r-- | conform/data/limits.h-data | 129 |
3 files changed, 257 insertions, 21 deletions
diff --git a/conform/conformtest.pl b/conform/conformtest.pl index a7d984ab6c..20fdae384e 100644 --- a/conform/conformtest.pl +++ b/conform/conformtest.pl @@ -5,21 +5,23 @@ $CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500"; # 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", "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"); + # These are the ISO C99 keywords. @keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default', @@ -268,7 +270,7 @@ while ($#headers >= 0) { control: while (<CONTROL>) { chop; next control if (/^#/); - next control if (/^[ ]*$/); + next control if (/^[ ]*$/); if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) { my($struct) = "$2$3"; @@ -307,6 +309,79 @@ while ($#headers >= 0) { compiletest ($fnamebase, "Testing for type of member $member", "Member \"$member\" does not have the correct type.", $res); + } elsif (/^constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) { + my($const) = $1; + my($op) = $2; + my($value) = $3; + my($res) = $missing; + + # Remember that this name is allowed. + push @allow, $const; + + # Generate a program to test for the availability of this constant. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + print TESTFILE "__typeof__ ($const) a = $const;\n"; + close (TESTFILE); + + $res = compiletest ($fnamebase, "Testing for constant $const", + "Constant \"$const\" not available.", $res); + + if ($value ne "") { + # Generate a program to test for the value of this constant. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + # Negate the value since 0 means ok + print TESTFILE "int main (void) { return !($const $op $value); }\n"; + close (TESTFILE); + + $res = runtest ($fnamebase, "Testing for value of constant $const", + "Constant \"$const\" has not the right value.", $res); + } + } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) { + my($const) = $1; + my($type) = "$3$4"; + my($value) = $5; + my($res) = $missing; + + # Remember that this name is allowed. + push @allow, $const; + + # Generate a program to test for the availability of this constant. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + print TESTFILE "__typeof__ ($const) a = $const;\n"; + close (TESTFILE); + + $res = compiletest ($fnamebase, "Testing for constant $const", + "Constant \"$const\" not available.", $res); + + # Test the types of the members. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + print TESTFILE "__typeof__ (($type) 0) a;\n"; + print TESTFILE "extern __typeof__ ($const) a;\n"; + close (TESTFILE); + + compiletest ($fnamebase, "Testing for type of constant $const", + "Constant \"$const\" does not have the correct type.", + $res); + + if ($value ne "") { + # Generate a program to test for the value of this constant. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + print TESTFILE "int main (void) { return $const != $value; }\n"; + close (TESTFILE); + + $res = runtest ($fnamebase, "Testing for value of constant $const", + "Constant \"$const\" has not the right value.", $res); + } } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) { my($const) = $1; my($value) = $2; @@ -526,7 +601,39 @@ while ($#headers >= 0) { compiletest ($fnamebase, "Test for type of function $fname", "Function \"$fname\" has incorrect type.", $res); - } elsif (/^macro *([^ ]*)/) { + } elsif (/^macro-str *([^ ]*)\s*(\".*\")/) { + # The above regex doesn't handle a \" in a string. + my($macro) = "$1"; + my($string) = "$2"; + my($res) = $missing; + + # Remember that this name is allowed. + push @allow, $macro; + + # Generate a program to test for availability of this macro. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + print TESTFILE "#ifndef $macro\n"; + print TESTFILE "# error \"Macro $macro not defined\"\n"; + print TESTFILE "#endif\n"; + close (TESTFILE); + + compiletest ($fnamebase, "Test availability of macro $macro", + "Macro \"$macro\" is not available.", $missing); + + # Generate a program to test for the value of this macro. + open (TESTFILE, ">$fnamebase.c"); + print TESTFILE "$prepend"; + print TESTFILE "#include <$h>\n"; + # We can't include <string.h> here. + print TESTFILE "extern int (strcmp)(const char *, const char *);\n"; + print TESTFILE "int main (void) { return strcmp ($macro, $string) != 0;}\n"; + close (TESTFILE); + + $res = runtest ($fnamebase, "Testing for value of macro $macro", + "Macro \"$macro\" has not the right value.", $res); + } elsif (/^macro *([^ ]*)/) { my($macro) = "$1"; # Remember that this name is allowed. @@ -567,7 +674,7 @@ while ($#headers >= 0) { open (ALLOW, "$CC -E -D$dialect - < data/$ah-data |"); acontrol: while (<ALLOW>) { next acontrol if (/^#/); - next acontrol if (/^[ ]*$/); + next acontrol if (/^[ ]*$/); if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) { push @allow, $7; @@ -594,7 +701,7 @@ while ($#headers >= 0) { push @allow, $4; } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) { push @allow, $4; - } elsif (/^macro *([^ ]*)/) { + } elsif (/^macro *([^ ]*)/) { push @allow, $1; } elsif (/^allow *(.*)/) { push @allow, $1; diff --git a/conform/data/cpio.h-data b/conform/data/cpio.h-data index 10df73a72b..c6f4d8909c 100644 --- a/conform/data/cpio.h-data +++ b/conform/data/cpio.h-data @@ -19,8 +19,8 @@ constant C_ISCHR 0020000 constant C_ISCTG 0110000 constant C_ISLNK 0120000 constant C_ISSOCK 0140000 -# XXX We should be able to test a constant string content here. -constant MAGIC + +macro-str MAGIC "070707" allow *_t #endif diff --git a/conform/data/limits.h-data b/conform/data/limits.h-data new file mode 100644 index 0000000000..45864f8d3a --- /dev/null +++ b/conform/data/limits.h-data @@ -0,0 +1,129 @@ +// if these values exist, we should check the minimal value +allow AIO_LIST_MAX +allow AIO_MAX +allow AIO_PRIO_DELTA_MAX +allow ARG_MAX +allow ATEXT_MAX +allow CHILD_MAX +allow DELAYTIMER_MAX +allow IOV_MAX +allow LOGIN_NAME_MAX +allow MQ_OPEN_MAX +allow OPEN_MAX +allow PAGESIZE +allow PAGE_SIZE +allow PTHREAD_DESTRUCTOR_ITERATIONS +allow PTHREAD_KEYS_MAX +allow PTHREAD_STACK_MIN +allow PTHREAD_THREADS_MAX +allow RE_DUP_MAX +allow RTSIG_MAX +allow SEM_NSEMS_MAX +allow SEM_VALUE_MAX +allow SIGQUEUE_MAX +allow SS_REPL_MAX +allow STREAM_MAX +allow SYMLOOP_MAX +allow TIMER_MAX +allow TTY_NAME_MAX +allow TZNAME_MAX + +allow FILESIZEBITS +allow LINK_MAX +allow MAX_CANON +allow MAX_INPUT +allow NAME_MAX +allow PATH_MAX +allow PIPE_BUF +allow POSIX_ALLOC_SIZE_MIN +allow POSIX_REC_INCR_XFER_SIZE +allow POSIX_REC_MAX_XFER_SIZE +allow POSIX_REC_XFER_ALIGN +allow SYMLINK_MAX + +macro BC_BASE_MAX +macro BC_DIM_MAX +macro BC_SCALE_MAX +macro BC_STRING_MAX +macro CHARCLASS_NAME_MAX +macro COLL_WEIGHTS_MAX +macro EXPR_NEST_MAX +macro LINE_MAX +constant NGROUPS_MAX >= 8 +macro RE_DUP_MAX + +constant _POSIX_CLOCKRES_MIN <= 20000000 + +constant _POSIX_AIO_LISTIO_MAX 2 +constant _POSIX_AIO_MAX 1 +constant _POSIX_ARG_MAX 4096 +constant _POSIX_CHILD_MAX 6 +constant _POSIX_DELAYTIMER_MAX 32 +constant _POSIX_LINK_MAX 8 +constant _POSIX_LOGIN_NAME_MAX 9 +constant _POSIX_MAX_CANON 255 +constant _POSIX_MAX_INPUT 255 +constant _POSIX_MQ_OPEN_MAX 8 +constant _POSIX_MQ_PRIO_MAX 32 +constant _POSIX_NAME_MAX 14 +constant _POSIX_NGROUPS_MAX 0 +constant _POSIX_OPEN_MAX 16 +constant _POSIX_PATH_MAX 256 +constant _POSIX_PIPE_BUF 512 +constant _POSIX_RE_DUP_MAX 255 +constant _POSIX_RTSIG_MAX 8 +constant _POSIX_SEM_NSEMS_MAX 256 +constant _POSIX_SEM_VALUE_MAX 32767 +constant _POSIX_SIGQUEUE_MAX 32 +constant _POSIX_SSIZE_MAX 32767 +constant _POSIX_STREAM_MAX 8 +constant _POSIX_SS_REPL_MAX 4 +constant _POSIX_SYMLINK_MAX 255 +constant _POSIX_SYMLOOP_MAX 8 +constant _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +constant _POSIX_THREAD_KEYS_MAX 128 +constant _POSIX_THREAD_THREADS_MAX 64 +constant _POSIX_TIMER_MAX 32 +constant _POSIX_TTY_NAME_MAX 9 +constant _POSIX_TZNAME_MAX 6 +constant _POSIX2_BC_BASE_MAX 99 +constant _POSIX2_BC_DIM_MAX 2048 +constant _POSIX2_BC_SCALE_MAX 99 +constant _POSIX2_BC_STRING_MAX 1000 +constant _POSIX2_CHARCLASS_NAME_MAX 14 +constant _POSIX2_COLL_WEIGHTS_MAX 2 +constant _POSIX2_EXPR_NEST_MAX 32 +constant _POSIX2_LINE_MAX 2048 +constant _POSIX2_RE_DUP_MAX 255 +constant _XOPEN_IOV_MAX 16 + +constant CHAR_BIT >= 8 +constant CHAR_MAX +constant INT_MAX >= 2147483647 +constant LONG_BIT >= 32 +constant MB_LEN_MAX >= 1 +constant LONG_MAX >= 2147483647 +constant SCHAR_MAX >= 127 +constant SHRT_MAX >= 32767 +constant SSIZE_MAX +constant UCHAR_MAX >= 255 +constant UINT_MAX >= 4294967295 +constant ULONG_MAX >= 4294967295 +constant USHRT_MAX >= 65535 +constant WORD_BIT >= 16 +constant CHAR_MIN +constant INT_MIN <= 2147483647 +constant LONG_MIN <= 2147483647 +constant SCHAR_MIN <= -127 +constant SHRT_MIN <= -32767 + +constant CHARCLASS_NAME_MAX >= 14 +constant NL_ARGMAX >= 9 +constant NL_LANGMAX >= 14 +constant NL_MSGMAX >= 32767 +constant NL_NMAX +constant NL_SETMAX >= 255 +constant NL_TEXTMAX +constant NZERO >= 20 +constant TMP_MAX >= 10000 + |