Skip to content

Commit fca7323

Browse files
committed
CMake: QSPIFBlockDevice: Guard unit test directory
In the QSPIFBlockDevice component we checked if BUILD_TESTING was enabled before adding the QSPIFBlockDevice/UNITTESTS subdirectory. In the parent blockdevice/CMakeLists.txt we added the QSPIFBlockDevice subdirectory to the build under two separate conditions: * when "QSPIF" is present in MBED_TARGET_LABELS * when building only unit tests This wasn't quite enough, as when we build greentea tests for some targets QSPIF is enabled in MBED_TARGET_LABELS, causing the QSPIFBlockDevice subdirectory and its unit tests to be added when building greentea tests. This caused a test failure on targets which enable QSPIF: ``` The following tests FAILED: 40 - qspif-unittest_NOT_BUILT (Not Run) ``` To fix this we need to specifically check that we're not building greentea tests before adding the QSPIFBlockDevice/UNITTESTS directory to the project. Part of this issue is our reliance on MBED_TARGET_LABELS to pull features in to the build. We should refactor our usage of MBED_TARGET_LABELS and use CMake target dependencies where possible. Then we wouldn't need to add subdirectories under various, often conflicting, scenarios. Instead the targets would always be available and we would just choose which ones to actually build in different cases using CMake target linking.
1 parent 64a3419 commit fca7323

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ target_sources(mbed-storage-qspif
1313
)
1414

1515
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
16-
add_subdirectory(UNITTESTS)
16+
if (NOT BUILD_GREENTEA_TESTS)
17+
add_subdirectory(UNITTESTS)
18+
endif()
1719
endif()

0 commit comments

Comments
 (0)