diff options
| author | Joseph Myers <joseph@codesourcery.com> | 2018-11-09 13:54:06 +0000 |
|---|---|---|
| committer | Joseph Myers <joseph@codesourcery.com> | 2018-11-09 13:54:06 +0000 |
| commit | c3ec097256a1fad362bdc9cdaf56fddf3c621d10 (patch) | |
| tree | ba987ffd27475a8719c77accade9baed0d73a070 | |
| parent | 43257c335ad6b9e05fb882975e1776ff763164ee (diff) | |
| download | glibc-c3ec097256a1fad362bdc9cdaf56fddf3c621d10.tar.xz glibc-c3ec097256a1fad362bdc9cdaf56fddf3c621d10.zip | |
Replace conformtest.pl with conformtest.py.
Continuing the consolidation on Python for various miscellaneous build
and test scripts, this patch moves conformtest from Perl to Python.
The substance of the tests run is intended to be the same as before,
except that the previous test for tags did not actually achieve the
intended purpose of verifying whether a tag was already declared, so
is changed to one that would actually fail for a tag that wasn't
declared, and a typo in the old test for variables being available
($xyzzy instead of xyzzy) would have made that test not use the
correct type (but it would have passed anyway with warnings). No
attempt is made to keep the details of what the test output looks
like; instead, tests are given names which are made to follow PASS: /
FAIL: / XFAIL: / SKIP: / MISSING: as appropriate.
In the new version, there is more consistent parsing of test lines
(into a series of words, either surrounded by {} or separated by
spaces) that applies for all kinds of test lines, rather than the old
approach of different regular expressions for every kind of test. A
few of the conform/data/ files are adjusted so their syntax works with
the new script (which now requires spaces in certain cases where the
old script tolerated them being missing, and does not allow stray
semicolons at the end of "function" lines). Similarly, common logic
is used around what happens with a second subtest if a first one fails
(e.g., a test for a symbol's type if the test for availability fails),
rather than such logic being replicated separately for each kind of
test. Common parsing also applies for test lines both when they are
lines for the header under test and when they are lines for another
header specified with allow-header, again unlike the old script.
Tested for x86_64, and with build-many-glibcs.py.
* conform/conformtest.py: New file.
* conform/conformtest.pl: Remove.
* conform/GlibcConform.pm: Likewise.
* conform/glibcconform.py (KEYWORDS_C90): New constant.
(KEYWORDS_C99): Likewise.
(KEYWORDS): Likewise.
* conform/Makefile ($(conformtest-header-tests)): Use
conformtest.py instead of conformtest.pl. Do not pass --tmpdir
option. Use --header instead of --headers.
* conform/data/arpa/inet.h-data: Remove trailing semicolons on
function entries.
* conform/data/spawn.h-data: Likewise.
* conform/data/fcntl.h-data (openat): Add space after function
name.
* conform/data/wchar.h-data (wcscasecmp): Likewise.
(wcscasecmp_l): Likewise.
* conform/data/termios.h-data (c_cc): Add space after element
name.
| -rw-r--r-- | ChangeLog | 21 | ||||
| -rw-r--r-- | conform/GlibcConform.pm | 74 | ||||
| -rw-r--r-- | conform/Makefile | 10 | ||||
| -rw-r--r-- | conform/conformtest.pl | 898 | ||||
| -rw-r--r-- | conform/conformtest.py | 664 | ||||
| -rw-r--r-- | conform/data/arpa/inet.h-data | 24 | ||||
| -rw-r--r-- | conform/data/fcntl.h-data | 2 | ||||
| -rw-r--r-- | conform/data/spawn.h-data | 4 | ||||
| -rw-r--r-- | conform/data/termios.h-data | 2 | ||||
| -rw-r--r-- | conform/data/wchar.h-data | 4 | ||||
| -rw-r--r-- | conform/glibcconform.py | 22 |
11 files changed, 730 insertions, 995 deletions
@@ -1,3 +1,24 @@ +2018-11-09 Joseph Myers <joseph@codesourcery.com> + + * conform/conformtest.py: New file. + * conform/conformtest.pl: Remove. + * conform/GlibcConform.pm: Likewise. + * conform/glibcconform.py (KEYWORDS_C90): New constant. + (KEYWORDS_C99): Likewise. + (KEYWORDS): Likewise. + * conform/Makefile ($(conformtest-header-tests)): Use + conformtest.py instead of conformtest.pl. Do not pass --tmpdir + option. Use --header instead of --headers. + * conform/data/arpa/inet.h-data: Remove trailing semicolons on + function entries. + * conform/data/spawn.h-data: Likewise. + * conform/data/fcntl.h-data (openat): Add space after function + name. + * conform/data/wchar.h-data (wcscasecmp): Likewise. + (wcscasecmp_l): Likewise. + * conform/data/termios.h-data (c_cc): Add space after element + name. + 2018-11-08 Gabriel F. T. Gomes <gabriel@inconstante.eti.br> * argp/tst-ldbl-argp.c (do_one_test): Use TEST_COMPARE_STRING, diff --git a/conform/GlibcConform.pm b/conform/GlibcConform.pm deleted file mode 100644 index ba9c7e822f..0000000000 --- a/conform/GlibcConform.pm +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/perl - -# Shared code for glibc conformance tests. - -# Copyright (C) 2014-2018 Free Software Foundation, Inc. -# This file is part of the GNU C Library. - -# The GNU C Library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. - -# The GNU C Library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public -# License along with the GNU C Library; if not, see -# <http://www.gnu.org/licenses/>. - -package GlibcConform; -require Exporter; -@ISA = qw(Exporter); -@EXPORT = qw(%CFLAGS list_exported_functions); - -# Compiler options for each standard. -$CFLAGS{"ISO"} = "-ansi"; -$CFLAGS{"ISO99"} = "-std=c99"; -$CFLAGS{"ISO11"} = "-std=c11"; -$CFLAGS{"POSIX"} = "-D_POSIX_C_SOURCE=199506L -ansi"; -$CFLAGS{"XPG4"} = "-ansi -D_XOPEN_SOURCE"; -$CFLAGS{"XPG42"} = "-ansi -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"; -$CFLAGS{"UNIX98"} = "-ansi -D_XOPEN_SOURCE=500"; -$CFLAGS{"XOPEN2K"} = "-std=c99 -D_XOPEN_SOURCE=600"; -$CFLAGS{"XOPEN2K8"} = "-std=c99 -D_XOPEN_SOURCE=700"; -$CFLAGS{"POSIX2008"} = "-std=c99 -D_POSIX_C_SOURCE=200809L"; - -# Return a list of functions exported by a header, empty if an include -# of the header does not compile. -sub list_exported_functions { - my ($cc, $standard, $header, $tmpdir) = @_; - my ($cc_all) = "$cc -D_ISOMAC $CFLAGS{$standard}"; - my ($tmpfile) = "$tmpdir/list-$$.c"; - my ($auxfile) = "$tmpdir/list-$$.c.aux"; - my ($ret); - my (%res) = (); - open (TMPFILE, ">$tmpfile") || die ("open $tmpfile: $!\n"); - print TMPFILE "#include <$header>\n"; - close (TMPFILE) || die ("close $tmpfile: $!\n"); - $ret = system "$cc_all -c $tmpfile -o /dev/null -aux-info $auxfile > /dev/null"; - unlink ($tmpfile) || die ("unlink $tmpfile: $!\n"); - if ($ret != 0) { - return; - } - open (AUXFILE, "<$auxfile") || die ("open $auxfile: $!\n"); - while (<AUXFILE>) { - s|/\*.*?\*/||g; - if (/^\s*$/) { - next; - } - # The word before a '(' that isn't '(*' is the function name - # before the argument list (not fully general, but sufficient for - # -aux-info output on standard headers). - if (/(\w+)\s*\([^*]/) { - $res{$1} = 1; - } else { - die ("couldn't parse -aux-info output: $_\n"); - } - } - close (AUXFILE) || die ("close $auxfile: $!\n"); - unlink ($auxfile) || die ("unlink $auxfile: $!\n"); - return sort keys %res; -} diff --git a/conform/Makefile b/conform/Makefile index fbc4110688..a428fbf937 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -172,13 +172,13 @@ else conformtest-cross = --cross endif $(conformtest-header-tests): $(objpfx)%/conform.out: \ - conformtest.pl $(conformtest-headers-data) + conformtest.py $(conformtest-headers-data) (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ mkdir -p $(@D)/scratch; \ - $(PERL) -I. conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$$std \ - --headers=$$hdr $(conformtest-xfail) $(conformtest-cross) \ - > $@); \ + $(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \ + --standard=$$std --header=$$hdr $(conformtest-xfail) \ + $(conformtest-cross) \ + > $@ 2>&1); \ $(evaluate-test) $(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.py diff --git a/conform/conformtest.pl b/conform/conformtest.pl deleted file mode 100644 index a4ef756105..0000000000 --- a/conform/conformtest.pl +++ /dev/null @@ -1,898 +0,0 @@ -#!/usr/bin/perl - -use GlibcConform; -use Getopt::Long; -use POSIX; - -$standard = "XOPEN2K8"; -$CC = "gcc"; -$tmpdir = "/tmp"; -$cross = ""; -$xfail_str = ""; -GetOptions ('headers=s' => \@headers, 'standard=s' => \$standard, - 'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir, - 'cross' => \$cross, 'xfail=s' => \$xfail_str); -@headers = split(/,/,join(',',@headers)); - -# List of the headers we are testing. -if (@headers == ()) { - @headers = ("wordexp.h", "wctype.h", "wchar.h", "varargs.h", "utmpx.h", - "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "uchar.h", - "time.h", "tgmath.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/select.h", "sys/resource.h", "sys/msg.h", "sys/mman.h", - "sys/ipc.h", "syslog.h", "stropts.h", "strings.h", "string.h", - "stdnoreturn.h", "stdlib.h", "stdio.h", "stdint.h", "stddef.h", - "stdbool.h", "stdarg.h", "stdalign.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", "fenv.h", - "fcntl.h", "errno.h", "dlfcn.h", "dirent.h", "ctype.h", "cpio.h", - "complex.h", "assert.h", "arpa/inet.h", "aio.h"); -} - -$CFLAGS_namespace = "$flags -fno-builtin $CFLAGS{$standard} -D_ISOMAC"; -$CFLAGS = "$CFLAGS_namespace '-D__attribute__(x)='"; - -# Check standard name for validity. -die "unknown standard \"$standard\"" if ($CFLAGS{$standard} eq ""); - -# if ($standard ne "XOPEN2K8" && $standard ne "POSIX2008") { -# # Some headers need a bit more attention. At least with XPG7 -# # all headers should be self-contained. -# $mustprepend{'inttypes.h'} = "#include <stddef.h>\n"; -# $mustprepend{'glob.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'grp.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'regex.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'pwd.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'sched.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'signal.h'} = "#include <pthread.h>\n#include <sys/types.h>\n"; -# $mustprepend{'stdio.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'sys/stat.h'} = "#include <sys/types.h>\n"; -# $mustprepend{'wchar.h'} = "#include <stdarg.h>\n"; -# $mustprepend{'wordexp.h'} = "#include <stddef.h>\n"; -# } - -# These are the ISO C90 keywords. -@keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default', - 'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', - 'if', 'int', 'long', 'register', 'return', - 'short', 'signed', 'sizeof', 'static', 'struct', 'switch', - 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while'); -if ($CFLAGS{$standard} =~ /-std=(c99|c1x)/) { - push (@keywords, 'inline', 'restrict'); -} - -# Make a hash table from this information. -while ($#keywords >= 0) { - $iskeyword{pop (@keywords)} = 1; -} - -$verbose = 1; - -$total = 0; -$skipped = 0; -$errors = 0; -$xerrors = 0; - -sub note_error { - my($xfail) = @_; - if ($xfail) { - $xerrors++; - printf ("Ignoring this failure.\n"); - } else { - $errors++; - } -} - - -sub poorfnmatch { - my($pattern, $string) = @_; - my($strlen) = length ($string); - my($res); - - if (substr ($pattern, 0, 1) eq '*') { - my($patlen) = length ($pattern) - 1; - $res = ($strlen >= $patlen - && substr ($pattern, -$patlen, $patlen) eq substr ($string, -$patlen, $patlen)); - } elsif (substr ($pattern, -1, 1) eq '*') { - if (substr ($pattern, -2, 1) eq ']') { - my($patlen) = index ($pattern, '['); - my($range) = substr ($pattern, $patlen + 1, -2); - $res = ($strlen > $patlen - && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen) - && index ($range, substr ($string, $patlen, 1)) != -1); - } else { - my($patlen) = length ($pattern) - 1; - $res = ($strlen >= $patlen - && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen)); - } - } else { - $res = $pattern eq $string; - } - return $res; -} - - -sub compiletest -{ - my($fnamebase, $msg, $errmsg, $skip, $optional, $xfail) = @_; - my($result) = $skip; - my($printlog) = 0; - - ++$total; - printf (" $msg..."); - - if ($skip != 0) { - ++$skipped; - printf (" SKIP\n"); - } else { - $ret = system "$CC $CFLAGS -c $fnamebase.c -o $fnamebase.o > $fnamebase.out 2>&1"; - if ($ret != 0) { - if ($optional != 0) { - printf (" $errmsg\n"); - $result = 1; - } else { - printf (" FAIL\n"); - if ($verbose != 0) { - printf (" $errmsg Compiler message:\n"); - $printlog = 1; - } - note_error($xfail); - $result = 1; - } - } else { - printf (" OK\n"); - if ($verbose > 1 && -s "$fnamebase.out") { - # We print all warnings issued. - $printlog = 1; - } - } - if ($printlog != 0) { - printf (" " . "-" x 71 . "\n"); - open (MESSAGE, "< $fnamebase.out"); - while (<MESSAGE>) { - printf (" %s", $_); - } - close (MESSAGE); - printf (" " . "-" x 71 . "\n"); - } - } - unlink "$fnamebase.c"; - unlink "$fnamebase.o"; - unlink "$fnamebase.out"; - - $result; -} - - -sub runtest -{ - my($fnamebase, $msg, $errmsg, $skip, $xfail) = @_; - my($result) = $skip; - my($printlog) = 0; - - ++$total; - printf (" $msg..."); - - if ($skip != 0) { - ++$skipped; - printf (" SKIP\n"); - } else { - $ret = system "$CC $CFLAGS -o $fnamebase $fnamebase.c > $fnamebase.out 2>&1"; - if ($ret != 0) { - printf (" FAIL\n"); - if ($verbose != 0) { - printf (" $errmsg Compiler message:\n"); - $printlog = 1; - } - note_error($xfail); - $result = 1; - } elsif ($cross) { - printf (" SKIP\n"); - } else { - # Now run the program. If the exit code is not zero something is wrong. - $result = system "$fnamebase > $fnamebase.out2 2>&1"; - if ($result == 0) { - printf (" OK\n"); - if ($verbose > 1 && -s "$fnamebase.out") { - # We print all warnings issued. - $printlog = 1; - system "cat $fnamebase.out2 >> $fnamebase.out"; - } - } else { - printf (" FAIL\n"); - note_error($xfail); - $printlog = 1; - unlink "$fnamebase.out"; - rename "$fnamebase.out2", "$fnamebase.out"; - } - } - if ($printlog != 0) { - printf (" " . "-" x 71 . "\n"); - open (MESSAGE, "< $fnamebase.out"); - while (<MESSAGE>) { - printf (" %s", $_); - } - close (MESSAGE); - printf (" " . "-" x 71 . "\n"); - } - } - unlink "$fnamebase"; - unlink "$fnamebase.c"; - unlink "$fnamebase.o"; - unlink "$fnamebase.out"; - unlink "$fnamebase.out2"; - - $result; -} - - -sub newtoken { - my($token, @allow) = @_; - my($idx); - - return if ($token =~ /^[0-9_]/ || $iskeyword{$token}); - - for ($idx = 0; $idx <= $#allow; ++$idx) { - return if (poorfnmatch ($allow[$idx], $token)); - } - - $errors{$token} = 1; -} - - -sub removetoken { - my($token) = @_; - my($idx); - - return if ($token =~ /^[0-9_]/ || $iskeyword{$token}); - - if (exists $errors{$token}) { - undef $errors{$token}; - } -} - - -sub checknamespace { - my($h, $fnamebase, @allow) = @_; - - ++$total; - - # Generate a program to get the contents of this header. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "#include <$h>\n"; - close (TESTFILE); - - undef %errors; - open (CONTENT, "$CC $CFLAGS_namespace -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |"); - loop: while (<CONTENT>) { - chop; - if (/^#define (.*)/) { - newtoken ($1, @allow); - } elsif (/^#undef (.*)/) { - removetoken ($1); - } else { - # We have to tokenize the line. - my($str) = $_; - - $str =~ s/"[^"]*"//g; - foreach $token (split(/[^a-zA-Z0-9_]/, $str)) { - if ($token ne "") { - newtoken ($token, @allow); - } - } - } - } - close (CONTENT); - unlink "$fnamebase.c"; - $realerror = 0; - if ($#errors != 0) { - # Sort the output list so it's easier to compare results with diff. - foreach $f (sort keys(%errors)) { - if ($errors{$f} == 1) { - if ($realerror == 0) { - printf ("FAIL\n " . "-" x 72 . "\n"); - $realerror = 1; - ++$errors; - } - printf (" Namespace violation: \"%s\"\n", $f); - } - } - printf (" " . "-" x 72 . "\n") if ($realerror != 0); - } - - if ($realerror == 0) { - printf ("OK\n"); - } -} - - -while ($#headers >= 0) { - my($h) = pop (@headers); - my($hf) = $h; - $hf =~ s|/|-|; - my($fnamebase) = "$tmpdir/$hf-test"; - my($missing) = 1; - my(@allow) = (); - my(@allowheader) = (); - my(%seenheader) = (); - my($prepend) = $mustprepend{$h}; - my($test_exist) = 1; - - printf ("Testing <$h>\n"); - printf ("----------" . "-" x length ($h) . "\n"); - - open (CONTROL, "$CC -E -D$standard -std=c99 -x c data/$h-data |"); - control: while (<CONTROL>) { - chop; - next control if (/^#/); - next control if (/^[ ]*$/); - - if ($test_exist) { - $test_exist = 0; - # Generate a program to test for the availability of this header. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "$prepend"; - print TESTFILE "#include <$h>\n"; - close (TESTFILE); - - $missing = compiletest ($fnamebase, "Checking whether <$h> is available", - "Header <$h> not available", 0, 0, 0); - printf ("\n"); - last control if ($missing); - } - - my($xfail) = 0; - if (/^xfail-/) { - s/^xfail-//; - $xfail = 1; - } elsif (/^xfail\[([^\]]*)\]-/) { - my($xfail_cond) = $1; - s/^xfail\[([^\]]*)\]-//; - # "xfail[cond]-" or "xfail[cond1|cond2|...]-" means a failure of - # the test is allowed if any of the listed conditions are in the - # --xfail command-line option argument. - if ($xfail_str =~ /\b($xfail_cond)\b/) { - $xfail = 1; - } - } - my($optional) = 0; - if (/^optional-/) { - s/^optional-//; - $optional = 1; - } - if (/^element *(\{([^}]*)\}|([^{ ]*)) *(\{([^}]*)\}|([^{ ]*)) *([A-Za-z0-9_]*) *(.*)/) { - my($struct) = "$2$3"; - my($type) = "$5$6"; - my($member) = "$7"; - my($rest) = "$8"; - my($res) = $missing; - - # Remember that this name is allowed. - push @allow, $member; - - # Generate a program to test for the availability of this member. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "$prepend"; - print TESTFILE "#include <$h>\n"; - print TESTFILE "$struct a;\n"; - print TESTFILE "$struct b;\n"; - print TESTFILE "extern void xyzzy (__typeof__ (&b.$member), __typeof__ (&a.$member), unsigned);\n"; - print TESTFILE "void foobarbaz (void) {\n"; - print TESTFILE " xyzzy (&a.$member, &b.$member, sizeof (a.$member));\n"; - print TESTFILE "}\n"; - close (TESTFILE); - - $res = compiletest ($fnamebase, "Testing for member $member", - ($optional - ? "NOT AVAILABLE." - : "Member \"$member\" not available."), $res, - $optional, $xfail); - - if ($res == 0 || $missing != 0 || !$optional) { - # Test the types of the members. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "$prepend"; - print TESTFILE "#include <$h>\n"; - print TESTFILE "$struct a;\n"; - print TESTFILE "extern $type b$rest;\n"; - print TESTFILE "extern __typeof__ (a.$member) b;\n"; - close (TESTFILE); - - compiletest ($fnamebase, "Testing for type of member $member", - "Member \"$member\" does not have the correct type.", - $res, 0, $xfail); - } - } elsif (/^(macro|constant|macro-constant|macro-int-constant) +([a-zA-Z0-9_]*) *(?:{([^}]*)} *)?(?:([>=<!]+) ([A-Za-z0-9_\\'-]*))?/) { - my($symbol_type) = $1; - my($symbol) = $2; - my($type) = $3; - my($op) = $4; - my($value) = $5; - my($res) = $missing; - my($mres) = $missing; - my($cres) = $missing; - - # Remember that this name is allowed. - push @allow, $symbol; - - if ($symbol_type =~ /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 $symbol\n"; - print TESTFILE "# error \"Macro $symbol not defined\"\n"; - print TESTFILE "#endif\n"; - close (TESTFILE); - - $mres = compiletest ($fnamebase, "Test availability of macro $symbol", - ($optional - ? "NOT PRESENT" - : "Macro \"$symbol\" is not available."), $res, - $optional, $xfail); - } - - if ($symbol_type =~ /constant/) { - # 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__ ($symbol) a = $symbol;\n"; - close (TESTFILE); - |
