diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-06-02 13:52:55 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-06-02 13:52:55 +0200 |
commit | cef9c9e7828fdf073e6430d7bfdefa19e25c5540 (patch) | |
tree | 902f7551afe7ea83a7d2c6ffb36e7bc32c0f71e8 /tests | |
parent | 4ba20a511995b2179e59cf6d1880176d2d454bad (diff) |
test1538: verify the libcurl strerror API calls
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/Makefile.inc | 2 | ||||
-rw-r--r-- | tests/data/test1538 | 148 | ||||
-rw-r--r-- | tests/libtest/Makefile.inc | 6 | ||||
-rw-r--r-- | tests/libtest/lib1538.c | 51 |
4 files changed, 205 insertions, 2 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 91b7f072b..22234e6db 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -163,7 +163,7 @@ test1516 test1517 \ test1520 \ \ test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \ -test1533 test1534 test1535 test1536 test1537 \ +test1533 test1534 test1535 test1536 test1537 lib1538 \ test1540 test1541 \ \ test1600 test1601 test1602 test1603 test1604 test1605 test1606 \ diff --git a/tests/data/test1538 b/tests/data/test1538 new file mode 100644 index 000000000..e6fdadef7 --- /dev/null +++ b/tests/data/test1538 @@ -0,0 +1,148 @@ +<testcase> +<info> +<keywords> +strerror +</keywords> +</info> + +# +# Server-side +<reply> +</reply> + +# Client-side +<client> +<server> +none +</server> +<tool> +lib1538 +</tool> + +<name> +libcurl strerror API call tests +</name> +<command> +nothing +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<stdout> +e0: No error +e1: Unsupported protocol +e2: Failed initialization +e3: URL using bad/illegal format or missing URL +e4: A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. +e5: Couldn't resolve proxy name +e6: Couldn't resolve host name +e7: Couldn't connect to server +e8: Weird server reply +e9: Access denied to remote resource +e10: FTP: The server failed to connect to data port +e11: FTP: unknown PASS reply +e12: FTP: Accepting server connect has timed out +e13: FTP: unknown PASV reply +e14: FTP: unknown 227 response format +e15: FTP: can't figure out the host in the PASV response +e16: Error in the HTTP2 framing layer +e17: FTP: couldn't set file type +e18: Transferred a partial file +e19: FTP: couldn't retrieve (RETR failed) the specified file +e20: Unknown error +e21: Quote command returned error +e22: HTTP response code said error +e23: Failed writing received data to disk/application +e24: Unknown error +e25: Upload failed (at start/before it took off) +e26: Failed to open/read local data from file/application +e27: Out of memory +e28: Timeout was reached +e29: Unknown error +e30: FTP: command PORT failed +e31: FTP: command REST failed +e32: Unknown error +e33: Requested range was not delivered by the server +e34: Internal problem setting up the POST +e35: SSL connect error +e36: Couldn't resume download +e37: Couldn't read a file:// file +e38: LDAP: cannot bind +e39: LDAP: search failed +e40: Unknown error +e41: A required function in the library was not found +e42: Operation was aborted by an application callback +e43: A libcurl function was given a bad argument +e44: Unknown error +e45: Failed binding local connection end +e46: Unknown error +e47: Number of redirects hit maximum amount +e48: An unknown option was passed in to libcurl +e49: Malformed telnet option +e50: Unknown error +e51: SSL peer certificate or SSH remote key was not OK +e52: Server returned nothing (no headers, no data) +e53: SSL crypto engine not found +e54: Can not set SSL crypto engine as default +e55: Failed sending data to the peer +e56: Failure when receiving data from the peer +e57: Unknown error +e58: Problem with the local SSL certificate +e59: Couldn't use specified SSL cipher +e60: Peer certificate cannot be authenticated with given CA certificates +e61: Unrecognized or bad HTTP Content or Transfer-Encoding +e62: Invalid LDAP URL +e63: Maximum file size exceeded +e64: Requested SSL level failed +e65: Send failed since rewinding of the data stream failed +e66: Failed to initialise SSL crypto engine +e67: Login denied +e68: TFTP: File Not Found +e69: TFTP: Access Violation +e70: Disk full or allocation exceeded +e71: TFTP: Illegal operation +e72: TFTP: Unknown transfer ID +e73: Remote file already exists +e74: TFTP: No such user +e75: Conversion failed +e76: Caller must register CURLOPT_CONV_ callback options +e77: Problem with the SSL CA cert (path? access rights?) +e78: Remote file not found +e79: Error in the SSH layer +e80: Failed to shut down the SSL connection +e81: Socket not ready for send/recv +e82: Failed to load CRL file (path? access rights?, format?) +e83: Issuer check against peer certificate failed +e84: FTP: The server did not accept the PRET command. +e85: RTSP CSeq mismatch or invalid CSeq +e86: RTSP session error +e87: Unable to parse FTP file list +e88: Chunk callback failed +e89: The max connection limit is reached +e90: SSL public key does not match pinned public key +e91: SSL server certificate status verification FAILED +e92: Stream error in the HTTP/2 framing layer +e93: Unknown error +m-1: Please call curl_multi_perform() soon +m0: No error +m1: Invalid multi handle +m2: Invalid easy handle +m3: Out of memory +m4: Internal error +m5: Invalid socket argument +m6: Unknown option +m7: The easy handle is already added to a multi handle +m8: Unknown error +s0: No error +s1: Unknown share option +s2: Share currently in use +s3: Invalid share handle +s4: Out of memory +s5: Feature not enabled in this library +s6: CURLSHcode unknown +</stdout> +</verify> + +</testcase> diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index 70e2cc2fd..1e4e088da 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -24,7 +24,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \ lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \ lib1520 \ lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \ - lib1534 lib1535 lib1536 lib1537 \ + lib1534 lib1535 lib1536 lib1537 lib1538 \ lib1540 lib1541 \ lib1900 \ lib2033 @@ -420,6 +420,10 @@ lib1537_SOURCES = lib1537.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1537_LDADD = $(TESTUTIL_LIBS) lib1537_CPPFLAGS = $(AM_CPPFLAGS) +lib1538_SOURCES = lib1538.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) +lib1538_LDADD = $(TESTUTIL_LIBS) +lib1538_CPPFLAGS = $(AM_CPPFLAGS) + lib1540_SOURCES = lib1540.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1540_LDADD = $(TESTUTIL_LIBS) lib1540_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/tests/libtest/lib1538.c b/tests/libtest/lib1538.c new file mode 100644 index 000000000..e4e16f203 --- /dev/null +++ b/tests/libtest/lib1538.c @@ -0,0 +1,51 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + int res = 0; + CURLcode easyret; + CURLMcode multiret; + CURLSHcode shareret; + (void)URL; + + curl_easy_strerror(INT_MAX); + curl_multi_strerror(INT_MAX); + curl_share_strerror(INT_MAX); + curl_easy_strerror(-INT_MAX); + curl_multi_strerror(-INT_MAX); + curl_share_strerror(-INT_MAX); + for(easyret=CURLE_OK; easyret <= CURL_LAST; easyret++) { + printf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret)); + } + for(multiret=CURLM_CALL_MULTI_PERFORM; multiret <= CURLM_LAST; multiret++) { + printf("m%d: %s\n", (int)multiret, curl_multi_strerror(multiret)); + } + for(shareret=CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) { + printf("s%d: %s\n", (int)shareret, curl_share_strerror(shareret)); + } + + return (int)res; +} |