Skip test #558 when libcurl is built with hidden symbols
This commit is contained in:
@@ -13,6 +13,11 @@ none
|
|||||||
<tool>
|
<tool>
|
||||||
lib558
|
lib558
|
||||||
</tool>
|
</tool>
|
||||||
|
# precheck is a command line to run before the test,
|
||||||
|
# to see if we can execute the test or not
|
||||||
|
<precheck>
|
||||||
|
./libtest/lib558 check
|
||||||
|
</precheck>
|
||||||
|
|
||||||
<name>
|
<name>
|
||||||
internal hash testing
|
internal hash testing
|
||||||
|
|||||||
@@ -27,6 +27,18 @@
|
|||||||
#include "memdebug.h"
|
#include "memdebug.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)
|
||||||
|
|
||||||
|
|
||||||
static Curl_addrinfo *fake_ai(void)
|
static Curl_addrinfo *fake_ai(void)
|
||||||
{
|
{
|
||||||
Curl_addrinfo *ai;
|
Curl_addrinfo *ai;
|
||||||
@@ -71,47 +83,50 @@ int test(char *URL)
|
|||||||
struct Curl_dns_entry *nodep;
|
struct Curl_dns_entry *nodep;
|
||||||
size_t key_len;
|
size_t key_len;
|
||||||
|
|
||||||
(void)URL; /* not used */
|
if(!strcmp(URL, "check")) {
|
||||||
|
/* test harness script verifying if this test can run */
|
||||||
|
return 0; /* sure, run this! */
|
||||||
|
}
|
||||||
|
|
||||||
easyh = curl_easy_init();
|
easyh = curl_easy_init();
|
||||||
if(!easyh) {
|
if(!easyh) {
|
||||||
printf("easy handle init failed\n");
|
fprintf(stdout, "easy handle init failed\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
printf("easy handle init OK\n");
|
fprintf(stdout, "easy handle init OK\n");
|
||||||
|
|
||||||
printf("creating hash...\n");
|
fprintf(stdout, "creating hash...\n");
|
||||||
hp = Curl_mk_dnscache();
|
hp = Curl_mk_dnscache();
|
||||||
if(!hp) {
|
if(!hp) {
|
||||||
printf("hash creation failed\n");
|
fprintf(stdout, "hash creation failed\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
printf("hash creation OK\n");
|
fprintf(stdout, "hash creation OK\n");
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
data_key = aprintf("%s:%d", "dummy", 0);
|
data_key = aprintf("%s:%d", "dummy", 0);
|
||||||
if(!data_key) {
|
if(!data_key) {
|
||||||
printf("data key creation failed\n");
|
fprintf(stdout, "data key creation failed\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
key_len = strlen(data_key);
|
key_len = strlen(data_key);
|
||||||
|
|
||||||
data_node = calloc(1, sizeof(struct Curl_dns_entry));
|
data_node = calloc(1, sizeof(struct Curl_dns_entry));
|
||||||
if(!data_node) {
|
if(!data_node) {
|
||||||
printf("data node creation failed\n");
|
fprintf(stdout, "data node creation failed\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
data_node->addr = fake_ai();
|
data_node->addr = fake_ai();
|
||||||
if(!data_node->addr) {
|
if(!data_node->addr) {
|
||||||
printf("actual data creation failed\n");
|
fprintf(stdout, "actual data creation failed\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodep = Curl_hash_add(hp, data_key, key_len+1, (void *)data_node);
|
nodep = Curl_hash_add(hp, data_key, key_len+1, (void *)data_node);
|
||||||
if(!nodep) {
|
if(!nodep) {
|
||||||
printf("insertion into hash failed\n");
|
fprintf(stdout, "insertion into hash failed\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,16 +134,29 @@ int test(char *URL)
|
|||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
printf("destroying hash...\n");
|
fprintf(stdout, "destroying hash...\n");
|
||||||
Curl_hash_destroy(hp);
|
Curl_hash_destroy(hp);
|
||||||
printf("hash destruction OK\n");
|
fprintf(stdout, "hash destruction OK\n");
|
||||||
|
|
||||||
printf("destroying easy handle...\n");
|
fprintf(stdout, "destroying easy handle...\n");
|
||||||
curl_easy_cleanup(easyh);
|
curl_easy_cleanup(easyh);
|
||||||
printf("easy handle destruction OK\n");
|
fprintf(stdout, "easy handle destruction OK\n");
|
||||||
|
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
|
||||||
return 0; /* OK */
|
return 0; /* OK */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else /* !defined(CURL_HIDDEN_SYMBOLS) */
|
||||||
|
|
||||||
|
|
||||||
|
int test(char *URL)
|
||||||
|
{
|
||||||
|
(void)URL;
|
||||||
|
fprintf(stdout, "libcurl built with hidden symbols");
|
||||||
|
return 1; /* skip test */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !defined(CURL_HIDDEN_SYMBOLS) */
|
||||||
|
|||||||
Reference in New Issue
Block a user