summaryrefslogtreecommitdiffstats
path: root/testsuites/validation
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-09-12 16:42:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-09-13 07:45:35 +0200
commitd7a6e803984e5508c30aa9e3625c76460beb807b (patch)
tree19382632dfd4e54d4719774693fadc513a6368d4 /testsuites/validation
parentscore: Fix RTEMS_DEFINE_GLOBAL_SYMBOL() (diff)
downloadrtems-d7a6e803984e5508c30aa9e3625c76460beb807b.tar.bz2
tests: Improve RTEMS_DEFINE_GLOBAL_SYMBOL() tests
Use a symbol value relative to an existing symbol address to make the test work on more code models. Update #4953.
Diffstat (limited to 'testsuites/validation')
-rw-r--r--testsuites/validation/tc-basedefs.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/testsuites/validation/tc-basedefs.c b/testsuites/validation/tc-basedefs.c
index 94600f5241..28c11af505 100644
--- a/testsuites/validation/tc-basedefs.c
+++ b/testsuites/validation/tc-basedefs.c
@@ -527,8 +527,12 @@ RTEMS_COMPILER_PURE_ATTRIBUTE static int compiler_pure_attribute_func( void )
return 21;
}
+static int global_symbol_base;
+
RTEMS_DEFINE_GLOBAL_SYMBOL(
- GLOBAL_SYMBOL, GLOBAL_SYMBOL_VALULE( abc ) );
+ GLOBAL_SYMBOL,
+ RTEMS_SYMBOL_NAME( global_symbol_base ) + GLOBAL_SYMBOL_VALULE( abc )
+);
static int deprecated_func( int i ) RTEMS_DEPRECATED;
static int deprecated_func( int i )
@@ -1055,7 +1059,11 @@ static void RtemsBasedefsValBasedefs_Action_18( void )
* which is defined in a file different from the file in which the gobal
* symbol is defined.
*/
- T_step_eq_int( 45, basedefs_get_global_symbol(), 0xabc );
+ T_step_eq_uptr(
+ 45,
+ basedefs_get_global_symbol() - (uintptr_t) &global_symbol_base,
+ 0xabc
+ );
}
/**
@@ -1089,7 +1097,11 @@ static void RtemsBasedefsValBasedefs_Action_20( void )
* Check that the RTEMS_DEFINE_GLOBAL_SYMBOL() macro defines a global symbol
* with the correct value.
*/
- T_step_eq_int( 49, (uintptr_t) global_symbol, 0xabc );
+ T_step_eq_uptr(
+ 49,
+ (uintptr_t) global_symbol - (uintptr_t) &global_symbol_base,
+ 0xabc
+ );
}
/**