aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/data/test5837
-rw-r--r--tests/libtest/lib583.c68
2 files changed, 53 insertions, 22 deletions
diff --git a/tests/data/test583 b/tests/data/test583
index 2129ee729..8fca7d23c 100644
--- a/tests/data/test583
+++ b/tests/data/test583
@@ -35,9 +35,8 @@ sftp://localhost:%SSHPORT%PWD/log/upload583.txt %USER:
# Verify data after the test has been "shot"
<verify>
-<strip>
-</strip>
-<protocol>
-</protocol>
+<errorcode>
+0
+</errorcode>
</verify>
</testcase>
diff --git a/tests/libtest/lib583.c b/tests/libtest/lib583.c
index 57c9365bc..fca22d65b 100644
--- a/tests/libtest/lib583.c
+++ b/tests/libtest/lib583.c
@@ -34,43 +34,75 @@
int test(char *URL)
{
- CURLMcode retVal;
int stillRunning;
CURLM* multiHandle;
CURL* curl;
+ int res1 = 0;
int res;
- curl_global_init(CURL_GLOBAL_ALL);
+ if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+ fprintf(stderr, "curl_global_init() failed\n");
+ return TEST_ERR_MAJOR_BAD;
+ }
- multiHandle = curl_multi_init();
- curl = curl_easy_init();
+ if((multiHandle = curl_multi_init()) == NULL) {
+ fprintf(stderr, "curl_multi_init() failed\n");
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD;
+ }
+
+ if((curl = curl_easy_init()) == NULL) {
+ fprintf(stderr, "curl_easy_init() failed\n");
+ curl_multi_cleanup(multiHandle);
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD;
+ }
test_setopt(curl, CURLOPT_USERPWD, libtest_arg2);
test_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, "curl_client_key.pub");
test_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, "curl_client_key");
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+ test_setopt(curl, CURLOPT_UPLOAD, 1);
+ test_setopt(curl, CURLOPT_VERBOSE, 1);
+
+ test_setopt(curl, CURLOPT_URL, URL);
+ test_setopt(curl, CURLOPT_INFILESIZE, (long)5);
- curl_easy_setopt(curl, CURLOPT_URL, URL);
- curl_easy_setopt(curl, CURLOPT_INFILESIZE, (long)5);
+ if((res = (int)curl_multi_add_handle(multiHandle, curl)) != CURLM_OK) {
+ fprintf(stderr, "curl_multi_add_handle() failed, "
+ "with code %d\n", res);
+ curl_easy_cleanup(curl);
+ curl_multi_cleanup(multiHandle);
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD;
+ }
- curl_multi_add_handle(multiHandle, curl);
- retVal = curl_multi_perform(multiHandle, &stillRunning);
- if (retVal != CURLM_OK)
- fprintf(stderr, "curl_multi_perform() failed!n");
+ /* this tests if removing an easy handle immediately after multi
+ perform has been called succeeds or not. Logged afterwards */
+
+ res1 = (int) curl_multi_perform(multiHandle, &stillRunning);
+ res = (int) curl_multi_remove_handle(multiHandle, curl);
- fprintf(stderr, "curl_multi_remove_handle()!\n");
- retVal = curl_multi_remove_handle(multiHandle, curl);
- if (retVal == CURLM_OK)
- fprintf(stderr, "curl_multi_remove_handle() was successful!\n");
+ if(res1)
+ fprintf(stderr, "curl_multi_perform() failed, "
+ "with code %d\n", res1);
else
- fprintf(stderr, "curl_multi_remove_handle() failed\n");
+ fprintf(stderr, "curl_multi_perform() succeeded\n");
+
+ if(res)
+ fprintf(stderr, "curl_multi_remove_handle() failed, "
+ "with code %d\n", res);
+ else
+ fprintf(stderr, "curl_multi_remove_handle() succeeded\n");
test_cleanup:
curl_easy_cleanup(curl);
curl_multi_cleanup(multiHandle);
+ curl_global_cleanup();
- return res;
+ if(res)
+ return res;
+ else
+ return res1;
}