mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 14:18:20 +00:00
psxhdrs: Add POSIX API Signature Compliance Tests for pwd.h (GCI 2018)
This commit is contained in:
committed by
Joel Sherrill
parent
c107f2b778
commit
b05aa8ee41
@@ -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 \
|
||||
|
||||
39
testsuites/psxtests/psxhdrs/pwd/endpwent.c
Normal file
39
testsuites/psxtests/psxhdrs/pwd/endpwent.c
Normal file
@@ -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 );
|
||||
}
|
||||
38
testsuites/psxtests/psxhdrs/pwd/getpwent.c
Normal file
38
testsuites/psxtests/psxhdrs/pwd/getpwent.c
Normal file
@@ -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 );
|
||||
}
|
||||
38
testsuites/psxtests/psxhdrs/pwd/getpwnam.c
Normal file
38
testsuites/psxtests/psxhdrs/pwd/getpwnam.c
Normal file
@@ -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 );
|
||||
}
|
||||
47
testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c
Normal file
47
testsuites/psxtests/psxhdrs/pwd/getpwnam_r.c
Normal file
@@ -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 );
|
||||
}
|
||||
39
testsuites/psxtests/psxhdrs/pwd/getpwuid.c
Normal file
39
testsuites/psxtests/psxhdrs/pwd/getpwuid.c
Normal file
@@ -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 );
|
||||
}
|
||||
48
testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c
Normal file
48
testsuites/psxtests/psxhdrs/pwd/getpwuid_r.c
Normal file
@@ -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 );
|
||||
}
|
||||
39
testsuites/psxtests/psxhdrs/pwd/setpwent.c
Normal file
39
testsuites/psxtests/psxhdrs/pwd/setpwent.c
Normal file
@@ -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 );
|
||||
}
|
||||
Reference in New Issue
Block a user