Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Build druntime/Phobos unit tests on make test.

  • Loading branch information...
commit 23e6720605c9572eb59fbe4175f28c639ce36335 1 parent 247da8e
@klickverbot klickverbot authored
Showing with 45 additions and 11 deletions.
  1. +9 −11 CMakeLists.txt
  2. +34 −0 runtime/CMakeLists.txt
  3. +2 −0  runtime/emptymain.d
View
20 CMakeLists.txt
@@ -320,10 +320,17 @@ set_target_properties(${LDMD_EXE} PROPERTIES
target_link_libraries(${LDMD_EXE} "${LLVM_LDFLAGS}" ${LLVM_LIBRARIES} "${LLVM_LDFLAGS}")
#
-# Install target.
+# Test and runtime targets. Note that enable_testing() is order-sensitive!
#
-
+enable_testing()
add_subdirectory(runtime)
+if(D_VERSION EQUAL 2)
+ add_subdirectory(tests/d2)
+endif()
+
+#
+# Install target.
+#
install(TARGETS ${LDC_EXE} ${LDMD_EXE} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
if(${BUILD_SHARED})
@@ -338,12 +345,3 @@ install(FILES ${PROJECT_BINARY_DIR}/bin/${LDC_EXE}_install.rebuild.conf DESTINAT
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(DIRECTORY bash_completion.d DESTINATION ${CONF_INST_DIR})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-
-
-#
-# Test targets.
-#
-enable_testing()
-if(D_VERSION EQUAL 2)
- add_subdirectory(tests/d2)
-endif()
View
34 runtime/CMakeLists.txt
@@ -398,3 +398,37 @@ if(PHOBOS2_DIR)
endif(PHOBOS2_DIR)
install(FILES ${RUNTIME_DIR}/src/object.di DESTINATION ${INCLUDE_INSTALL_DIR}/ldc)
install(DIRECTORY ${RUNTIME_DIR}/import/ldc DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.di")
+
+
+#
+# Test targets.
+#
+function(add_tests module_files)
+ foreach(file ${module_files})
+ string(REPLACE ${PROJECT_SOURCE_DIR}/ "" stripped ${file})
+ string(REPLACE ".d" "" stripped ${stripped})
+ string(REPLACE "/" "_" testroot ${stripped})
+
+ function(testcase name flags)
+ # -singleobj to avoid output file clashes when test are run in parallel.
+ add_test(NAME ${testroot}_${name}_build
+ COMMAND ${LDC_LOC}
+ -of${PROJECT_BINARY_DIR}/${testroot}_${name}
+ -unittest -d -w -singleobj ${flags}
+ ${file} ${PROJECT_SOURCE_DIR}/emptymain.d
+ )
+ add_test(NAME ${testroot}_${name}_run COMMAND ${PROJECT_BINARY_DIR}/${testroot}_${name})
+ set_tests_properties(${testroot}_${name}_run PROPERTIES DEPENDS ${testroot}_${name}_build)
+ endfunction()
+
+ testcase(debug -g -debug)
+ testcase(release -O -release)
+ endforeach()
+endfunction()
+
+add_tests("${CORE_D}")
+add_tests("${DCRT_D}")
+add_tests("${GC_D}")
+if(PHOBOS2_DIR)
+ add_tests("${PHOBOS2_D}")
+endif()
View
2  runtime/emptymain.d
@@ -0,0 +1,2 @@
+// Stub used for building runtime unit tests.
+void main() {}

0 comments on commit 23e6720

Please sign in to comment.
Something went wrong with that request. Please try again.