This topic explains how to provide an external list of symbols (defined in user or system libraries) that C/C++test can use while building the test object/test executable—if C/C++test’s Library Symbols Identification (LSI) is unable to obtain them automatically. This is the most feasible solution for some embedded unit testing scenarios (like building a DKM Test Object for Wind River's VxWorks). It is also a good workaround if you experience automatic library identification or symbol extraction problems during the LSI phase.
...
Since there is no single method suited to all contexts, you will need to determine the best method for your situation. To help you with this external symbols list generation process, C++test provides the LSISymLstGen
Java application (both the source and compiled binary), which generates a symbols list for LSI from the nm
-like util output. This output must be either in the BSD format (default for 'nm
') or common POSIX (portability) format (-P
switch to 'nm
' and 'LSISymLstGen
'). The application is in the C++test_install_dir<CPPTEST_INSTALL_DIR>/bin/engine/utils
directory.
To create a symbols list, use the following sample commands as a guide:
nm_tool -g -p --defined-only --no-demangle object_file > nm_out
java -cp "C++test_install_dir<CPPTEST_INSTALL_DIR>/bin/engine/utils" LSISymLstGen nm_out XML_sym_lst
Additionally, C/C++test provides the "Extract library symbols" test flow recipe (which runs the above commands) together with the "Utilities> Extract Library Symbols" Test Configuration. The recipe must be edited before you use it. In most cases, it’s sufficient to set the "Path to external library/object to scan for symbols" Test Flow property to the path to your object/library/image. However, you may also want to adjust the "Symbols listing tool name" (may be required, as it is for Wind River's solutions), as well as the "Symbols listing options".
By default, the configuration will attempt to create the symbols list in C/C++test's cache for your project. This way, every time you clear the project's cache, you'll have to re-create the list. It may be more convenient to adjust the "Path to generated file with symbols" to provide same list for several projects at once— or just not to clear it on cache removal.
...
Customizing a Test Flow Recipe to Load an External Symbols List
To configure C/C++test to use the symbols list as it builds the test object/executable, you need to modify the appropriate recipes (those called from the Test Configurations you use). The only modification required is to add a libSymFile attribute to the LsiStep tag. For example: <LsiStep
libSymFile="XML_sym_lst" />
...