Hi guys,
Here is the new test suite according to <pthread.h> with
"pthread_cleanup_push" and "pthread_cleanup_pop".

Thanks
Himanshu
From b1ebe5266c513bd06347c7c6fbbcb2f533680b39 Mon Sep 17 00:00:00 2001
From: Himanshu40 <himanshuwindows...@gmail.com>
Date: Sat, 17 Nov 2018 22:39:05 +0530
Subject: [PATCH] psxtmcleanup01: Added new POSIX timing suite(GCI 2018)

---
 testsuites/psxtmtests/Makefile.am             | 13 ++-
 testsuites/psxtmtests/configure.ac            |  1 +
 testsuites/psxtmtests/psxtmcleanup01/init.c   | 94 +++++++++++++++++++
 .../psxtmcleanup01/psxtmcleanup01.doc         | 19 ++++
 testsuites/psxtmtests/psxtmtests_plan.csv     |  4 +-
 5 files changed, 128 insertions(+), 3 deletions(-)
 create mode 100644 testsuites/psxtmtests/psxtmcleanup01/init.c
 create mode 100644 testsuites/psxtmtests/psxtmcleanup01/psxtmcleanup01.doc

diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am
index ae2af47a82..7728d6ebcd 100644
--- a/testsuites/psxtmtests/Makefile.am
+++ b/testsuites/psxtmtests/Makefile.am
@@ -57,6 +57,18 @@ psxtmbarrier04_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxtmbarrier04) \
 	-DOPERATION_COUNT=$(OPERATION_COUNT)
 endif
 
+if TEST_psxtmcleanup01
+psxtm_tests += psxtmcleanup01
+psxtm_docs += psxtmcleanup01/psxtmcleanup01.doc
+psxtmcleanup01_SOURCES = psxtmcleanup01/init.c \
+	../tmtests/include/timesys.h ../support/src/tmtests_empty_function.c \
+	../support/src/tmtests_support.c
+psxtmcleanup01_CPPFLAGS = $(AM_CPPFLAGS) \
+	$(TEST_FLAGS_psxtmcleanup01) $(support_includes) \
+	-I$(top_srcdir)/../tmtests/include \
+	-DOPERATION_COUNT=$(OPERATION_COUNT)
+endif
+
 if TEST_psxtmclocknanosleep01
 psxtm_tests += psxtmclocknanosleep01
 psxtm_docs += psxtmclocknanosleep01/psxtmclocknanosleep01.doc
@@ -582,4 +594,3 @@ endif
 
 rtems_tests_PROGRAMS = $(psxtm_tests)
 dist_rtems_tests_DATA = $(psxtm_screens) $(psxtm_docs)
-
diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac
index dde3e9b879..2d45052c53 100644
--- a/testsuites/psxtmtests/configure.ac
+++ b/testsuites/psxtmtests/configure.ac
@@ -34,6 +34,7 @@ RTEMS_TEST_CHECK([psxtmbarrier01])
 RTEMS_TEST_CHECK([psxtmbarrier02])
 RTEMS_TEST_CHECK([psxtmbarrier03])
 RTEMS_TEST_CHECK([psxtmbarrier04])
+RTEMS_TEST_CHECK([psxtmcleanup01])
 RTEMS_TEST_CHECK([psxtmclocknanosleep01])
 RTEMS_TEST_CHECK([psxtmclocknanosleep02])
 RTEMS_TEST_CHECK([psxtmclocknanosleep03])
diff --git a/testsuites/psxtmtests/psxtmcleanup01/init.c b/testsuites/psxtmtests/psxtmcleanup01/init.c
new file mode 100644
index 0000000000..9060ab8d3f
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmcleanup01/init.c
@@ -0,0 +1,94 @@
+/*
+ *  COPYRIGHT (c) 2018.
+ *  Himanshu Sekhar Nayak(GCI 2018)
+ *
+ *  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 <pthread.h>
+#include <timesys.h>
+#include <tmacros.h>
+#include <rtems/btimer.h>
+#include "test_support.h"
+
+const char rtems_test_name[] = "PSXTMCLEANUP01";
+
+/* forward declarations to avoid warnings */
+void *POSIX_Init(void *argument);
+
+int status = 1;
+
+static void routine(void *arg)
+{
+}
+
+void benchmark_pthread_cleanup_push_pull(void)
+{
+  long end_time;
+  int execute = 1;
+  status = 0;
+
+  benchmark_timer_initialize();
+  pthread_cleanup_push(routine, NULL);
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+  put_time(
+    "pthread_cleanup_push : only case",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+
+  benchmark_timer_initialize();
+  pthread_cleanup_pop( execute );
+  end_time = benchmark_timer_read();
+  rtems_test_assert( status == 0 );
+  put_time(
+    "pthread_cleanup_pop : only case",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+
+}
+
+void *POSIX_Init(
+  void *argument
+)
+{
+
+  TEST_BEGIN();
+
+  benchmark_pthread_cleanup_push_pull();
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/psxtmtests/psxtmcleanup01/psxtmcleanup01.doc b/testsuites/psxtmtests/psxtmcleanup01/psxtmcleanup01.doc
new file mode 100644
index 0000000000..4faaee50b9
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmcleanup01/psxtmcleanup01.doc
@@ -0,0 +1,19 @@
+#  COPYRIGHT (c) 2018.
+#  Himanshu Sekhar Nayak(GCI 2018)
+#
+#  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.
+#
+
+This test benchmarks the following operations:
+
++ pthread_cleanup_push : only case
++ pthread_cleanup_pop : only case
diff --git a/testsuites/psxtmtests/psxtmtests_plan.csv b/testsuites/psxtmtests/psxtmtests_plan.csv
index 25beefbc4b..83a07e3bd2 100644
--- a/testsuites/psxtmtests/psxtmtests_plan.csv
+++ b/testsuites/psxtmtests/psxtmtests_plan.csv
@@ -69,8 +69,8 @@
 "pthread_setcancelstate"
 "pthread_setcanceltype"
 "pthread_testcancel"
-"pthread_cleanup_push: only case","psxtmcleanup01","psxtmtest_single","No"
-"pthread_cleanup_pop: only case","psxtmcleanup01","psxtmtest_single","No"
+"pthread_cleanup_push: only case","psxtmcleanup01","psxtmtest_single","Yes"
+"pthread_cleanup_pop: only case","psxtmcleanup01","psxtmtest_single","Yes"
 
 "pthread_getcpuclockid"
 
-- 
2.17.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to