[rtems commit] psxhdrs: Add POSIX API Signature Compliance Tests for pwd.h (GCI 2018)

Joel Sherrill joel at rtems.org
Mon Dec 10 18:56:42 UTC 2018


Module:    rtems
Branch:    master
Commit:    b05aa8ee41eb77d6654c2d1700d2db780719ca23
Changeset: http://git.rtems.org/rtems/commit/?id=b05aa8ee41eb77d6654c2d1700d2db780719ca23

Author:    Himanshu40 <himanshuwindows8.1 at gmail.com>
Date:      Mon Dec 10 12:50:47 2018 -0600

psxhdrs: Add POSIX API Signature Compliance Tests for pwd.h (GCI 2018)

---

 testsuites/psxtests/Makefile.am              |  7 ++++
 testsuites/psxtests/psxhdrs/pwd/endpwent.c   | 39 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/pwd/getpwent.c   | 38 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/pwd/getpwnam.c   | 38 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c | 47 +++++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/pwd/getpwuid.c   | 39 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c | 48 ++++++++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/pwd/setpwent.c   | 39 ++++++++++++++++++++++
 8 files changed, 295 insertions(+)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index cbfb7f8..a2b04ca 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1630,6 +1630,13 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 	psxhdrs/arpa/inet/inet_ntop.c \
 	psxhdrs/arpa/inet/inet_ntoa.c \
 	psxhdrs/arpa/inet/inet_pton.c \
+	psxhdrs/pwd/endpwent.c \
+	psxhdrs/pwd/getpwent.c \
+	psxhdrs/pwd/getpwnam.c \
+	psxhdrs/pwd/getpwnam_r.c \
+	psxhdrs/pwd/setpwent.c \
+	psxhdrs/pwd/getpwuid.c \
+	psxhdrs/pwd/getpwuid_r.c \
 	psxhdrs/syslog/closelog.c \
 	psxhdrs/syslog/openlog.c \
 	psxhdrs/syslog/setlogmask.c \
diff --git a/testsuites/psxtests/psxhdrs/pwd/endpwent.c b/testsuites/psxtests/psxhdrs/pwd/endpwent.c
new file mode 100644
index 0000000..8a55f01
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/endpwent.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief endpwent() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+
+  pswd = getpwent();
+  endpwent();
+
+  return ( pswd != NULL );
+}
diff --git a/testsuites/psxtests/psxhdrs/pwd/getpwent.c b/testsuites/psxtests/psxhdrs/pwd/getpwent.c
new file mode 100644
index 0000000..8b7c555
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/getpwent.c
@@ -0,0 +1,38 @@
+/**
+ *  @file
+ *  @brief getpwent() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+
+  pswd = getpwent();
+
+  return ( pswd != NULL );
+}
diff --git a/testsuites/psxtests/psxhdrs/pwd/getpwnam.c b/testsuites/psxtests/psxhdrs/pwd/getpwnam.c
new file mode 100644
index 0000000..c356b92
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/getpwnam.c
@@ -0,0 +1,38 @@
+/**
+ *  @file
+ *  @brief getpwnam() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+
+  pswd = getpwnam( "Hello World" );
+
+  return ( pswd != NULL );
+}
diff --git a/testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c b/testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c
new file mode 100644
index 0000000..3a95e9a
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c
@@ -0,0 +1,47 @@
+/**
+ *  @file
+ *  @brief getpwnam_r() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+  struct passwd *resl;
+  char *buf;
+  size_t bufsize;
+  int result;
+
+  bufsize = sysconf( _SC_GETPW_R_SIZE_MAX );
+  buf = malloc( bufsize );
+  pswd = getpwent();
+  result = getpwnam_r( "Hello", pswd, buf, bufsize, &resl );
+
+  return ( result != -1 );
+}
diff --git a/testsuites/psxtests/psxhdrs/pwd/getpwuid.c b/testsuites/psxtests/psxhdrs/pwd/getpwuid.c
new file mode 100644
index 0000000..ec3733f
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/getpwuid.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief getpwuid() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+  uid_t uid = 0;
+
+  pswd = getpwuid( uid );
+
+  return ( pswd != NULL );
+}
diff --git a/testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c b/testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c
new file mode 100644
index 0000000..5e7c4e5
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c
@@ -0,0 +1,48 @@
+/**
+ *  @file
+ *  @brief getpwuid_r() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+  struct passwd *resl;
+  uid_t uid = 0;
+  char *buf;
+  size_t buflen;
+  int result;
+
+  buflen = sysconf( _SC_GETPW_R_SIZE_MAX );
+  buf = malloc( buflen );
+  pswd = getpwent();
+  result = getpwuid_r( uid, pswd, buf, buflen, &resl );
+
+  return ( result != -1 );
+}
diff --git a/testsuites/psxtests/psxhdrs/pwd/setpwent.c b/testsuites/psxtests/psxhdrs/pwd/setpwent.c
new file mode 100644
index 0000000..9192b93
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/pwd/setpwent.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief setpwent() API Conformance Test
+ */
+
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak
+ *
+ *  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 <sys/types.h>
+#include <pwd.h>
+
+int test( void );
+
+int test( void )
+{
+  struct passwd *pswd;
+
+  pswd = getpwent();
+  setpwent();
+
+  return ( pswd != NULL );
+}




More information about the vc mailing list