test-exclude: skip tests rather than failing on deficient systems
authorJim Meyering <meyering@redhat.com>
Fri, 11 Nov 2011 13:37:59 +0000 (14:37 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 11 Nov 2011 13:38:06 +0000 (14:38 +0100)
* 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

ChangeLog
tests/test-exclude.c

index 0c4eff9..d35f6c6 100644 (file)
--- 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.
index 9c7997d..47392d9 100644 (file)
@@ -104,6 +104,15 @@ main (int argc, char **argv)
             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)