X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=docs%2F4_APIs_and_Services%2F4.4_AGL_Test_Framework%2F2_The_test_widget%2FThe_test_widget.md;fp=docs%2F4_APIs_and_Services%2F4.4_AGL_Test_Framework%2F2_The_test_widget%2FThe_test_widget.md;h=2933f740e96af06f44025b43e55e127b9353312f;hb=4aad369c9728061c97b3de792286e743ee884b09;hp=0000000000000000000000000000000000000000;hpb=619a7e48085be1538c3b01eb93dcb9dc95bf0436;p=AGL%2Fdocumentation.git diff --git a/docs/4_APIs_and_Services/4.4_AGL_Test_Framework/2_The_test_widget/The_test_widget.md b/docs/4_APIs_and_Services/4.4_AGL_Test_Framework/2_The_test_widget/The_test_widget.md new file mode 100644 index 0000000..2933f74 --- /dev/null +++ b/docs/4_APIs_and_Services/4.4_AGL_Test_Framework/2_The_test_widget/The_test_widget.md @@ -0,0 +1,74 @@ +--- +edit_link: '' +title: The test widget +origin_url: >- + https://git.automotivelinux.org/apps/app-afb-test/plain/docs/2_The_test_widget.md?h=master +--- + + + +# How to build the test widget using app-templates/cmake-apps-module + +## Defining CMake targets + +Now that the test tree has been created, in each directory you have to create +a `CMakeLists.txt` file to hold the CMake's target definition. For each target +you need to specify a **LABELS** depending on the purpose of the files for each +directory. There are more explanations about using the *cmake-apps-module* (the +former *app-templates* submodule) in the [documentation website](../../../devguides/reference/cmakeafbtemplates/dev_guide/advanced-usage.html). + +Here is a cheat sheet to map the **LABELS** target for each classic test tree +directory: + +* `etc` uses the label **TEST-CONFIG** +* `fixtures` uses the label **TEST-DATA** +* `tests` uses the label **TEST-DATA** + +i.e for the `etc` folder: + +```cmake +PROJECT_TARGET_ADD(afb-test-config) + + file(GLOB CONF_FILES "*.json") + + add_input_files("${CONF_FILES}") + + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS "TEST-CONFIG" + OUTPUT_NAME ${TARGET_NAME} + ) +``` + +> **CAUTION**: make sure that you have CMakeLists files that include your +> subdirectories target (cf: previous chapter `Write the tests`). + +## Build the test widget + +By default, the test widget is not built, you have to specify that you want to +build it or use a special target. + +### Building at the same time than classic widget + +Specify the option `BUILD_TEST_WGT=TRUE` when you configure your build. + +ie: + +```bash +cd build +cmake -DBUILD_TEST_WGT=TRUE .. +make +make widget +``` + +### Building separately only the test widget + +Just use the target `test_widget` after a classic build. + +ie: + +```bash +cd build +cmake .. +make +make test_widget +```