<div dir="ltr"><div>Hello everyone,</div><div>I sent this patch regarding adding a test for pthread_getcpuclockid method a few days ago.<br></div><div>If someone could test it.</div><div><br></div><div>thanks <br></div><div>-Eshan <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 10, 2020 at 2:00 AM Eshan dhawan <<a href="mailto:eshandhawan51@gmail.com">eshandhawan51@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
testsuites/psxtests/Makefile.am | 10 ++<br>
testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 1 +<br>
testsuites/psxtests/psxgetcpuclockid01/init.c | 120 ++++++++++++++++++<br>
.../psxgetcpuclockid01/psxgetcpuclockid01.doc | 19 +++<br>
.../psxgetcpuclockid01/psxgetcpuclockid01.scn | 4 +<br>
5 files changed, 154 insertions(+)<br>
create mode 100644 testsuites/psxtests/psxgetcpuclockid01/init.c<br>
create mode 100644 testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.doc<br>
create mode 100644 testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.scn<br>
<br>
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am<br>
index 1f9e4233ec..ffadff16e7 100755<br>
--- a/testsuites/psxtests/Makefile.am<br>
+++ b/testsuites/psxtests/Makefile.am<br>
@@ -462,6 +462,16 @@ psxgetattrnp01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxgetattrnp01) \<br>
$(support_includes) -I$(top_srcdir)/include<br>
endif<br>
<br>
+if TEST_psxgetcpuclockid01<br>
+psx_tests += psxgetcpuclockid01<br>
+psx_screens += psxgetcpuclockid01/psxgetcpuclockid01.scn<br>
+psx_docs += psxgetcpuclockid01/psxgetcpuclockid01.doc<br>
+psxgetcpuclockid01_SOURCES = psxgetcpuclockid01/init.c<br>
+psxgetcpuclockid01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxgetcpuclockid01) \<br>
+ $(support_includes)<br>
+endif<br>
+<br>
+<br>
if TEST_psxgetrusage01<br>
psx_tests += psxgetrusage01<br>
psx_screens += psxgetrusage01/psxgetrusage01.scn<br>
diff --git a/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 139787cccb..c509086abc 100644<br>
--- a/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/testsuites/psxtests/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -91,6 +91,7 @@ RTEMS_TEST_CHECK([psxfile01])<br>
RTEMS_TEST_CHECK([psxfile02])<br>
RTEMS_TEST_CHECK([psxfilelock01])<br>
RTEMS_TEST_CHECK([psxgetattrnp01])<br>
+RTEMS_TEST_CHECK([psxgetcpuclockid01])<br>
RTEMS_TEST_CHECK([psxgetrusage01])<br>
RTEMS_TEST_CHECK([psxglobalcon01])<br>
RTEMS_TEST_CHECK([psxglobalcon02])<br>
diff --git a/testsuites/psxtests/psxgetcpuclockid01/init.c b/testsuites/psxtests/psxgetcpuclockid01/init.c<br>
new file mode 100644<br>
index 0000000000..8e1093e44b<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxgetcpuclockid01/init.c<br>
@@ -0,0 +1,120 @@<br>
+/*<br>
+ * @file<br>
+ * @brief Test suite for getcpuclockid methods<br>
+ */<br>
+<br>
+/*<br>
+ * SPDX-License-Identifier: BSD-2-Clause<br>
+ *<br>
+ * Copyright (C) 2020 Eshan Dhawan<br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ * notice, this list of conditions and the following disclaimer.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br>
+ * notice, this list of conditions and the following disclaimer in the<br>
+ * documentation and/or other materials provided with the distribution.<br>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE<br>
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
+ * POSSIBILITY OF SUCH DAMAGE.<br>
+ */<br>
+<br>
+<br>
+#ifdef HAVE_CONFIG_H<br>
+#include "config.h"<br>
+#endif<br>
+<br>
+#include <errno.h><br>
+#include <pthread.h><br>
+#include <stdint.h><br>
+#include <rtems/test.h><br>
+#include <sys/utsname.h><br>
+#include <unistd.h><br>
+#include <errno.h><br>
+#include <sched.h><br>
+<br>
+#include <rtems/score/todimpl.h><br>
+#include <rtems/score/threadimpl.h><br>
+#include "tmacros.h"<br>
+<br>
+const char rtems_test_name[] = "PSXGETCPUCLOCKID 1";<br>
+<br>
+/* Forward declaration to avoid warnings */<br>
+rtems_task Init(rtems_task_argument ignored);<br>
+void *test_pthread(void *);<br>
+/* test_task function begins */<br>
+void *test_pthread(void *arg)<br>
+{<br>
+ int r;<br>
+ clockid_t cid;<br>
+<br>
+ r = pthread_getcpuclockid( pthread_self(), &cid );<br>
+ if(r)<br>
+ {<br>
+ printf( "pthread_getcpuclockid : 0x%d", r );<br>
+ }<br>
+ rtems_test_assert( r == 0 );<br>
+<br>
+ pthread_exit(0);<br>
+ return NULL;<br>
+}<br>
+<br>
+/* init test function begins */<br>
+rtems_task Init(rtems_task_argument ignored)<br>
+{<br>
+ TEST_BEGIN();<br>
+<br>
+ int r;<br>
+ clockid_t cid;<br>
+ pthread_t thread_id;<br>
+<br>
+ r= pthread_create( &thread_id, NULL, test_pthread, NULL );<br>
+ if( r )<br>
+ {<br>
+ printf( "pthread_create : 0x%d", r );<br>
+ }<br>
+ rtems_test_assert( r == 0 );<br>
+<br>
+ r = pthread_join( thread_id, NULL );<br>
+ if( r )<br>
+ {<br>
+ printf( "pthread_join : 0x%d", r );<br>
+ }<br>
+ rtems_test_assert( r == 0 );<br>
+<br>
+ r = pthread_getcpuclockid( thread_id, &cid );<br>
+ if( r != ESRCH )<br>
+ {<br>
+ printf( "pthread_getcpuclockid : 0x%d", r );<br>
+ }<br>
+ rtems_test_assert( r == ESRCH );<br>
+<br>
+ TEST_END();<br>
+ rtems_test_exit(0);<br>
+}<br>
+<br>
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER<br>
+<br>
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 2<br>
+#define CONFIGURE_MAXIMUM_TASKS 1<br>
+<br>
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION<br>
+<br>
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
+<br>
+#define CONFIGURE_INIT<br>
+<br>
+#include <rtems/confdefs.h><br>
+<br>
diff --git a/testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.doc b/testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.doc<br>
new file mode 100644<br>
index 0000000000..145f009337<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.doc<br>
@@ -0,0 +1,19 @@<br>
+# COPYRIGHT (c) 2020<br>
+# On-Line Applications Research Corporation (OAR).<br>
+#<br>
+# SPDX-License-Identifier: BSD-2-Clause<br>
+#<br>
+<br>
+This file describes the directives and concepts tested by this test set.<br>
+<br>
+test set name: psxgetcpuclockid 1<br>
+<br>
+Directives:<br>
+ Pthread_getcpuclockid()<br>
+<br>
+Concepts:<br>
+<br>
++ This test exercises the getcpuclockid methods.<br>
+<br>
++ For pthread_getcpuclockid it created a pthread using pthread_create and then finds<br>
+the clockid_t of that thread and then ends the thread.<br>
+After the thread is ended it again tried to find the clockid_t of the thread to check<br>
+for ESRCH exception.<br>
+<br>
diff --git a/testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.scn b/testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.scn<br>
new file mode 100644<br>
index 0000000000..937a908fd5<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxgetcpuclockid01/psxgetcpuclockid01.scn<br>
@@ -0,0 +1,4 @@<br>
+*** BEGIN OF TEST PSXGETCLOCKID 1 ***<br>
+<br>
+*** END OF TEST PSXGETCPUCLOCKID 1 ***<br>
+<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>