[rtems commit] psxtests/psxcancel: Add resource check

Sebastian Huber sebh at rtems.org
Tue May 17 09:00:30 UTC 2016


Module:    rtems
Branch:    master
Commit:    f014f84eb39296b573ac137f1eb484f7335ab720
Changeset: http://git.rtems.org/rtems/commit/?id=f014f84eb39296b573ac137f1eb484f7335ab720

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue May 17 09:41:34 2016 +0200

psxtests/psxcancel: Add resource check

---

 testsuites/psxtests/psxcancel/init.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/testsuites/psxtests/psxcancel/init.c b/testsuites/psxtests/psxcancel/init.c
index 2ab56c2..9b6168e 100644
--- a/testsuites/psxtests/psxcancel/init.c
+++ b/testsuites/psxtests/psxcancel/init.c
@@ -18,7 +18,7 @@
 
 #if defined(__rtems__)
   #include <rtems.h>
-  #include <bsp.h>
+  #include <rtems/libcsupport.h>
   #include <pmacros.h>
 #endif
 
@@ -26,18 +26,19 @@ const char rtems_test_name[] = "PSXCANCEL";
 
 /* forward declarations to avoid warnings */
 void *POSIX_Init(void *argument);
-void countTask_cancel_handler(void *ignored);
-void *countTaskDeferred(void *ignored);
-void *countTaskAsync(void *ignored);
 
-volatile bool countTask_handler;
+#if defined(__rtems__)
+static rtems_resource_snapshot initialSnapshot;
+#endif
 
-void countTask_cancel_handler(void *ignored)
+static volatile bool countTask_handler;
+
+static void countTask_cancel_handler(void *ignored)
 {
   countTask_handler = true;
 }
 
-void *countTaskDeferred(void *ignored)
+static void *countTaskDeferred(void *ignored)
 {
   int i=0;
   int type,state;
@@ -56,7 +57,7 @@ void *countTaskDeferred(void *ignored)
   }
 }
 
-void *countTaskAsync(void *ignored)
+static void *countTaskAsync(void *ignored)
 {
   int i=0;
   int type,state;
@@ -81,6 +82,20 @@ void *countTaskAsync(void *ignored)
   }
 }
 
+static void resourceSnapshotInit( void )
+{
+#if defined(__rtems__)
+  rtems_resource_snapshot_take( &initialSnapshot );
+#endif
+}
+
+static void resourceSnapshotCheck( void )
+{
+#if defined(__rtems__)
+  rtems_test_assert( rtems_resource_snapshot_check( &initialSnapshot ) );
+#endif
+}
+
 #if defined(__rtems__)
   void *POSIX_Init(void *ignored)
 #else
@@ -94,6 +109,8 @@ void *countTaskAsync(void *ignored)
 
   TEST_BEGIN();
 
+  resourceSnapshotInit();
+
   /* generate some error conditions */
   puts( "Init - pthread_setcancelstate - NULL oldstate" );
   sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
@@ -145,6 +162,7 @@ void *countTaskAsync(void *ignored)
     fatal_posix_service_status( sc, 0, "join async" );
   }
 
+  resourceSnapshotCheck();
 
   TEST_END();
 




More information about the vc mailing list