Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running standalone, osal_loader_UT test binary file is missing test module files #430

Closed
stanislaw opened this issue Apr 21, 2020 · 1 comment · Fixed by #431 or #440
Closed
Milestone

Comments

@stanislaw
Copy link
Contributor

stanislaw commented Apr 21, 2020

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.*dy

The 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.dylib

Describe 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

@stanislaw stanislaw changed the title When running standalone osal_loader_UT test binary file it is missing test module files When running standalone, osal_loader_UT test binary file is missing test module files Apr 21, 2020
@astrogeco astrogeco linked a pull request May 1, 2020 that will close this issue
@astrogeco
Copy link
Contributor

Closed by #431

@skliper skliper added this to the v5.1.0 milestone Sep 24, 2021
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#415, nasa#429
Reviewed and approved at 2019-12-18 CCB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants