]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Fixed test 577 to work when --enable-hidden-symbols is configured
authorDan Fandrich <dan@coneharvesters.com>
Fri, 14 May 2010 21:42:58 +0000 (14:42 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 14 May 2010 21:42:58 +0000 (14:42 -0700)
tests/data/test577
tests/libtest/lib577.c

index 5f1898f7028ffbda75725b35f135eae68fab838b..7a69ead208ce6ea837279bfe90eb8ba3aa825817 100644 (file)
@@ -18,6 +18,11 @@ none
 <tool>
 lib577
 </tool>
+# precheck is a command line to run before the test,
+# to see if we can execute the test or not
+<precheck>
+./libtest/lib577 check
+</precheck>
 
  <name>
 Curl_fnmatch() testing
index 8b434f8fb33edfa6b760dfa380cc18b681e9690e..ac995c3fc81256ee21a47c4f78925fa101680bbb 100644 (file)
@@ -9,6 +9,25 @@
 
 #include "test.h"
 
+/*
+ * This hacky test bypasses the library external API,
+ * using internal only libcurl functions. So don't be
+ * surprised if we cannot run it when the library has
+ * been built with hidden symbols, exporting only the
+ * ones in the public API.
+ */
+
+#if defined(CURL_HIDDEN_SYMBOLS)
+#  define SKIP_TEST 1
+#elif defined(WIN32) && !defined(CURL_STATICLIB)
+#  define SKIP_TEST 1
+#else
+#  undef  SKIP_TEST
+#endif
+
+
+#if !defined(SKIP_TEST)
+
 #include "memdebug.h"
 
 #include "curl_fnmatch.h"
@@ -204,6 +223,12 @@ int test(char *URL)
   int testnum = sizeof(tests) / sizeof(struct testcase);
   int i, rc;
   (void)URL; /* not used */
+
+  if(!strcmp(URL, "check")) {
+    /* test harness script verifying if this test can run */
+    return 0; /* sure, run this! */
+  }
+
   printf("===========================\n");
   for(i = 0; i < testnum; i++) {
     rc = Curl_fnmatch(tests[i].pattern, tests[i].string);
@@ -215,3 +240,16 @@ int test(char *URL)
   printf("===========================\n");
   return 0;
 }
+
+#else /* !defined(SKIP_TEST) */
+
+
+int test(char *URL)
+{
+  (void)URL;
+  fprintf(stdout, "libcurl built with hidden symbols");
+  return 1; /* skip test */
+}
+
+
+#endif /* !defined(SKIP_TEST) */