This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi Uli, here's a patch for conformtest. Now you can say: macro-str STRING "123" (testing the value of a string) constant VALUE >= 10 (testing that the value is >= 10 - in fact you can use any combination of <=> - as long as it's valid C code) For further examples check my other two patches. I'm not sure where which preprocessor macro should be used in limits.h - please fix this. Andreas 2000-05-02 Andreas Jaeger <aj@suse.de> * conform/conformtest.pl: Test for macros with string constants, check for minimum and maximum values. Add limits.h to headers. * conform/data/cpio.h-data: Test for value of MAGIC. * conform/data/limits.h-data: New file. ============================================================ Index: conform/conformtest.pl --- conform/conformtest.pl 2000/04/30 03:26:44 1.11 +++ conform/conformtest.pl 2000/05/02 18:12:05 @@ -5,22 +5,24 @@ # 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', 'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', @@ -307,6 +309,79 @@ 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,6 +601,38 @@ compiletest ($fnamebase, "Test for type of function $fname", "Function \"$fname\" has incorrect type.", $res); + } 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"; ============================================================ Index: conform/data/cpio.h-data --- conform/data/cpio.h-data 1999/08/24 20:34:18 1.2 +++ conform/data/cpio.h-data 2000/05/02 18:12:05 @@ -19,8 +19,8 @@ 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 ============================================================ Index: conform/data/limits.h-data --- conform/data/limits.h-data created +++ conform/data/limits.h-data Tue May 2 20:03:30 2000 1.1 @@ -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 + -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.rhein-neckar.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |