Skip to content

Add a new test subdirectory

Pascal J. Bourguignon edited this page Jun 7, 2018 · 1 revision

How to integrate a new test directory in the build

  1. create the new test subdirectory in the module $m (eg. m='channels/smartcard/client'):
mkdir $m/test
  1. create the test source;
  2. create a $m/test/CMakeLists.txt file (take one from another test subdirectory as example).
  3. edit the target_link_libraries to add the library of the module you want to test. (eg. if the module to test is smartcard-client, add that):
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} smartcard-client)
  1. edit the $m/CMakeLists.txt file in the parent directory, adding the test subdirectory to the buid:
if(BUILD_TESTING)
	add_subdirectory(test)
endif()
```

That's it: Compile and run the tests!
Clone this wiki locally