diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-06-17 14:10:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 14:10:27 +0200 |
commit | f0c8e7a48b1da2195a8135e880280b713400f8d6 (patch) | |
tree | 7d0b99a225d6b056cd7ecce0a635a86f7bc5fa4e | |
parent | d8712752d6f65b0b28309058c7d56a7b91ba99d2 (diff) | |
parent | 3ef3b6a8566e528748ca5c250aada0c0bffd0e4d (diff) |
Merge pull request #65 from yahoo/vegard/test-libs-as-test-targets
Vegard/test libs as test targets
-rw-r--r-- | functions.cmake | 26 | ||||
-rw-r--r-- | storage/src/tests/bucketdb/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/bucketmover/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/common/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/common/hostreporter/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/distributor/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/frameworkimpl/memory/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/frameworkimpl/status/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/persistence/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/persistence/filestorage/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/storageserver/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/storageutil/CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/src/tests/visiting/CMakeLists.txt | 3 |
13 files changed, 28 insertions, 34 deletions
diff --git a/functions.cmake b/functions.cmake index 46b8083b94c..8bd0e3a97d1 100644 --- a/functions.cmake +++ b/functions.cmake @@ -151,7 +151,7 @@ endfunction() function(vespa_add_library TARGET) cmake_parse_arguments(ARG - "STATIC;OBJECT;INTERFACE" + "STATIC;OBJECT;INTERFACE;TEST" "INSTALL;OUTPUT_NAME" "DEPENDS;AFTER;SOURCES" ${ARGN}) @@ -178,6 +178,8 @@ function(vespa_add_library TARGET) add_library(${TARGET} ${LINKAGE} ${LIBRARY_TYPE} ${SOURCE_FILES}) __add_dependencies_to_target() + __handle_test_targets() + if(ARG_INSTALL) install(TARGETS ${TARGET} DESTINATION ${ARG_INSTALL}) endif() @@ -201,15 +203,7 @@ function(vespa_add_executable TARGET) add_executable(${TARGET} ${ARG_SOURCES}) __add_dependencies_to_target() - # If this is a test executable, add it to the test target for this module - # If building of unit tests is not specified, exclude this target from the all target - if(ARG_TEST) - __add_test_target_to_module(${TARGET}) - - if(EXCLUDE_TESTS_FROM_ALL) - set_target_properties(${TARGET} PROPERTIES EXCLUDE_FROM_ALL TRUE) - endif() - endif() + __handle_test_targets() if(ARG_INSTALL) install(TARGETS ${TARGET} DESTINATION ${ARG_INSTALL}) @@ -439,6 +433,18 @@ function(__add_test_target_to_module TARGET) set_property(GLOBAL APPEND PROPERTY MODULE_${MODULE_NAME}_TEST_TARGETS ${TARGET}) endfunction() +macro(__handle_test_targets) + # If this is a test executable, add it to the test target for this module + # If building of unit tests is not specified, exclude this target from the all target + if(ARG_TEST) + __add_test_target_to_module(${TARGET}) + + if(EXCLUDE_TESTS_FROM_ALL) + set_target_properties(${TARGET} PROPERTIES EXCLUDE_FROM_ALL TRUE) + endif() + endif() +endmacro() + function(__create_module_targets PROPERTY_POSTFIX TARGET_POSTFIX) get_property(VESPA_MODULES GLOBAL PROPERTY VESPA_MODULES) set(OUTPUT_ALL_TARGET "all_${TARGET_POSTFIX}s") diff --git a/storage/src/tests/bucketdb/CMakeLists.txt b/storage/src/tests/bucketdb/CMakeLists.txt index 95228966589..c24db3fed6d 100644 --- a/storage/src/tests/bucketdb/CMakeLists.txt +++ b/storage/src/tests/bucketdb/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testbucketdb +vespa_add_library(storage_testbucketdb TEST SOURCES initializertest.cpp bucketmanagertest.cpp @@ -8,7 +8,6 @@ vespa_add_library(storage_testbucketdb lockablemaptest.cpp bucketinfotest.cpp distribution_hash_normalizer_test.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/bucketmover/CMakeLists.txt b/storage/src/tests/bucketmover/CMakeLists.txt index 2d02cdc4942..e2929187f62 100644 --- a/storage/src/tests/bucketmover/CMakeLists.txt +++ b/storage/src/tests/bucketmover/CMakeLists.txt @@ -1,9 +1,8 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testbucketmover +vespa_add_library(storage_testbucketmover TEST SOURCES bucketmovertest.cpp htmltabletest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/common/CMakeLists.txt b/storage/src/tests/common/CMakeLists.txt index 309308473e1..dd1cdf87dcd 100644 --- a/storage/src/tests/common/CMakeLists.txt +++ b/storage/src/tests/common/CMakeLists.txt @@ -1,12 +1,11 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testcommon +vespa_add_library(storage_testcommon TEST SOURCES dummystoragelink.cpp testhelper.cpp metricstest.cpp storagelinktest.cpp teststorageapp.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/common/hostreporter/CMakeLists.txt b/storage/src/tests/common/hostreporter/CMakeLists.txt index f0cb197c5e2..9e3fabdcb29 100644 --- a/storage/src/tests/common/hostreporter/CMakeLists.txt +++ b/storage/src/tests/common/hostreporter/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testhostreporter +vespa_add_library(storage_testhostreporter TEST SOURCES cpureportertest.cpp memreportertest.cpp @@ -8,7 +8,6 @@ vespa_add_library(storage_testhostreporter diskreportertest.cpp util.cpp hostinfotest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/distributor/CMakeLists.txt b/storage/src/tests/distributor/CMakeLists.txt index 6c6ba62ba6e..29bb8cb67c1 100644 --- a/storage/src/tests/distributor/CMakeLists.txt +++ b/storage/src/tests/distributor/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testdistributor +vespa_add_library(storage_testdistributor TEST SOURCES mergelimitertest.cpp bucketdatabasetest.cpp @@ -38,7 +38,6 @@ vespa_add_library(storage_testdistributor bucketgctimecalculatortest.cpp nodemaintenancestatstrackertest.cpp distributor_host_info_reporter_test.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/frameworkimpl/memory/CMakeLists.txt b/storage/src/tests/frameworkimpl/memory/CMakeLists.txt index da78716459f..4d89a4aa548 100644 --- a/storage/src/tests/frameworkimpl/memory/CMakeLists.txt +++ b/storage/src/tests/frameworkimpl/memory/CMakeLists.txt @@ -1,8 +1,7 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testmemory +vespa_add_library(storage_testmemory TEST SOURCES memorystatusviewertest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/frameworkimpl/status/CMakeLists.txt b/storage/src/tests/frameworkimpl/status/CMakeLists.txt index 734be8e9998..95c4d3a532e 100644 --- a/storage/src/tests/frameworkimpl/status/CMakeLists.txt +++ b/storage/src/tests/frameworkimpl/status/CMakeLists.txt @@ -1,8 +1,7 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_teststatus +vespa_add_library(storage_teststatus TEST SOURCES statustest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/persistence/CMakeLists.txt b/storage/src/tests/persistence/CMakeLists.txt index c065c3eef5b..db0ac64c183 100644 --- a/storage/src/tests/persistence/CMakeLists.txt +++ b/storage/src/tests/persistence/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testpersistence +vespa_add_library(storage_testpersistence TEST SOURCES processalltest.cpp persistencetestutils.cpp @@ -13,7 +13,6 @@ vespa_add_library(storage_testpersistence bucketownershipnotifiertest.cpp persistencequeuetest.cpp testandsettest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/persistence/filestorage/CMakeLists.txt b/storage/src/tests/persistence/filestorage/CMakeLists.txt index b1314ca0537..072feb4a940 100644 --- a/storage/src/tests/persistence/filestorage/CMakeLists.txt +++ b/storage/src/tests/persistence/filestorage/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testfilestorage +vespa_add_library(storage_testfilestorage TEST SOURCES filestormanagertest.cpp operationabortingtest.cpp @@ -11,7 +11,6 @@ vespa_add_library(storage_testfilestorage filestormodifiedbucketstest.cpp deletebuckettest.cpp singlebucketjointest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/storageserver/CMakeLists.txt b/storage/src/tests/storageserver/CMakeLists.txt index 2e327089b4c..88e518f1ad1 100644 --- a/storage/src/tests/storageserver/CMakeLists.txt +++ b/storage/src/tests/storageserver/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_teststorageserver +vespa_add_library(storage_teststorageserver TEST SOURCES communicationmanagertest.cpp statemanagertest.cpp @@ -11,7 +11,6 @@ vespa_add_library(storage_teststorageserver priorityconvertertest.cpp statereportertest.cpp changedbucketownershiphandlertest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/storageutil/CMakeLists.txt b/storage/src/tests/storageutil/CMakeLists.txt index a48895352e8..e49361285d8 100644 --- a/storage/src/tests/storageutil/CMakeLists.txt +++ b/storage/src/tests/storageutil/CMakeLists.txt @@ -1,10 +1,9 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_teststorageutil +vespa_add_library(storage_teststorageutil TEST SOURCES functortest.cpp charttest.cpp palettetest.cpp - DEPENDS AFTER storage_storageconfig ) diff --git a/storage/src/tests/visiting/CMakeLists.txt b/storage/src/tests/visiting/CMakeLists.txt index fde0eb6ac3d..f1c10bde4f0 100644 --- a/storage/src/tests/visiting/CMakeLists.txt +++ b/storage/src/tests/visiting/CMakeLists.txt @@ -1,11 +1,10 @@ # Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storage_testvisiting +vespa_add_library(storage_testvisiting TEST SOURCES commandqueuetest.cpp visitormanagertest.cpp visitortest.cpp memory_bounded_trace_test.cpp - DEPENDS AFTER storage_storageconfig storage_visitor |