<div dir="ltr"><div dir="ltr">Hello,<br></div><div>Can someone please review this. I would like to work on the suggested changes over the weekend.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 21, 2020 at 8:45 PM Utkarsh Rai <<a href="mailto:utkarsh.rai60@gmail.com">utkarsh.rai60@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">From: Utkarsh <<a href="mailto:utkarsh.rai60@gmail.com" target="_blank">utkarsh.rai60@gmail.com</a>><br>
<br>
Closes #3890<br>
<br>
Signed-off-by: Utkarsh Rai <<a href="mailto:utkarsh.rai60@gmail.com" target="_blank">utkarsh.rai60@gmail.com</a>><br>
---<br>
spec/build/testsuites/psxtests/grp.yml | 2 +<br>
.../psxtests/psxclocknanosleep01.yml | 20 +++<br>
.../psxtests/psxclocknanosleep01/init.c | 94 ++++++++++++++<br>
.../psxclocknanosleep01.doc | 13 ++<br>
.../psxclocknanosleep01.scn | 41 ++++++<br>
.../test-clock-nanosleep.c | 120 ++++++++++++++++++<br>
6 files changed, 290 insertions(+)<br>
create mode 100644 spec/build/testsuites/psxtests/psxclocknanosleep01.yml<br>
create mode 100644 testsuites/psxtests/psxclocknanosleep01/init.c<br>
create mode 100644 testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc<br>
create mode 100644 testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn<br>
create mode 100644 testsuites/psxtests/psxclocknanosleep01/test-clock-nanosleep.c<br>
<br>
diff --git a/spec/build/testsuites/psxtests/grp.yml b/spec/build/testsuites/psxtests/grp.yml<br>
index 47dedac275..3342fc6c18 100644<br>
--- a/spec/build/testsuites/psxtests/grp.yml<br>
+++ b/spec/build/testsuites/psxtests/grp.yml<br>
@@ -79,6 +79,8 @@ links:<br>
uid: psxclock<br>
- role: build-dependency<br>
uid: psxclock01<br>
+- role: build-dependency<br>
+ uid: psxclocknanosleep01<br>
- role: build-dependency<br>
uid: psxclockrealtime01<br>
- role: build-dependency<br>
diff --git a/spec/build/testsuites/psxtests/psxclocknanosleep01.yml b/spec/build/testsuites/psxtests/psxclocknanosleep01.yml<br>
new file mode 100644<br>
index 0000000000..39ec1657d2<br>
--- /dev/null<br>
+++ b/spec/build/testsuites/psxtests/psxclocknanosleep01.yml<br>
@@ -0,0 +1,20 @@<br>
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
+build-type: test-program<br>
+cflags: []<br>
+copyrights:<br>
+- Copyright (C) 2020 Utkarsh Rai (<a href="mailto:utkarsh.rai60@mail.com" target="_blank">utkarsh.rai60@mail.com</a>)<br>
+cppflags: []<br>
+cxxflags: []<br>
+enabled-by: true<br>
+features: c cprogram<br>
+includes: []<br>
+ldflags: []<br>
+links: []<br>
+source:<br>
+- testsuites/psxtests/psxclocknanosleep01/init.c<br>
+- testsuites/psxtests/psxclocknanosleep01/test-clock-nanosleep.c<br>
+stlib: []<br>
+target: testsuites/psxtests/psxclocknanosleep01.exe<br>
+type: build<br>
+use-after: []<br>
+use-before: []<br>
diff --git a/testsuites/psxtests/psxclocknanosleep01/init.c b/testsuites/psxtests/psxclocknanosleep01/init.c<br>
new file mode 100644<br>
index 0000000000..a5cb4d6054<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxclocknanosleep01/init.c<br>
@@ -0,0 +1,94 @@<br>
+/* SPDX-License-Identifier: BSD-2-Clause <br>
+ *<br>
+ * Copyright (C) 2020 Utkarsh Rai<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>
+#ifdef HAVE_CONFIG_H<br>
+#include "config.h"<br>
+#endif<br>
+<br>
+#include <rtems.h><br>
+#include <rtems/bspIo.h><br>
+#include <rtems/linkersets.h><br>
+#include <rtems/test.h><br>
+#include <rtems/test-info.h><br>
+#include <tmacros.h><br>
+<br>
+const char rtems_test_name[] = "PSXCLOCKNANOSLEEP01";<br>
+<br>
+static char buffer[512];<br>
+<br>
+static const T_action actions[] = {<br>
+ T_report_hash_sha256,<br>
+ T_check_task_context,<br>
+ T_check_file_descriptors,<br>
+ T_check_rtems_barriers,<br>
+ T_check_rtems_extensions,<br>
+ T_check_rtems_message_queues,<br>
+ T_check_rtems_partitions,<br>
+ T_check_rtems_periods,<br>
+ T_check_rtems_regions,<br>
+ T_check_rtems_semaphores,<br>
+ T_check_rtems_tasks,<br>
+ T_check_rtems_timers,<br>
+ T_check_posix_keys<br>
+};<br>
+<br>
+static const T_config config = {<br>
+ .name = "POSIXCLOCKNANOSLEEPTEST01",<br>
+ .buf = buffer,<br>
+ .buf_size = sizeof( buffer ),<br>
+ .putchar = rtems_put_char,<br>
+ .verbosity = T_VERBOSE,<br>
+ .now = T_now_clock,<br>
+ .action_count = T_ARRAY_SIZE( actions ),<br>
+ .actions = actions<br>
+};<br>
+<br>
+static void<br>
+Init( rtems_task_argument arg )<br>
+{<br>
+ int exit_code;<br>
+<br>
+ (void) arg;<br>
+ TEST_BEGIN();<br>
+<br>
+ T_register();<br>
+ exit_code = T_main( &config );<br>
+ if (exit_code == 0) {<br>
+ TEST_END();<br>
+ }<br>
+<br>
+ rtems_test_exit( exit_code );<br>
+}<br>
+<br>
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
+<br>
+#define CONFIGURE_MAXIMUM_TASKS 1<br>
+<br>
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
+<br>
+#define CONFIGURE_INIT<br>
+<br>
+#include <rtems/confdefs.h><br>
\ No newline at end of file<br>
diff --git a/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc b/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc<br>
new file mode 100644<br>
index 0000000000..803c2cff15<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc<br>
@@ -0,0 +1,13 @@<br>
+This file describes the directives and concepts tested by this test set.<br>
+<br>
+test set name: psxclocknanosleep01<br>
+<br>
+directives:<br>
+<br>
+- clock_nanosleep()<br>
+<br>
+concepts:<br>
+<br>
+- Test some invalid and extreme timeout values.<br>
+- Ensure that the CLOCK_MONOTONIC based delay is not affected by changes to<br>
+ CLOCK_REALTIME<br>
\ No newline at end of file<br>
diff --git a/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn b/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn<br>
new file mode 100644<br>
index 0000000000..aa0050e3cd<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn<br>
@@ -0,0 +1,41 @@<br>
+*** BEGIN OF TEST PSXCLOCKNANOSLEEP01 ***<br>
+*** TEST VERSION: 6.0.0.314dae32156aa3d1f54f1ee104b26604a32cae4f<br>
+*** TEST STATE: EXPECTED_PASS<br>
+*** TEST BUILD:<br>
+*** TEST TOOLS: 10.2.1 20200904 (RTEMS 6, RSB 47f32b8b1a597b5ed3475722bdc155249ef51115, Newlib a0d7982)<br>
+A:POSIXCLOCKNANOSLEEPTEST01<br>
+S:Platform:RTEMS<br>
+S:Compiler:10.2.1 20200904 (RTEMS 6, RSB 47f32b8b1a597b5ed3475722bdc155249ef51115, Newlib a0d7982)<br>
+S:Version:6.0.0.314dae32156aa3d1f54f1ee104b26604a32cae4f<br>
+S:BSP:realview_pbx_a9_qemu<br>
+S:RTEMS_DEBUG:0<br>
+S:RTEMS_MULTIPROCESSING:0<br>
+S:RTEMS_POSIX_API:0<br>
+S:RTEMS_PROFILING:0<br>
+S:RTEMS_SMP:0<br>
+B:POSIXClock_Timeout_negative_sec_nsec<br>
+P:0:0:UI1:test-clock-nanosleep.c:97<br>
+E:POSIXClock_Timeout_negative_sec_nsec:N:1:F:0:D:0.003693<br>
+B:POSIXClock_Timeout_negative_sec<br>
+P:0:0:UI1:test-clock-nanosleep.c:72<br>
+E:POSIXClock_Timeout_negative_sec:N:1:F:0:D:0.000347<br>
+B:POSIXClock_Timeout_negative_nsec<br>
+P:0:0:UI1:test-clock-nanosleep.c:85<br>
+E:POSIXClock_Timeout_negative_nsec:N:1:F:0:D:0.000227<br>
+B:POSIXClock_Timeout_huge_nsec<br>
+P:0:0:UI1:test-clock-nanosleep.c:60<br>
+E:POSIXClock_Timeout_huge_nsec:N:1:F:0:D:0.000224<br>
+B:POSIXClock_Timeout_finite<br>
+P:0:0:UI1:test-clock-nanosleep.c:43<br>
+P:1:0:UI1:test-clock-nanosleep.c:48<br>
+E:POSIXClock_Timeout_finite:N:2:F:0:D:0.002504<br>
+B:POSIXClock_Timeout_clock_modify<br>
+P:0:0:UI1:test-clock-nanosleep.c:107<br>
+P:1:0:UI1:test-clock-nanosleep.c:111<br>
+P:2:0:UI1:test-clock-nanosleep.c:114<br>
+P:3:0:UI1:test-clock-nanosleep.c:119<br>
+E:POSIXClock_Timeout_clock_modify:N:4:F:0:D:1.009321<br>
+Z:POSIXCLOCKNANOSLEEPTEST01:C:6:N:10:F:0:D:1.018286<br>
+Y:ReportHash:SHA256:cc043d8e8d1a25d2d3a5fb341169ebd8b64e8ba10bc85f34c9905e89c1e01b4f<br>
+<br>
+*** END OF TEST PSXCLOCKNANOSLEEP01 ***<br>
\ No newline at end of file<br>
diff --git a/testsuites/psxtests/psxclocknanosleep01/test-clock-nanosleep.c b/testsuites/psxtests/psxclocknanosleep01/test-clock-nanosleep.c<br>
new file mode 100644<br>
index 0000000000..d61829c5fe<br>
--- /dev/null<br>
+++ b/testsuites/psxtests/psxclocknanosleep01/test-clock-nanosleep.c<br>
@@ -0,0 +1,120 @@<br>
+/* SPDX-License-Identifier: BSD-2-Clause <br>
+ *<br>
+ * Copyright (C) 2020 Utkarsh Rai<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>
+#ifdef HAVE_CONFIG_H<br>
+#include "config.h"<br>
+#endif<br>
+<br>
+#include <errno.h><br>
+#include <limits.h><br>
+#include <time.h><br>
+#include <rtems/test.h><br>
+#include <rtems/test-info.h><br>
+<br>
+T_TEST_CASE( POSIXClock_Timeout_finite )<br>
+{<br>
+ struct timespec delay_time;<br>
+ int eno;<br>
+<br>
+ eno = clock_gettime( CLOCK_MONOTONIC, &delay_time );<br>
+ T_eno_success( eno );<br>
+<br>
+ delay_time.tv_sec = 1;<br>
+<br>
+ eno = clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &delay_time, NULL );<br>
+ T_eno_success( eno );<br>
+}<br>
+<br>
+T_TEST_CASE( POSIXClock_Timeout_huge_nsec )<br>
+{<br>
+ struct timespec delay_time;<br>
+ int eno;<br>
+<br>
+ delay_time.tv_sec = 1;<br>
+ delay_time.tv_nsec = LONG_MAX;<br>
+<br>
+ eno = clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &delay_time, NULL );<br>
+ T_eno( EINVAL, eno );<br>
+}<br>
+<br>
+T_TEST_CASE( POSIXClock_Timeout_negative_sec )<br>
+{<br>
+ struct timespec delay_time;<br>
+ int eno;<br>
+<br>
+ delay_time.tv_sec = -1;<br>
+ delay_time.tv_nsec = 1;<br>
+<br>
+ eno = clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &delay_time, NULL );<br>
+ T_eno_success( eno );<br>
+<br>
+}<br>
+<br>
+T_TEST_CASE( POSIXClock_Timeout_negative_nsec )<br>
+{<br>
+ struct timespec delay_time;<br>
+ int eno;<br>
+<br>
+ delay_time.tv_sec = 1;<br>
+ delay_time.tv_nsec = -1;<br>
+<br>
+ eno = clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &delay_time, NULL );<br>
+ T_eno( EINVAL, eno );<br>
+}<br>
+<br>
+T_TEST_CASE(POSIXClock_Timeout_negative_sec_nsec)<br>
+{<br>
+ struct timespec delay_time;<br>
+ int eno;<br>
+<br>
+ delay_time.tv_sec = -1;<br>
+ delay_time.tv_nsec = -1;<br>
+<br>
+ eno = clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &delay_time, NULL );<br>
+ T_eno( EINVAL, eno);<br>
+}<br>
+<br>
+T_TEST_CASE( POSIXClock_Timeout_clock_modify )<br>
+{<br>
+ struct timespec configure_time;<br>
+ struct timespec delay_time;<br>
+ int eno;<br>
+<br>
+ eno = clock_gettime( CLOCK_REALTIME, &configure_time );<br>
+ T_eno_success( eno );<br>
+<br>
+ configure_time.tv_sec += 3600;<br>
+ eno = clock_settime( CLOCK_REALTIME, &configure_time );<br>
+ T_eno_success( eno );<br>
+<br>
+ eno = clock_gettime( CLOCK_MONOTONIC, &delay_time );<br>
+ T_eno_success( eno );<br>
+<br>
+ delay_time.tv_sec += 1;<br>
+<br>
+ eno = clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &delay_time, NULL );<br>
+ T_eno_success( eno );<br>
+}<br>
\ No newline at end of file<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div></div>