From e25acd8d252d77115f8a67c53f97003ede9b5606 Mon Sep 17 00:00:00 2001 From: zehata Date: Tue, 4 Dec 2018 10:43:59 -0600 Subject: psxhdrs: Added POSIX Compliance Test fot sys/time.h (GCI 2018) --- testsuites/psxtests/Makefile.am | 8 +++- testsuites/psxtests/psxhdrs/sys/time/getitimer.c | 41 +++++++++++++++++++ .../psxtests/psxhdrs/sys/time/gettimeofday.c | 41 +++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/time/select.c | 46 ++++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/time/setitimer.c | 42 ++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/time/utimes.c | 37 +++++++++++++++++ 6 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 testsuites/psxtests/psxhdrs/sys/time/getitimer.c create mode 100644 testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c create mode 100644 testsuites/psxtests/psxhdrs/sys/time/select.c create mode 100644 testsuites/psxtests/psxhdrs/sys/time/setitimer.c create mode 100644 testsuites/psxtests/psxhdrs/sys/time/utimes.c diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index c4df4ba09a..a7ee8a59a4 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -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) diff --git a/testsuites/psxtests/psxhdrs/sys/time/getitimer.c b/testsuites/psxtests/psxhdrs/sys/time/getitimer.c new file mode 100644 index 0000000000..aa1ce8b428 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/time/getitimer.c @@ -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 + +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); +} diff --git a/testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c b/testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c new file mode 100644 index 0000000000..60a56f3370 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c @@ -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 + +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); +} diff --git a/testsuites/psxtests/psxhdrs/sys/time/select.c b/testsuites/psxtests/psxhdrs/sys/time/select.c new file mode 100644 index 0000000000..48b8fe6a42 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/time/select.c @@ -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 + +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; +} diff --git a/testsuites/psxtests/psxhdrs/sys/time/setitimer.c b/testsuites/psxtests/psxhdrs/sys/time/setitimer.c new file mode 100644 index 0000000000..32fb4da7ee --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/time/setitimer.c @@ -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 + +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); +} diff --git a/testsuites/psxtests/psxhdrs/sys/time/utimes.c b/testsuites/psxtests/psxhdrs/sys/time/utimes.c new file mode 100644 index 0000000000..9fc0e2928a --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/time/utimes.c @@ -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 + +int test(void); + +int test(void) +{ + int callback; + struct timeval tv; + + callback = utimes(NULL, &tv); + return (callback == -1); +} -- cgit v1.2.3