aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/Makefile.inc2
-rw-r--r--tests/data/test154122
-rw-r--r--tests/libtest/Makefile.inc6
-rw-r--r--tests/libtest/lib1541.c109
4 files changed, 137 insertions, 2 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index e908c12b9..d89d53249 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -163,7 +163,7 @@ test1520 \
\
test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \
test1533 test1534 test1535 test1536 \
-test1540 \
+test1540 test1541 \
\
test1600 test1601 test1602 test1603 test1604 test1605 \
\
diff --git a/tests/data/test1541 b/tests/data/test1541
new file mode 100644
index 000000000..3d04cb4f9
--- /dev/null
+++ b/tests/data/test1541
@@ -0,0 +1,22 @@
+<testcase>
+<info>
+<keywords>
+typecheck
+</keywords>
+</info>
+
+#
+# Client-side
+<client>
+<server>
+none
+</server>
+ <name>
+verify curl/system.h detection
+ </name>
+<tool>
+lib1541
+</tool>
+</client>
+
+</testcase>
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index d85956d8b..66e2f1c6b 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -25,7 +25,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
lib1520 \
lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
lib1534 lib1535 lib1536 \
- lib1540 \
+ lib1540 lib1541 \
lib1900 \
lib2033
@@ -417,6 +417,10 @@ lib1540_SOURCES = lib1540.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1540_LDADD = $(TESTUTIL_LIBS)
lib1540_CPPFLAGS = $(AM_CPPFLAGS)
+lib1541_SOURCES = lib1541.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1541_LDADD = $(TESTUTIL_LIBS)
+lib1541_CPPFLAGS = $(AM_CPPFLAGS)
+
lib1900_SOURCES = lib1900.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1900_LDADD = $(TESTUTIL_LIBS)
lib1900_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/tests/libtest/lib1541.c b/tests/libtest/lib1541.c
new file mode 100644
index 000000000..ef993dd66
--- /dev/null
+++ b/tests/libtest/lib1541.c
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * _ _ ____ _
+ * 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 "testutil.h"
+#include "warnless.h"
+#include "memdebug.h"
+
+#define XSTR(x) #x
+#define STRING(y) XSTR(y)
+
+int test(char *URL)
+{
+ char detect[512];
+ char syst[512];
+
+ const char *types_h = "No";
+ const char *socket_h = "No";
+ const char *stypes_h = "No";
+ const char *ssocket_h = "No";
+
+ (void)(URL);
+
+#ifdef CURL_PULL_SYS_TYPES_H
+ types_h = "Yes";
+#endif
+#ifdef CURL_PULL_SYS_SOCKET_H
+ socket_h = "Yes";
+#endif
+ snprintf(detect, sizeof(detect),
+ "CURL_TYPEOF_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_TU: %s\n"
+ "CURL_SUFFIX_CURL_OFF_T: %s\n"
+ "CURL_SUFFIX_CURL_OFF_TU: %s\n"
+ "CURL_SIZEOF_CURL_OFF_T: %d\n"
+ "CURL_SIZEOF_LONG: %d\n"
+ "CURL_TYPEOF_CURL_SOCKLEN_T: %s\n"
+ "CURL_PULL_SYS_TYPES_H: %s\n"
+ "CURL_PULL_SYS_SOCKET_H: %s\n"
+
+ , STRING(CURL_TYPEOF_CURL_OFF_T)
+ , CURL_FORMAT_CURL_OFF_T
+ , CURL_FORMAT_CURL_OFF_TU
+ , STRING(CURL_SUFFIX_CURL_OFF_T)
+ , STRING(CURL_SUFFIX_CURL_OFF_TU)
+ , CURL_SIZEOF_CURL_OFF_T
+ , CURL_SIZEOF_LONG
+ , STRING(CURL_TYPEOF_CURL_SOCKLEN_T)
+ , types_h
+ , socket_h);
+
+#ifdef CURLSYS_PULL_SYS_TYPES_H
+ stypes_h = "Yes";
+#endif
+#ifdef CURLSYS_PULL_SYS_SOCKET_H
+ ssocket_h = "Yes";
+#endif
+ snprintf(syst, sizeof(syst),
+ "CURL_TYPEOF_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_T: %s\n"
+ "CURL_FORMAT_CURL_OFF_TU: %s\n"
+ "CURL_SUFFIX_CURL_OFF_T: %s\n"
+ "CURL_SUFFIX_CURL_OFF_TU: %s\n"
+ "CURL_SIZEOF_CURL_OFF_T: %d\n"
+ "CURL_SIZEOF_LONG: %d\n"
+ "CURL_TYPEOF_CURL_SOCKLEN_T: %s\n"
+ "CURL_PULL_SYS_TYPES_H: %s\n"
+ "CURL_PULL_SYS_SOCKET_H: %s\n"
+
+ , STRING(CURLSYS_TYPEOF_CURL_OFF_T)
+ , CURLSYS_FORMAT_CURL_OFF_T
+ , CURLSYS_FORMAT_CURL_OFF_TU
+ , STRING(CURLSYS_SUFFIX_CURL_OFF_T)
+ , STRING(CURLSYS_SUFFIX_CURL_OFF_TU)
+ , CURLSYS_SIZEOF_CURL_OFF_T
+ , CURLSYS_SIZEOF_LONG
+ , STRING(CURLSYS_TYPEOF_CURL_SOCKLEN_T)
+ , stypes_h
+ , ssocket_h);
+
+ if(strcmp(detect, syst)) {
+ printf("===> Type detection failed <====\n");
+ printf("[Detected]\n%s", detect);
+ printf("[System]\n%s", syst);
+ return 1; /* FAIL! */
+ }
+
+ return 0;
+}