1# SPDX-License-Identifier: Apache-2.0 2 3# Add a few copies of the same image, so that we can configure 4# multiple instances of the same test suite with minor tweaks, 5# including different arguments given to them via testcase.yaml. 6foreach(suffix "2nd" "3rd") 7 set(image ${DEFAULT_IMAGE}_${suffix}) 8 if(NOT TARGET ${image}) 9 ExternalZephyrProject_Add( 10 APPLICATION ${image} 11 SOURCE_DIR ${APP_DIR} 12 ) 13 list(APPEND IMAGES ${image}) 14 endif() 15endforeach() 16 17function(test_report) 18 set(failures "") 19 foreach(image ${IMAGES}) 20 sysbuild_get(ASSERT_FAIL_COUNT IMAGE ${image} CACHE) 21 if(ASSERT_FAIL_COUNT GREATER 0) 22 set(failures "${failures}\n - ${image}: ${ASSERT_FAIL_COUNT} assertion(s) failed") 23 endif() 24 unset(ASSERT_FAIL_COUNT) 25 endforeach() 26 27 if(failures) 28 message(FATAL_ERROR "Test failures per sysbuild image: ${failures}") 29 endif() 30endfunction() 31 32if(NOT DEFERRED_TEST_REPORT) 33 # Defer until all test suite copies have been executed. 34 cmake_language(DEFER ID_VAR DEFERRED_TEST_REPORT CALL test_report) 35endif() 36