tests: provide FTP directory contents in the test file

Instead of providing a fixed single synthetic response in the test
server itself. To allow us to better use *different* directory listings
in different test cases. In this change, most listings remain the same
as before.

The wildcard match tests still use synthetic responses but we should fix
that as well.

Updated numerous test cases to use this.

Closes #14295
This commit is contained in:
Daniel Stenberg 2024-07-29 10:17:08 +02:00
parent ae0b08ae6e
commit 14f630ecf6
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
42 changed files with 103 additions and 213 deletions

View file

@ -55,18 +55,11 @@ CURLcode test(char *URL)
/*
* Change the FTP_FILEMETHOD option to use full paths rather than a CWD
* command. Alter the URL's path a bit, appending a "./". Use an innocuous
* QUOTE command, after which curl will CWD to ftp_conn->entrypath and then
* (on the next call to ftp_statemach_act) find a non-zero ftpconn->dirdepth
* even though no directories are stored in the ftpconn->dirs array (after a
* call to freedirs).
* command. Use an innocuous QUOTE command, after which curl will CWD to
* ftp_conn->entrypath and then (on the next call to ftp_statemach_act)
* find a non-zero ftpconn->dirdepth even though no directories are stored
* in the ftpconn->dirs array (after a call to freedirs).
*/
newURL = aprintf("%s./", URL);
if(!newURL) {
curl_easy_cleanup(curl);
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
slist = curl_slist_append(NULL, "SYST");
if(!slist) {
@ -76,7 +69,7 @@ CURLcode test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_URL, libtest_arg2);
test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);

View file

@ -31,8 +31,8 @@ static int new_fnmatch(void *ptr,
const char *pattern, const char *string)
{
(void)ptr;
(void)pattern;
(void)string;
fprintf(stderr, "lib574: match string '%s' against pattern '%s'\n",
string, pattern);
return CURL_FNMATCHFUNC_MATCH;
}