From: Dan Fandrich Date: Mon, 11 Sep 2023 21:27:52 +0000 (-0700) Subject: test661: return from test early in case of curl error X-Git-Tag: curl-8_4_0~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0e4fa445d92733593e285695d99ff3271b78a0e;p=thirdparty%2Fcurl.git test661: return from test early in case of curl error --- diff --git a/tests/libtest/lib661.c b/tests/libtest/lib661.c index 6478ddbf59..5145937ac1 100644 --- a/tests/libtest/lib661.c +++ b/tests/libtest/lib661.c @@ -51,11 +51,15 @@ int test(char *URL) test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L); test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD); res = curl_easy_perform(curl); + if(res != CURLE_REMOTE_FILE_NOT_FOUND) + goto test_cleanup; curl_free(newURL); newURL = aprintf("%s/folderB/661", URL); test_setopt(curl, CURLOPT_URL, newURL); res = curl_easy_perform(curl); + if(res != CURLE_REMOTE_FILE_NOT_FOUND) + goto test_cleanup; /* test: CURLFTPMETHOD_NOCWD with absolute path should never emit CWD (for both new and reused easy handle) */ @@ -74,6 +78,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L); test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD); res = curl_easy_perform(curl); + if(res != CURLE_REMOTE_FILE_NOT_FOUND) + goto test_cleanup; /* curve ball: CWD /folderB before reusing connection with _NOCWD */ curl_free(newURL); @@ -81,12 +87,16 @@ int test(char *URL) test_setopt(curl, CURLOPT_URL, newURL); test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD); res = curl_easy_perform(curl); + if(res != CURLE_REMOTE_FILE_NOT_FOUND) + goto test_cleanup; curl_free(newURL); newURL = aprintf("%s/folderA/661", URL); test_setopt(curl, CURLOPT_URL, newURL); test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD); res = curl_easy_perform(curl); + if(res != CURLE_REMOTE_FILE_NOT_FOUND) + goto test_cleanup; /* test: CURLFTPMETHOD_NOCWD with home-relative path should not emit CWD for first FTP access after login */ @@ -111,6 +121,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD); test_setopt(curl, CURLOPT_QUOTE, slist); res = curl_easy_perform(curl); + if(res) + goto test_cleanup; /* test: CURLFTPMETHOD_SINGLECWD with home-relative path should not emit CWD for first FTP access after login */ @@ -128,6 +140,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD); test_setopt(curl, CURLOPT_QUOTE, slist); res = curl_easy_perform(curl); + if(res) + goto test_cleanup; /* test: CURLFTPMETHOD_NOCWD with home-relative path should not emit CWD for second FTP access when not needed + @@ -143,6 +157,8 @@ int test(char *URL) test_cleanup: + if(res) + fprintf(stderr, "test encountered error %d\n", res); curl_slist_free_all(slist); curl_free(newURL); curl_easy_cleanup(curl);