From 2a6e4de72c19af8e00db38463019fa5622f8fb30 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Mon, 14 May 2018 18:01:08 +0200 Subject: [PATCH] provide FAIRMQ_PATH to test suites --- test/CMakeLists.txt | 11 +++++++++++ test/TestEnvironment.h.in | 14 ++++++++++++++ test/device/runner.cxx | 4 ++++ test/event_manager/runner.cxx | 3 +++ test/message_resize/runner.cxx | 3 +++ test/plugin_services/runner.cxx | 3 +++ test/plugins/runner.cxx | 3 +++ test/protocols/runner.cxx.in | 2 ++ test/state_machine/runner.cxx | 3 +++ 9 files changed, 46 insertions(+) create mode 100644 test/TestEnvironment.h.in diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5afc5824..63226d1d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,8 +33,10 @@ add_testhelper(runTestDevice set(MQ_CONFIG "${CMAKE_BINARY_DIR}/test/testsuite_FairMQ.IOPatterns_config.json") set(RUN_TEST_DEVICE "${CMAKE_BINARY_DIR}/test/testhelper_runTestDevice") +set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/config.json.in ${MQ_CONFIG}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/runner.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/protocols/runner.cxx) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TestEnvironment.h.in ${CMAKE_CURRENT_BINARY_DIR}/TestEnvironment.h) add_testsuite(FairMQ.Protocols SOURCES @@ -50,6 +52,7 @@ add_testsuite(FairMQ.Protocols LINKS FairMQ DEPENDS testhelper_runTestDevice INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/protocols + ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 30 RUN_SERIAL ON ) @@ -61,6 +64,7 @@ add_testsuite(FairMQ.Parts LINKS FairMQ INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/parts + ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 5 ) @@ -71,6 +75,7 @@ add_testsuite(FairMQ.MessageResize LINKS FairMQ INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/message_resize + ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 5 ) @@ -85,6 +90,7 @@ add_testsuite(FairMQ.Device LINKS FairMQ INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/device + ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 5 RUN_SERIAL ON ) @@ -128,6 +134,7 @@ add_testsuite(FairMQ.Plugins plugins/_plugin_manager.cxx LINKS FairMQ + INCLUDES ${CMAKE_CURRENT_BINARY_DIR} DEPENDS FairMQPlugin_test_dummy FairMQPlugin_test_dummy2 TIMEOUT 10 ) @@ -138,6 +145,7 @@ add_testsuite(FairMQ.PluginsPrelinked plugins/_plugin_manager_prelink.cxx LINKS FairMQ FairMQPlugin_test_dummy FairMQPlugin_test_dummy2 + INCLUDES ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 10 ) @@ -149,6 +157,7 @@ add_testsuite(FairMQ.PluginServices plugin_services/Fixture.h LINKS FairMQ + INCLUDES ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 10 ) @@ -158,6 +167,7 @@ add_testsuite(FairMQ.EventManager event_manager/_event_manager.cxx LINKS FairMQ + INCLUDES ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 10 ) @@ -167,5 +177,6 @@ add_testsuite(FairMQ.StateMachine state_machine/_state_machine.cxx LINKS FairMQ + INCLUDES ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 10 ) diff --git a/test/TestEnvironment.h.in b/test/TestEnvironment.h.in new file mode 100644 index 00000000..0d7d379d --- /dev/null +++ b/test/TestEnvironment.h.in @@ -0,0 +1,14 @@ +/******************************************************************************** + * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + +#ifndef FAIR_MQ_TEST_ENVIRONMENT_H +#define FAIR_MQ_TEST_ENVIRONMENT_H + +#define FAIRMQ_TEST_ENVIRONMENT "@FAIRMQ_BIN_DIR@" + +#endif /* FAIR_MQ_TEST_ENVIRONMENT_H */ diff --git a/test/device/runner.cxx b/test/device/runner.cxx index 5442845e..af0cb074 100644 --- a/test/device/runner.cxx +++ b/test/device/runner.cxx @@ -6,11 +6,15 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include + #include +#include auto main(int argc, char** argv) -> int { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); } diff --git a/test/event_manager/runner.cxx b/test/event_manager/runner.cxx index 5442845e..ebabfc9a 100644 --- a/test/event_manager/runner.cxx +++ b/test/event_manager/runner.cxx @@ -6,11 +6,14 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include + #include auto main(int argc, char** argv) -> int { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); } diff --git a/test/message_resize/runner.cxx b/test/message_resize/runner.cxx index 5442845e..ebabfc9a 100644 --- a/test/message_resize/runner.cxx +++ b/test/message_resize/runner.cxx @@ -6,11 +6,14 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include + #include auto main(int argc, char** argv) -> int { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); } diff --git a/test/plugin_services/runner.cxx b/test/plugin_services/runner.cxx index 2357bcc3..52f1be09 100644 --- a/test/plugin_services/runner.cxx +++ b/test/plugin_services/runner.cxx @@ -6,11 +6,14 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include + #include int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); } diff --git a/test/plugins/runner.cxx b/test/plugins/runner.cxx index 2357bcc3..52f1be09 100644 --- a/test/plugins/runner.cxx +++ b/test/plugins/runner.cxx @@ -6,11 +6,14 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include + #include int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); } diff --git a/test/protocols/runner.cxx.in b/test/protocols/runner.cxx.in index 1429c34f..d9b7b109 100644 --- a/test/protocols/runner.cxx.in +++ b/test/protocols/runner.cxx.in @@ -7,6 +7,7 @@ ********************************************************************************/ #include "runner.h" +#include #include @@ -33,5 +34,6 @@ auto main(int argc, char** argv) -> int { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); } diff --git a/test/state_machine/runner.cxx b/test/state_machine/runner.cxx index 5442845e..ebabfc9a 100644 --- a/test/state_machine/runner.cxx +++ b/test/state_machine/runner.cxx @@ -6,11 +6,14 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include + #include auto main(int argc, char** argv) -> int { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0); return RUN_ALL_TESTS(); }