changeset 16076:34f07bcc4983

test-exclude: skip tests rather than failing on deficient systems * tests/test-exclude.c (main): Skip tests that use FNM_CASEFOLD and FNM_LEADING_DIR on systems that lack the definitions. This affects at least Solaris 9. Reported and diagnosed by Dagobert Michelsen in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3947/focus=3950
author Jim Meyering <meyering@redhat.com>
date Fri, 11 Nov 2011 14:37:59 +0100
parents e3c3fdcd0910
children 5168b3ab1d02
files ChangeLog tests/test-exclude.c
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-11-11  Jim Meyering  <meyering@redhat.com>
+
+	test-exclude: skip tests rather than failing on deficient systems
+	* tests/test-exclude.c (main): Skip tests that use FNM_CASEFOLD
+	and FNM_LEADING_DIR on systems that lack the definitions.  This affects
+	at least Solaris 9.  Reported and diagnosed by Dagobert Michelsen in
+	http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3947/focus=3950
+
 2011-11-10  Bruno Haible  <bruno@clisp.org>
 
 	ptsname_r test: Avoid gcc warning on glibc systems.
--- a/tests/test-exclude.c
+++ b/tests/test-exclude.c
@@ -104,6 +104,15 @@
             exclude_options &= ~flag;
           else
             exclude_options |= flag;
+
+          /* Skip this test if invoked with -leading-dir on a system that
+             lacks support for FNM_LEADING_DIR. */
+          if (strcmp (s, "leading-dir") == 0 && FNM_LEADING_DIR == 0)
+            exit (77);
+
+          /* Likewise for -casefold and FNM_CASEFOLD.  */
+          if (strcmp (s, "casefold") == 0 && FNM_CASEFOLD == 0)
+            exit (77);
         }
       else if (add_exclude_file (add_exclude, exclude, opt,
                                  exclude_options, '\n') != 0)