[rtems commit] psxhdrs: Added POSIX Compliance Test fot sys/time.h ( GCI 2018)
Joel Sherrill
joel at rtems.org
Tue Dec 4 16:46:19 UTC 2018
Module: rtems
Branch: master
Commit: e25acd8d252d77115f8a67c53f97003ede9b5606
Changeset: http://git.rtems.org/rtems/commit/?id=e25acd8d252d77115f8a67c53f97003ede9b5606
Author: zehata <zenon.hans.taneka at dhs.sg>
Date: Tue Dec 4 10:43:59 2018 -0600
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(-)
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index c4df4ba..a7ee8a5 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 0000000..aa1ce8b
--- /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 <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);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c b/testsuites/psxtests/psxhdrs/sys/time/gettimeofday.c
new file mode 100644
index 0000000..60a56f3
--- /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 <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);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/time/select.c b/testsuites/psxtests/psxhdrs/sys/time/select.c
new file mode 100644
index 0000000..48b8fe6
--- /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 <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;
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/time/setitimer.c b/testsuites/psxtests/psxhdrs/sys/time/setitimer.c
new file mode 100644
index 0000000..32fb4da
--- /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 <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);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/time/utimes.c b/testsuites/psxtests/psxhdrs/sys/time/utimes.c
new file mode 100644
index 0000000..9fc0e29
--- /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 <sys/time.h>
+
+int test(void);
+
+int test(void)
+{
+ int callback;
+ struct timeval tv;
+
+ callback = utimes(NULL, &tv);
+ return (callback == -1);
+}
More information about the vc
mailing list