-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Is your feature request related to a problem? Please describe.
This is another piece of the work on macOS support in #352 .
When I run the osal_loader_UT from IDE (CLion), some of the tests are failing because the module files they exercise are not there.
Example:
[BEGIN] 01 OS_ModuleLoad
[ PASS] 01.001 ut_osloader_module_test.c:74 - #1 Null-pointer-arg-1
[ PASS] 01.002 ut_osloader_module_test.c:83 - #2 Null-pointer-arg-2
[ PASS] 01.003 ut_osloader_module_test.c:92 - #3 Null-pointer-arg-3
[ TSF]�(B 01.004 ut_osloader_module_test.c:110 - #4 No-free-IDs - Module Load failed
[ TSF]�(B 01.005 ut_osloader_module_test.c:136 - #5 Duplicate-name - Module Load failed
[ INFO] 01.006 ut_osloader_module_test.c:153 - #6 OS-call-failure
[ FAIL]�(B 01.007 ut_osloader_module_test.c:162 - #7 Nominal
[ END] 01 OS_ModuleLoad TOTAL::7 PASS::3 FAIL::1 MIR::0 TSF::2 N/A::0
The test expects the MODULE*.so/dylib files to be there in the build directory and they are not found:
$ find . | grep MODULE1.*dyThe underlying problem is that the modules are not built automatically when the osal_loader_UT target is built:
set(MOD 32)
while(MOD GREATER 0)
math(EXPR MOD "${MOD} - 1")
add_library(MODULE${MOD} SHARED ut_module.c)
set_target_properties(MODULE${MOD} PROPERTIES
COMPILE_DEFINITIONS "MODULE_NAME=module${MOD}"
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY eeprom1)
endwhile(MOD GREATER 0)Describe the solution you'd like
I will open a PR where adding the following fixes the problem:
add_dependencies(osal_loader_UT MODULE${MOD})
Adding explicit build dependency makes sure that the module files are built.
Having this added I see this:
$ find . | grep MODULE1.*dy
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE15.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE17.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE13.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE1.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE11.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE16.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE14.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE10.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE12.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE18.dylib
./cmake-build-debug/unit-tests/osloader-test/eeprom1/MODULE19.dylibDescribe alternatives you've considered
I see no alternatives given the current design of the test and its build rules.
Additional context
I am using the POSIX port on macOS with my addtions from #352 configured as follows:
-DENABLE_UNIT_TESTS=1 -DOSAL_SYSTEM_OSTYPE=posix -DOSAL_SYSTEM_BSPTYPE=pc-linux -DOSAL_INCLUDEDIR=src/bsp/pc-linux/config
Requester Info
Stanislav Pankevich, PTS GmbH