POSIX Signature Test for arpa/inet.h (GCI2018)

Abhimanyu Raghuvanshi abhimanyuraghuvanshi29 at gmail.com
Sat Dec 8 03:53:29 UTC 2018


>From 662e3309b1b8598589238a9bfc04c29710da34ad Mon Sep 17 00:00:00 2001
From: ABR290B <abhimanyuraghuvanshi29 at gmail.com>
Date: Sat, 8 Dec 2018 09:20:49 +0530
Subject: [PATCH] POSIX Signature Test for arpa/inet.h (GCI2018)

---
 testsuites/psxtests/Makefile.am               |  6 ++-
 .../psxtests/psxhdrs/arpa/inet/inet_addr.c    | 39 +++++++++++++++++++
 .../psxtests/psxhdrs/arpa/inet/inet_ntoa.c    | 36 +++++++++++++++++
 .../psxtests/psxhdrs/arpa/inet/inet_ntop.c    | 39 +++++++++++++++++++
 .../psxtests/psxhdrs/arpa/inet/inet_pton.c    | 39 +++++++++++++++++++
 5 files changed, 158 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/psxtests/psxhdrs/arpa/inet/inet_addr.c
 create mode 100644 testsuites/psxtests/psxhdrs/arpa/inet/inet_ntoa.c
 create mode 100644 testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
 create mode 100644 testsuites/psxtests/psxhdrs/arpa/inet/inet_pton.c

diff --git a/testsuites/psxtests/Makefile.am
b/testsuites/psxtests/Makefile.am
index 62378f1182..f49cb918f7 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1602,7 +1602,11 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
  psxhdrs/netdb/getprotobynumber.c \
  psxhdrs/netdb/getservbyname.c \
  psxhdrs/netdb/getservbyport.c \
- psxhdrs/netdb/h_errno.c
+ psxhdrs/netdb/h_errno.c \
+ psxhdrs/arpa/inet/inet_addr.c \
+ psxhdrs/arpa/inet/inet_ntop.c \
+ psxhdrs/arpa/inet/inet_ntoa.c \
+ psxhdrs/arpa/inet/inet_pton.c


 ## Not supported by RTEMS, but POSIX API Compliance tests exist.
diff --git a/testsuites/psxtests/psxhdrs/arpa/inet/inet_addr.c
b/testsuites/psxtests/psxhdrs/arpa/inet/inet_addr.c
new file mode 100644
index 0000000000..351882e9d9
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/arpa/inet/inet_addr.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief inet_addr() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Abhimanyu Raghuvanshi
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+int test(void);
+
+int test(void)
+{
+  in_addr_t con;
+  const char addr = 'a';
+
+  con = inet_addr(&addr);
+
+  return (con != -1);
+}
\ No newline at end of file
diff --git a/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntoa.c
b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntoa.c
new file mode 100644
index 0000000000..d916cbbfcd
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntoa.c
@@ -0,0 +1,36 @@
+/**
+ *  @file
+ *  @brief inet_ntoa() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Abhimanyu Raghuvanshi
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+int test(void);
+
+int test(void)
+{
+  struct in_addr addr;
+
+  return inet_ntoa(addr) != 0;
+}
\ No newline at end of file
diff --git a/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
new file mode 100644
index 0000000000..aab3d04902
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief inet_ntop() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Abhimanyu Raghuvanshi
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int af = 0;
+  struct in_addr addr;
+  char *dst = "string";
+  const char *ret = inet_ntop(af, &addr, dst, sizeof(dst));
+  return *ret != '\0';
+}
\ No newline at end of file
diff --git a/testsuites/psxtests/psxhdrs/arpa/inet/inet_pton.c
b/testsuites/psxtests/psxhdrs/arpa/inet/inet_pton.c
new file mode 100644
index 0000000000..c1a1c2a0db
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/arpa/inet/inet_pton.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief inet_pton() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Abhimanyu Raghuvanshi
+ *
+ *  Permission to use, copy, modify, and/or distribute this software
+ *  for any purpose with or without fee is hereby granted.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+int test(void);
+
+int test(void)
+{
+  int af = 0;
+  const char *src = "string";
+  int a = 1;
+
+  return inet_pton(af,src,&a);
+
+}
\ No newline at end of file
-- 
2.19.1.windows.1


ABR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20181208/528ab0e7/attachment-0001.html>


More information about the devel mailing list