diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index d77eb135..f0444512 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -429,7 +429,7 @@ macro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix) # BCLIBS is empty if BUILD_BC_LIBS is not selected add_custom_target(runtime${target_suffix} DEPENDS ${LIBS} ${BCLIBS}) -endmacro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix) +endmacro() # Builds both a debug and a release copy of druntime/Phobos. macro(build_runtime_variants d_flags c_flags ld_flags path_suffix) @@ -491,7 +491,7 @@ function(add_tests module_files) string(REPLACE "/" "_" testroot ${stripped}) function(testcase name flags) - # -singleobj to avoid output file clashes when test are run in parallel. + # -singleobj to avoid output file clashes when tests are run in parallel. add_test(NAME ${testroot}_${name}_build COMMAND ${LDC_LOC} -of${PROJECT_BINARY_DIR}/${testroot}_${name} @@ -504,6 +504,10 @@ function(add_tests module_files) testcase(debug -g -debug) testcase(release -O -release) + if(MULTILIB) + testcase(debug_32 -g -debug -m32) + testcase(release_32 -O -release -m32) + endif() endforeach() endfunction() diff --git a/tests/d2/CMakeLists.txt b/tests/d2/CMakeLists.txt index e72298a2..c211c057 100644 --- a/tests/d2/CMakeLists.txt +++ b/tests/d2/CMakeLists.txt @@ -1,30 +1,33 @@ include(CheckTypeSize) check_type_size(void* ptr_size) if(${ptr_size} MATCHES "^4$") - set(model 32) + set(models 32) elseif(${ptr_size} MATCHES "^8$") - set(model 64) + set(models 64) endif() -set(DMD_TEST_MODEL "${model}" CACHE STRING - "The model argument to use for compiling the D2 testsuite. Defaults to system bitness.") +if(MULTILIB AND models EQUAL 64) + list(APPEND models 32) +endif() get_property(ldmd_path TARGET ldmd2 PROPERTY LOCATION) -# Build test suite in both debug and release modes. The DFLAGS environment -# variable read by LDMD is used because the DMD testsuite build system -# provides no way to run the test cases with a given set of flags without -# trying all combinations of them. +foreach(model ${models}) + # Build test suite in both debug and release modes. The DFLAGS environment + # variable read by LDMD is used because the DMD testsuite build system + # provides no way to run the test cases with a given set of flags without + # trying all combinations of them. -add_test(NAME dmd-testsuite-debug - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite - COMMAND make RESULTS_DIR=${CMAKE_BINARY_DIR}/dmd-testsuite-debug DMD=${ldmd_path} DFLAGS=-gc MODEL=${DMD_TEST_MODEL} quick -) + add_test(NAME dmd-testsuite_debug_${model} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite + COMMAND make RESULTS_DIR=${CMAKE_BINARY_DIR}/dmd-testsuite_debug_${model} DMD=${ldmd_path} DFLAGS=-gc MODEL=${model} quick + ) -# Would like to specify the "-release" flag here, but some of the tests (e.g. -# 'testdstress') depend on contracts and invariants being active. Need a solution -# integrated with d_do_test. -add_test(NAME dmd-testsuite-release - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite - COMMAND make RESULTS_DIR=${CMAKE_BINARY_DIR}/dmd-testsuite-release DMD=${ldmd_path} DFLAGS=-O3 MODEL=${DMD_TEST_MODEL} quick -) + # Would like to specify the "-release" flag here, but some of the tests (e.g. + # 'testdstress') depend on contracts and invariants being active. Need a solution + # integrated with d_do_test. + add_test(NAME dmd-testsuite_release_${model} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite + COMMAND make RESULTS_DIR=${CMAKE_BINARY_DIR}/dmd-testsuite_release_${model} DMD=${ldmd_path} DFLAGS=-O3 MODEL=${model} quick + ) +endforeach()