mirror of
https://github.com/curl/curl.git
synced 2025-09-04 11:24:59 +03:00
libtests: make test 1503,1504,1505 use the 1502 binary
Adjust the differences at runtime instead of build-time, to avoid extra buillds. Set the `CURL_TESTNUM` env variable to pass test numbers to tests. Make libtest/first.c use that env variable to set the `testnum` global variable to allow tests to differ based on which test that runs it. Closes #17591
This commit is contained in:
parent
aea336aa23
commit
02dd471bbf
|
@ -32,7 +32,7 @@ Funny-head: yesyes
|
||||||
http
|
http
|
||||||
</server>
|
</server>
|
||||||
<tool>
|
<tool>
|
||||||
lib%TESTNUMBER
|
lib1502
|
||||||
</tool>
|
</tool>
|
||||||
<name>
|
<name>
|
||||||
HTTP multi with CURLOPT_RESOLVE, cleanup sequence PA
|
HTTP multi with CURLOPT_RESOLVE, cleanup sequence PA
|
||||||
|
|
|
@ -32,7 +32,7 @@ Funny-head: yesyes
|
||||||
http
|
http
|
||||||
</server>
|
</server>
|
||||||
<tool>
|
<tool>
|
||||||
lib%TESTNUMBER
|
lib1502
|
||||||
</tool>
|
</tool>
|
||||||
<name>
|
<name>
|
||||||
HTTP multi with CURLOPT_RESOLVE, cleanup sequence UB
|
HTTP multi with CURLOPT_RESOLVE, cleanup sequence UB
|
||||||
|
|
|
@ -32,7 +32,7 @@ Funny-head: yesyes
|
||||||
http
|
http
|
||||||
</server>
|
</server>
|
||||||
<tool>
|
<tool>
|
||||||
lib%TESTNUMBER
|
lib1502
|
||||||
</tool>
|
</tool>
|
||||||
<name>
|
<name>
|
||||||
HTTP multi with CURLOPT_RESOLVE, cleanup sequence PB
|
HTTP multi with CURLOPT_RESOLVE, cleanup sequence PB
|
||||||
|
|
|
@ -55,7 +55,7 @@ LIBTESTPROGS = libauthretry libntlmconnect libprereq \
|
||||||
lib1301 \
|
lib1301 \
|
||||||
lib1308 \
|
lib1308 \
|
||||||
lib1485 \
|
lib1485 \
|
||||||
lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
|
lib1500 lib1501 lib1502 lib1506 lib1507 lib1508 \
|
||||||
lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \
|
lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \
|
||||||
lib1518 lib1520 lib1521 lib1522 lib1523 \
|
lib1518 lib1520 lib1521 lib1522 lib1523 \
|
||||||
lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
|
lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
|
||||||
|
@ -376,19 +376,6 @@ lib1501_LDADD = $(TESTUTIL_LIBS)
|
||||||
|
|
||||||
lib1502_SOURCES = lib1502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
lib1502_SOURCES = lib1502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||||
lib1502_LDADD = $(TESTUTIL_LIBS)
|
lib1502_LDADD = $(TESTUTIL_LIBS)
|
||||||
lib1502_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1502
|
|
||||||
|
|
||||||
lib1503_SOURCES = lib1502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
|
||||||
lib1503_LDADD = $(TESTUTIL_LIBS)
|
|
||||||
lib1503_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1503
|
|
||||||
|
|
||||||
lib1504_SOURCES = lib1502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
|
||||||
lib1504_LDADD = $(TESTUTIL_LIBS)
|
|
||||||
lib1504_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1504
|
|
||||||
|
|
||||||
lib1505_SOURCES = lib1502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
|
||||||
lib1505_LDADD = $(TESTUTIL_LIBS)
|
|
||||||
lib1505_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1505
|
|
||||||
|
|
||||||
lib1506_SOURCES = lib1506.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
lib1506_SOURCES = lib1506.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||||
lib1506_LDADD = $(TESTUTIL_LIBS)
|
lib1506_LDADD = $(TESTUTIL_LIBS)
|
||||||
|
|
|
@ -73,6 +73,7 @@ char *libtest_arg3 = NULL;
|
||||||
char *libtest_arg4 = NULL;
|
char *libtest_arg4 = NULL;
|
||||||
int test_argc;
|
int test_argc;
|
||||||
char **test_argv;
|
char **test_argv;
|
||||||
|
int testnum;
|
||||||
|
|
||||||
struct timeval tv_test_start; /* for test timing */
|
struct timeval tv_test_start; /* for test timing */
|
||||||
|
|
||||||
|
@ -121,6 +122,7 @@ int main(int argc, char **argv)
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
int basearg;
|
int basearg;
|
||||||
test_func_t test_func;
|
test_func_t test_func;
|
||||||
|
char *env;
|
||||||
|
|
||||||
CURL_SET_BINMODE(stdout);
|
CURL_SET_BINMODE(stdout);
|
||||||
|
|
||||||
|
@ -191,6 +193,12 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
URL = argv[basearg]; /* provide this to the rest */
|
URL = argv[basearg]; /* provide this to the rest */
|
||||||
|
|
||||||
|
env = getenv("CURL_TESTNUM");
|
||||||
|
if(env)
|
||||||
|
testnum = atoi(env);
|
||||||
|
else
|
||||||
|
testnum = 0;
|
||||||
|
|
||||||
curl_mfprintf(stderr, "URL: %s\n", URL);
|
curl_mfprintf(stderr, "URL: %s\n", URL);
|
||||||
|
|
||||||
result = test_func(URL);
|
result = test_func(URL);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* This source code is used for lib1502, lib1503, lib1504 and lib1505 with
|
* This source code is used for lib1502, lib1503, lib1504 and lib1505 with
|
||||||
* only #ifdefs controlling the cleanup sequence.
|
* only the testnum controlling the cleanup sequence.
|
||||||
*
|
*
|
||||||
* Test case 1502 converted from bug report #3575448, identifying a memory
|
* Test case 1502 converted from bug report #3575448, identifying a memory
|
||||||
* leak in the CURLOPT_RESOLVE handling with the multi interface.
|
* leak in the CURLOPT_RESOLVE handling with the multi interface.
|
||||||
|
@ -44,7 +44,6 @@ CURLcode test(char *URL)
|
||||||
CURLM *multi = NULL;
|
CURLM *multi = NULL;
|
||||||
int still_running;
|
int still_running;
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
|
|
||||||
char redirect[160];
|
char redirect[160];
|
||||||
|
|
||||||
/* DNS cache injection */
|
/* DNS cache injection */
|
||||||
|
@ -121,35 +120,35 @@ CURLcode test(char *URL)
|
||||||
|
|
||||||
test_cleanup:
|
test_cleanup:
|
||||||
|
|
||||||
#ifdef LIB1502
|
switch(testnum) {
|
||||||
/* undocumented cleanup sequence - type UA */
|
case 1502:
|
||||||
curl_multi_cleanup(multi);
|
default:
|
||||||
curl_easy_cleanup(easy);
|
/* undocumented cleanup sequence - type UA */
|
||||||
curl_global_cleanup();
|
curl_multi_cleanup(multi);
|
||||||
#endif
|
curl_easy_cleanup(easy);
|
||||||
|
curl_global_cleanup();
|
||||||
#ifdef LIB1503
|
break;
|
||||||
/* proper cleanup sequence - type PA */
|
case 1503:
|
||||||
curl_multi_remove_handle(multi, easy);
|
/* proper cleanup sequence - type PA */
|
||||||
curl_multi_cleanup(multi);
|
curl_multi_remove_handle(multi, easy);
|
||||||
curl_easy_cleanup(easy);
|
curl_multi_cleanup(multi);
|
||||||
curl_global_cleanup();
|
curl_easy_cleanup(easy);
|
||||||
#endif
|
curl_global_cleanup();
|
||||||
|
break;
|
||||||
#ifdef LIB1504
|
case 1504:
|
||||||
/* undocumented cleanup sequence - type UB */
|
/* undocumented cleanup sequence - type UB */
|
||||||
curl_easy_cleanup(easy);
|
curl_easy_cleanup(easy);
|
||||||
curl_multi_cleanup(multi);
|
curl_multi_cleanup(multi);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
#endif
|
break;
|
||||||
|
case 1505:
|
||||||
#ifdef LIB1505
|
/* proper cleanup sequence - type PB */
|
||||||
/* proper cleanup sequence - type PB */
|
curl_multi_remove_handle(multi, easy);
|
||||||
curl_multi_remove_handle(multi, easy);
|
curl_easy_cleanup(easy);
|
||||||
curl_easy_cleanup(easy);
|
curl_multi_cleanup(multi);
|
||||||
curl_multi_cleanup(multi);
|
curl_global_cleanup();
|
||||||
curl_global_cleanup();
|
break;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
curl_slist_free_all(dns_cache_list);
|
curl_slist_free_all(dns_cache_list);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ extern char *libtest_arg4; /* set by first.c to the argv[4] or NULL */
|
||||||
/* argc and argv as passed in to the main() function */
|
/* argc and argv as passed in to the main() function */
|
||||||
extern int test_argc;
|
extern int test_argc;
|
||||||
extern char **test_argv;
|
extern char **test_argv;
|
||||||
|
extern int testnum;
|
||||||
extern struct timeval tv_test_start; /* for test timing */
|
extern struct timeval tv_test_start; /* for test timing */
|
||||||
|
|
||||||
extern int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
|
extern int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
|
||||||
|
|
|
@ -756,6 +756,9 @@ sub singletest_prepare {
|
||||||
# write the instructions to file
|
# write the instructions to file
|
||||||
writearray("$LOGDIR/$SERVERCMD", \@ftpservercmd);
|
writearray("$LOGDIR/$SERVERCMD", \@ftpservercmd);
|
||||||
|
|
||||||
|
# provide an environment variable
|
||||||
|
$ENV{'CURL_TESTNUM'} = $testnum;
|
||||||
|
|
||||||
# create (possibly-empty) files before starting the test
|
# create (possibly-empty) files before starting the test
|
||||||
for my $partsuffix (('', '1', '2', '3', '4')) {
|
for my $partsuffix (('', '1', '2', '3', '4')) {
|
||||||
my @inputfile=getpart("client", "file".$partsuffix);
|
my @inputfile=getpart("client", "file".$partsuffix);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user