]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test661: return from test early in case of curl error
authorDan Fandrich <dan@coneharvesters.com>
Mon, 11 Sep 2023 21:27:52 +0000 (14:27 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 13 Sep 2023 18:26:08 +0000 (11:26 -0700)
tests/libtest/lib661.c

index 6478ddbf59c69a50eb9ebb6907c3bdd4671cd81b..5145937ac1148811d2a74a649f9f932355fae1e6 100644 (file)
@@ -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);