From 746311c06e1d59c1acd7859ba07b3f1e674325e1 Mon Sep 17 00:00:00 2001 From: Jacqueline Deans <jdeans289@gmail.com> Date: Mon, 1 May 2023 15:50:39 -0500 Subject: [PATCH] Exclude memory manager int64_t tests on 32 bit architectures (#1494) --- .../test/MM_declare_var_unittest.cc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/trick_source/sim_services/MemoryManager/test/MM_declare_var_unittest.cc b/trick_source/sim_services/MemoryManager/test/MM_declare_var_unittest.cc index c5607ad1..cf25406c 100644 --- a/trick_source/sim_services/MemoryManager/test/MM_declare_var_unittest.cc +++ b/trick_source/sim_services/MemoryManager/test/MM_declare_var_unittest.cc @@ -130,6 +130,11 @@ TEST_F(MM_declare_var, UINT32_T) { validate_alloc_info_local(memmgr, test_var, TRICK_UNSIGNED_INTEGER, NULL, NULL, 1, 0, NULL); } +#if __linux +# include <stdint.h> +# include <sys/types.h> +# if __WORDSIZE == 64 +// These tests should be excluded on a 32 bit architecture TEST_F(MM_declare_var, INT64_T) { long *test_var = (long *)memmgr->declare_var("int64_t"); validate_alloc_info_local(memmgr, test_var, TRICK_INT64, NULL, NULL, 1, 0, NULL); @@ -139,6 +144,21 @@ TEST_F(MM_declare_var, UINT64_T) { unsigned long *test_var = (unsigned long *)memmgr->declare_var("uint64_t"); validate_alloc_info_local(memmgr, test_var, TRICK_UINT64, NULL, NULL, 1, 0, NULL); } +# endif +#else + +// Any OS other than linux is assumed to be 64 bit +TEST_F(MM_declare_var, INT64_T) { + long *test_var = (long *)memmgr->declare_var("int64_t"); + validate_alloc_info_local(memmgr, test_var, TRICK_INT64, NULL, NULL, 1, 0, NULL); +} + +TEST_F(MM_declare_var, UINT64_T) { + unsigned long *test_var = (unsigned long *)memmgr->declare_var("uint64_t"); + validate_alloc_info_local(memmgr, test_var, TRICK_UINT64, NULL, NULL, 1, 0, NULL); +} +#endif + TEST_F(MM_declare_var, Long) { long *test_var = (long *)memmgr->declare_var("long");