forked from Imagelibrary/rtems
psxhdrs: Added POSIX Compliance Test fot sys/time.h (GCI 2018)
This commit is contained in:
@@ -1141,7 +1141,13 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
|
||||
psxhdrs/fnmatch/fnmatch.c \
|
||||
psxhdrs/iconv/iconv.c \
|
||||
psxhdrs/iconv/iconv_close.c \
|
||||
psxhdrs/iconv/iconv_open.c
|
||||
psxhdrs/iconv/iconv_open.c \
|
||||
psxhdrs/regex/regfree.c \
|
||||
psxhdrs/sys/time/select.c \
|
||||
psxhdrs/sys/time/utimes.c \
|
||||
psxhdrs/sys/time/setitimer.c \
|
||||
psxhdrs/sys/time/getitimer.c \
|
||||
psxhdrs/sys/time/gettimeofday.c
|
||||
endif
|
||||
|
||||
rtems_tests_PROGRAMS = $(psx_tests)
|
||||
|
||||
41
testsuites/psxtests/psxhdrs/sys/time/getitimer.c
Normal file
41
testsuites/psxtests/psxhdrs/sys/time/getitimer.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief getitimer() API Conformance Test
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) <2018>.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* 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/time.h>
|
||||
|
||||
int test(void);
|
||||
|
||||
int test(void)
|
||||
{
|
||||
int which,callback;
|
||||
struct itimerval timeval;
|
||||
it_interval interval = 0;
|
||||
it_value value = 0;
|
||||
|
||||
timeval.it_interval = interval;
|
||||
timeval.it_value = value;
|
||||
callback = getitimer(which, &timeval);
|
||||
return (callback == 0);
|
||||
}
|
||||
41
testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c
Normal file
41
testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief gettimeofday() API Conformance Test
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) <2018>.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* 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/time.h>
|
||||
|
||||
int test(void);
|
||||
|
||||
int test(void)
|
||||
{
|
||||
int which,callback;
|
||||
struct itimerval timeval;
|
||||
it_interval interval = 0;
|
||||
it_value value = 0;
|
||||
|
||||
timeval.it_interval = interval;
|
||||
timeval.it_value = value;
|
||||
callback = gettimeofday(&timeval);
|
||||
return (callback == 0);
|
||||
}
|
||||
46
testsuites/psxtests/psxhdrs/sys/time/select.c
Normal file
46
testsuites/psxtests/psxhdrs/sys/time/select.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief select() API Conformance Test
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) <2018>.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* 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/time.h>
|
||||
|
||||
int test(void);
|
||||
|
||||
int test(void)
|
||||
{
|
||||
int callback;
|
||||
int nfds = 0;
|
||||
struct timeval tv;
|
||||
time_t tv_sec = 0;
|
||||
suseconds_t tv_usec = 0;
|
||||
fd_set readfds, writefds, errorfds;
|
||||
|
||||
tv.tv_sec = tv_sec;
|
||||
tv.tv_usec = tv_usec;
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&errorfds);
|
||||
callback = select(nfds, &readfds, &writefds, &errorfds, &tv);
|
||||
return callback;
|
||||
}
|
||||
42
testsuites/psxtests/psxhdrs/sys/time/setitimer.c
Normal file
42
testsuites/psxtests/psxhdrs/sys/time/setitimer.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief setitimer() API Conformance Test
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) <2018>.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* 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/time.h>
|
||||
|
||||
int test(void);
|
||||
|
||||
int test(void)
|
||||
{
|
||||
int which,callback;
|
||||
struct itimerval timeval;
|
||||
it_interval interval = 0;
|
||||
it_value value = 0;
|
||||
|
||||
timeval.it_interval = interval;
|
||||
timeval.it_value = value;
|
||||
setitimer(which, &timeval, NULL);
|
||||
callback = getitimer(which, &timeval);
|
||||
return (callback == 0);
|
||||
}
|
||||
37
testsuites/psxtests/psxhdrs/sys/time/utimes.c
Normal file
37
testsuites/psxtests/psxhdrs/sys/time/utimes.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief utimes() API Conformance Test
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) <2018>.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* 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/time.h>
|
||||
|
||||
int test(void);
|
||||
|
||||
int test(void)
|
||||
{
|
||||
int callback;
|
||||
struct timeval tv;
|
||||
|
||||
callback = utimes(NULL, &tv);
|
||||
return (callback == -1);
|
||||
}
|
||||
Reference in New Issue
Block a user