about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--conform/Makefile7
-rw-r--r--conform/conformtest.pl13
3 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bcfa26e2bb..1f8760f571 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-03-17  Joseph Myers  <joseph@codesourcery.com>
+
+	* conform/conformtest.pl ($xfail_str): New variable.
+	(--xfail=): New command-line option.
+	(top level): Handle expectations starting xfail[cond]-.
+	* conform/Makefile (conformtest-xfail): New variable.
+	($(conformtest-header-tests)): Pass $(conformtest-xfail) to
+	conformtest.pl.
+
 2017-03-16  Joseph Myers  <joseph@codesourcery.com>
 
 	* conform/conformtest.pl: Use compilation instead of execution
diff --git a/conform/Makefile b/conform/Makefile
index b393641e5d..c07cc1d8d9 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -192,13 +192,18 @@ test-xfail-XOPEN2K8/signal.h/conform = yes
 test-xfail-XOPEN2K8/sys/wait.h/conform = yes
 
 conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I..
+# conformtest-xfail-conds may be set by a sysdeps Makefile fragment to
+# a list of conditions that are considered to be true when encountered
+# in xfail[cond]- lines in test expectations.
+conformtest-xfail = $(if $(conformtest-xfail-conds),\
+			 --xfail='$(conformtest-xfail-conds)')
 $(conformtest-header-tests): $(objpfx)%/conform.out: \
 			     conformtest.pl $(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 > $@); \
+		 --headers=$$hdr $(conformtest-xfail) > $@); \
 	$(evaluate-test)
 
 $(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index 54b38f85e9..41682e9b86 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -7,8 +7,10 @@ use POSIX;
 $standard = "XOPEN2K8";
 $CC = "gcc";
 $tmpdir = "/tmp";
+$xfail_str = "";
 GetOptions ('headers=s' => \@headers, 'standard=s' => \$standard,
-	    'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir);
+	    'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir,
+	    'xfail=s' => \$xfail_str);
 @headers = split(/,/,join(',',@headers));
 
 # List of the headers we are testing.
@@ -347,6 +349,15 @@ while ($#headers >= 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-/) {