ONNX will build googletest from a Git checkout. Patch CMake to use our googletest package and enable tests by default. diff --git a/CMakeLists.txt b/CMakeLists.txt index 0aa9fda2..a573170c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ option(BUILD_ONNX_PYTHON "Build Python binaries" OFF) option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON) option(ONNX_WERROR "Build with Werror" OFF) option(ONNX_COVERAGE "Build with coverage instrumentation" OFF) -option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF) +option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" ON) option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF) option(ONNXIFI_ENABLE_EXT "Enable onnxifi extensions." OFF) if(NOT DEFINED ONNX_ML) @@ -82,8 +82,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") endif() if(ONNX_BUILD_TESTS) - list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external) - include(googletest) + find_package(GTest REQUIRED) + if(NOT GTest_FOUND) + message(FATAL_ERROR "cannot find googletest") + endif() endif() if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf)) diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake index e29a93ff..ae146390 100644 --- a/cmake/unittest.cmake +++ b/cmake/unittest.cmake @@ -6,8 +6,8 @@ include(${ONNX_ROOT}/cmake/Utils.cmake) find_package(Threads) -set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES}) -set(${ONNXIFI_TEST_DRIVER}_libs ${googletest_STATIC_LIBRARIES}) +set(${UT_NAME}_libs ${GTEST_LIBRARIES}) +set(${ONNXIFI_TEST_DRIVER}_libs ${GTEST_LIBRARIES}) list(APPEND ${UT_NAME}_libs onnx) list(APPEND ${UT_NAME}_libs onnx_proto) @@ -31,10 +31,10 @@ function(AddTest) list(REMOVE_DUPLICATES _UT_SOURCES) add_executable(${_UT_TARGET} ${_UT_SOURCES}) - add_dependencies(${_UT_TARGET} onnx onnx_proto googletest) + add_dependencies(${_UT_TARGET} onnx onnx_proto) target_include_directories(${_UT_TARGET} - PUBLIC ${googletest_INCLUDE_DIRS} + PUBLIC ${GTEST_INCLUDE_DIRS} ${ONNX_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS} ${ONNX_ROOT}
AgeCommit message (Expand)Author
2016-04-03build: Add a Guile custom test driver using SRFI-64....Before that '.log' files for scheme tests were fragmented and not included in test-suite.log. This unifies the semantics of SRFI-64 API with Automake test suite. * build-aux/test-driver.scm: New file. * Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables. (SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables. (AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0. * test-env.in: Silence guix-daemon. * doc/guix.texi (Running the Test Suite): Describe how to display the detailed results. Bug reports require only 'test-suite.log' file. * tests/base32.scm, tests/build-utils.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm, tests/cve.scm, tests/derivations.scm, tests/elpa.scm, tests/file-systems.scm, tests/gem.scm, tests/gexp.scm, tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm, tests/gremlin.scm, tests/hackage.scm, tests/hash.scm, tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm, tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm, tests/profiles.scm, tests/publish.scm, tests/pypi.scm, tests/records.scm, tests/scripts-build.scm, tests/scripts.scm, tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm, tests/store.scm, tests/substitute.scm, tests/syscalls.scm, tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm, tests/utils.scm: Don't exit at the end of test groups. * tests/containers.scm: Likewise. Use 'test-skip' instead of exiting with error code 77. Mathieu Lirzin
2015-09-24tests: Unset 'LOCPATH' before running bootstrap program....Reported by Mark H Weaver <mhw@netris.org>. * tests/build-utils.scm ("wrap-program, one input, multiple calls"): Add 'unsetenv' call. Ludovic Courtès
2014-09-13utils: Allow wrap-program to be called multiple times....* guix/build/utils.scm (wrap-program): Multiple invocations of wrap-program for the same file create successive wrappers. Adjust docstring. * tests/build-utils.scm: Test new wrap-program behavior. (%store): New variable. Eric Bavier