summaryrefslogtreecommitdiff
path: root/tests/port
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-04-01 15:48:39 +0200
committerAndreas Baumann <abaumann@yahoo.com>2009-04-01 15:48:39 +0200
commit8caf15e38c6c1a803c110028b0d8a10d6fece776 (patch)
treedcc3b99e2e716ce17172b94c2f7adc5ca3d522eb /tests/port
parentdde2d0138dd3d6d603b476f7e5f50aff2270251e (diff)
downloadwolfbones-8caf15e38c6c1a803c110028b0d8a10d6fece776.tar.gz
wolfbones-8caf15e38c6c1a803c110028b0d8a10d6fece776.tar.bz2
removed extern in function prototypes; added gai_strerror_r and a test, cleanup in netdb.h and netdb.c
Diffstat (limited to 'tests/port')
-rw-r--r--tests/port/GNUmakefile5
-rw-r--r--tests/port/Makefile.W326
-rw-r--r--tests/port/test_gai_strerror_r.c28
3 files changed, 37 insertions, 2 deletions
diff --git a/tests/port/GNUmakefile b/tests/port/GNUmakefile
index ea6794c..64e3fe6 100644
--- a/tests/port/GNUmakefile
+++ b/tests/port/GNUmakefile
@@ -16,7 +16,8 @@ TEST_BINS = \
test_strlcpy$(EXE) \
test_strlcat$(EXE) \
test_itoa$(EXE) \
- test_getaddrinfo$(EXE)
+ test_getaddrinfo$(EXE) \
+ test_gai_strerror_r$(EXE)
-include $(TOPDIR)/makefiles/gmake/sub.mk
@@ -54,3 +55,5 @@ local_test:
@./test_itoa > /dev/null
@echo "Testing getaddrinfo.."
@./test_getaddrinfo > /dev/null
+ @echo "Testing gai_strerror_r.."
+ @./test_gai_strerror_r > /dev/null
diff --git a/tests/port/Makefile.W32 b/tests/port/Makefile.W32
index 5cf4e7a..22203ad 100644
--- a/tests/port/Makefile.W32
+++ b/tests/port/Makefile.W32
@@ -21,7 +21,8 @@ TEST_BINS = \
test_strlcpy.exe \
test_strlcat.exe \
test_itoa.exe \
- test_getaddrinfo.exe
+ test_getaddrinfo.exe \
+ test_gai_strerror_r.exe
!INCLUDE $(TOPDIR)\makefiles\nmake\sub.mk
@@ -36,6 +37,7 @@ test_strlcpy.exe: test_strlcpy.obj
test_strlcat.exe: test_strlcat.obj
test_itoa.exe: test_itoa.obj
test_getaddrinfo.exe: test_getaddrinfo.obj
+test_gai_strerror_r.exe: test_gai_strerror_r.obj
local_all:
@@ -64,3 +66,5 @@ local_test:
@test_itoa >NUL 2>NUL
@echo Testing getaddrinfo..
@test_getaddrinfo >NUL 2>NUL
+ @echo Testing gai_strerror_r..
+ @test_gai_strerror_r >NUL 2>NUL
diff --git a/tests/port/test_gai_strerror_r.c b/tests/port/test_gai_strerror_r.c
new file mode 100644
index 0000000..eb4c249
--- /dev/null
+++ b/tests/port/test_gai_strerror_r.c
@@ -0,0 +1,28 @@
+#include "port/sys.h"
+
+#define TEST_GAI_STRERROR_R
+#include "port/netdb.c" /* for gai_strerror_r */
+
+#include <stdlib.h> /* for exit, EXIT_SUCCESS, free */
+#include <stdio.h> /* for printf */
+
+int main( void ) {
+ signed int i;
+ int res;
+ char buf[1024];
+
+ /* go through gai errors (TODO: find out how many of them there are!) */
+ for( i = -1; i >= -255; i-- ) {
+ *buf = '\0';
+ res = gai_strerror_r( i, buf, 1024 );
+ printf( "%d: %d \"%s\"\n", i, res, buf );
+ }
+
+ /* go through gai errors (TODO: find out how many of them there are!) */
+ for( i = -1; i >= -255; i-- ) {
+ *buf = '\0';
+ res = wolf_port_gai_strerror_r( i, buf, 1024 );
+ printf( "%d: %d \"%s\"\n", i, res, buf );
+ }
+ exit( EXIT_SUCCESS );
+}