From 43b816538fbbac07ca7ccc2dc647c972c3ee072a Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 14 May 2010 14:42:58 -0700 Subject: Fixed test 577 to work when --enable-hidden-symbols is configured --- tests/data/test577 | 5 +++++ tests/libtest/lib577.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) 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 lib577 +# precheck is a command line to run before the test, +# to see if we can execute the test or not + +./libtest/lib577 check + 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) */ -- cgit v1.2.3