Hi guys, Here is the patch for pwd.h file.
Thanks Himanshu
From 9e60a729f8eacd7717ac4e630771597372bde00a Mon Sep 17 00:00:00 2001 From: Himanshu40 <himanshuwindows...@gmail.com> Date: Mon, 10 Dec 2018 20:23:54 +0530 Subject: [PATCH] psxhdrs: Add POSIX API Signature Compliance Tests for pwd.h (GCI 2018) --- testsuites/psxtests/Makefile.am | 9 +++- 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, 296 insertions(+), 1 deletion(-) create mode 100644 testsuites/psxtests/psxhdrs/pwd/endpwent.c create mode 100644 testsuites/psxtests/psxhdrs/pwd/getpwent.c create mode 100644 testsuites/psxtests/psxhdrs/pwd/getpwnam.c create mode 100644 testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c create mode 100644 testsuites/psxtests/psxhdrs/pwd/getpwuid.c create mode 100644 testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c create mode 100644 testsuites/psxtests/psxhdrs/pwd/setpwent.c diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 62032836f8..e94a0496ca 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -1797,7 +1797,14 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \ psxhdrs/stdlib/unsetenv.c \ psxhdrs/stdlib/wcstombs.c \ psxhdrs/stdlib/wctomb.c \ - psxhdrs/sys/times/times.c + psxhdrs/sys/times/times.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 ## Not supported by RTEMS, but POSIX API Compliance tests exist. ## lib_a_SOURCES += psxhdrs/ulimit/ulimit.c diff --git a/testsuites/psxtests/psxhdrs/pwd/endpwent.c b/testsuites/psxtests/psxhdrs/pwd/endpwent.c new file mode 100644 index 0000000000..8a55f0112e --- /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 0000000000..8b7c555556 --- /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 0000000000..c356b928ad --- /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 0000000000..3a95e9a170 --- /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 0000000000..ec3733f67d --- /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 0000000000..5e7c4e5449 --- /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 0000000000..9192b93483 --- /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 ); +} -- 2.17.2
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel