aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2010-05-14 14:42:58 -0700
committerDan Fandrich <dan@coneharvesters.com>2010-05-14 14:42:58 -0700
commit43b816538fbbac07ca7ccc2dc647c972c3ee072a (patch)
treef3919626d841a55cc86d73b458bfeddb00ba72b4
parent77cfeadfa6405c5808273f1d3cc8e89eb17e5f08 (diff)
Fixed test 577 to work when --enable-hidden-symbols is configured
-rw-r--r--tests/data/test5775
-rw-r--r--tests/libtest/lib577.c38
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/data/test577 b/tests/data/test577
index 5f1898f70..7a69ead20 100644
--- a/tests/data/test577
+++ b/tests/data/test577
@@ -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
diff --git a/tests/libtest/lib577.c b/tests/libtest/lib577.c
index 8b434f8fb..ac995c3fc 100644
--- a/tests/libtest/lib577.c
+++ b/tests/libtest/lib577.c
@@ -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) */