[rtems commit] validation: Add RTEMS_DEFINE_GLOBAL_SYMBOL() test

Sebastian Huber sebh at rtems.org
Thu Sep 14 12:01:13 UTC 2023


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep 14 14:03:16 2023 +0200

validation: Add RTEMS_DEFINE_GLOBAL_SYMBOL() test

Update #4953.

---

 testsuites/validation/tc-basedefs.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/testsuites/validation/tc-basedefs.c b/testsuites/validation/tc-basedefs.c
index 28c11af505..835f76ec64 100644
--- a/testsuites/validation/tc-basedefs.c
+++ b/testsuites/validation/tc-basedefs.c
@@ -432,6 +432,12 @@
  *   - Checked that the RTEMS_ZERO_LENGTH_ARRAY macro produces a structure
  *     similar to a structure with one element.
  *
+ * - Use the RTEMS_DEFINE_GLOBAL_SYMBOL() macro at the beginning of this file
+ *   and assign the address of the symbol to an object.
+ *
+ *   - Check that the RTEMS_DEFINE_GLOBAL_SYMBOL() macro defines a global
+ *     symbol with the correct value.
+ *
  * @{
  */
 
@@ -534,6 +540,12 @@ RTEMS_DEFINE_GLOBAL_SYMBOL(
   RTEMS_SYMBOL_NAME( global_symbol_base ) + GLOBAL_SYMBOL_VALULE( abc )
 );
 
+RTEMS_DECLARE_GLOBAL_SYMBOL( global_symbol_2 );
+
+RTEMS_DEFINE_GLOBAL_SYMBOL( global_symbol_2, 0x123 );
+
+static const char * const volatile global_symbol_2_object = global_symbol_2;
+
 static int deprecated_func( int i ) RTEMS_DEPRECATED;
 static int deprecated_func( int i )
 {
@@ -1937,12 +1949,27 @@ static void RtemsBasedefsValBasedefs_Action_55( void )
     offsetof( zero_length_struct_1, array ) );
 }
 
+/**
+ * @brief Use the RTEMS_DEFINE_GLOBAL_SYMBOL() macro at the beginning of this
+ *   file and assign the address of the symbol to an object.
+ */
+static void RtemsBasedefsValBasedefs_Action_56( void )
+{
+  /* No action */
+
+  /*
+   * Check that the RTEMS_DEFINE_GLOBAL_SYMBOL() macro defines a global symbol
+   * with the correct value.
+   */
+  T_step_eq_uptr( 129, (uintptr_t) global_symbol_2_object, 0x123 );
+}
+
 /**
  * @fn void T_case_body_RtemsBasedefsValBasedefs( void )
  */
 T_TEST_CASE( RtemsBasedefsValBasedefs )
 {
-  T_plan( 129 );
+  T_plan( 130 );
 
   RtemsBasedefsValBasedefs_Action_0();
   RtemsBasedefsValBasedefs_Action_1();
@@ -2000,6 +2027,7 @@ T_TEST_CASE( RtemsBasedefsValBasedefs )
   RtemsBasedefsValBasedefs_Action_53();
   RtemsBasedefsValBasedefs_Action_54();
   RtemsBasedefsValBasedefs_Action_55();
+  RtemsBasedefsValBasedefs_Action_56();
 }
 
 /** @} */



More information about the vc mailing list