From 453baa7cbb177ebb45a03f19cf1fdfb4c24bcb52 Mon Sep 17 00:00:00 2001 From: Klemens David Morgenstern Date: Tue, 22 Jan 2019 22:23:58 +0800 Subject: [PATCH 1/4] added env for more flexible testing --- .travis.yml | 10 ++++++++++ test/CMakeLists.txt | 21 ++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f87f3aa..0359fc6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,16 @@ addons: - libboost-test-dev - cmake +env: + - BOOST_LOG_LEVEL=all BOOST_REPORT_LEVEL=detailed + - BOOST_LOG_LEVEL=all BOOST_REPORT_LEVEL=no + - BOOST_LOG_LEVEL=test_suite BOOST_REPORT_LEVEL=confirm + - BOOST_LOG_LEVEL=message BOOST_REPORT_LEVEL=short + - BOOST_LOG_LEVEL=warning BOOST_REPORT_LEVEL=detailed + - BOOST_LOG_LEVEL=error BOOST_REPORT_LEVEL=detailed + - BOOST_LOG_LEVEL=nothing BOOST_REPORT_LEVEL=detailed + - BOOST_LOG_LEVEL=nothing BOOST_REPORT_LEVEL=no + script: - mkdir build && cd build - cmake .. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b6d8e21..dce0689 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,13 +1,28 @@ enable_testing() +if (NOT "$ENV{BOOST_LOG_LEVEL}" STREQUAL "") + set(BOOST_LOG_LEVEL "$ENV{BOOST_LOG_LEVEL}" CACHE INTERNAL "Copied from environment variable") +else() + set(LOG_LEVEL all) +endif() + +if (NOT "$ENV{BOOST_REPORT_LEVEL}" STREQUAL "") + set(REPORT_LEVEL "$ENV{BOOST_REPORT_LEVEL}" CACHE INTERNAL "Copied from environment variable") +else() + set(REPORT_LEVEL detailed) +endif() + +message("Using report level ${REPORT_LEVEL}") +message("Using log level ${LOG_LEVEL}") + add_executable(test_one_bin test_one.cpp) target_link_libraries(test_one_bin Boost::unit_test_framework Boost::prg_exec_monitor) -add_test(NAME test_one COMMAND $ --log_sink=test_one.xml --log_format=XML --log_level=all --report_sink=report_one.xml --report_format=XML --report_level=detailed) +add_test(NAME test_one COMMAND $ --log_sink=test_one.xml --log_format=XML --log_level=${LOG_LEVEL} --report_sink=report_one.xml --report_format=XML --report_level=${REPORT_LEVEL}) add_executable(test_two_bin test_two.cpp) target_link_libraries(test_two_bin Boost::unit_test_framework Boost::prg_exec_monitor) -add_test(NAME test_two COMMAND $ --log_sink=test_two.xml --log_format=XML --log_level=all --report_sink=report_two.xml --report_format=XML --report_level=detailed) +add_test(NAME test_two COMMAND $ --log_sink=test_two.xml --log_format=XML --log_level=${LOG_LEVEL} --report_sink=report_two.xml --report_format=XML --report_level=${REPORT_LEVEL}) add_executable(test_sys_bin test_sys.cpp) target_link_libraries(test_sys_bin Boost::unit_test_framework Boost::prg_exec_monitor) -add_test(NAME test_sys COMMAND $ --log_sink=test_sys.xml --log_format=XML --log_level=all --report_sink=report_sys.xml --report_format=XML --report_level=detailed) \ No newline at end of file +add_test(NAME test_sys COMMAND $ --log_sink=test_sys.xml --log_format=XML --log_level=${LOG_LEVEL} --report_sink=report_sys.xml --report_format=XML --report_level=${REPORT_LEVEL}) From caf8d4efd59e546cec191a85f8cc401dce2de341 Mon Sep 17 00:00:00 2001 From: Klemens David Morgenstern Date: Tue, 22 Jan 2019 22:26:29 +0800 Subject: [PATCH 2/4] typo fix --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dce0689..665d8f7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ enable_testing() if (NOT "$ENV{BOOST_LOG_LEVEL}" STREQUAL "") - set(BOOST_LOG_LEVEL "$ENV{BOOST_LOG_LEVEL}" CACHE INTERNAL "Copied from environment variable") + set(LOG_LEVEL "$ENV{BOOST_LOG_LEVEL}" CACHE INTERNAL "Copied from environment variable") else() set(LOG_LEVEL all) endif() From 5be6c4e7a0fa59b2b261f9a314bcecf051050d28 Mon Sep 17 00:00:00 2001 From: Klemens David Morgenstern Date: Tue, 22 Jan 2019 22:32:28 +0800 Subject: [PATCH 3/4] added naming to travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0359fc6..e5d9873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ script: - ctest . -C Debug -V after_script: - - python <(curl -s https://raw.githubusercontent.com/report-ci/scripts/master/upload.py) \ No newline at end of file + - python - --name "Boost.Test [travis-ci, log=$BOOST_LOG_LEVEL, report=$BOOST_REPORT_LEVEL]" <(curl -s https://raw.githubusercontent.com/report-ci/scripts/master/upload.py) \ No newline at end of file From 4bb8d5999a0ac24e0d91b9450649774855133249 Mon Sep 17 00:00:00 2001 From: Klemens David Morgenstern Date: Wed, 23 Jan 2019 00:48:21 +0800 Subject: [PATCH 4/4] curl | python syntax --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e5d9873..cc61256 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ script: - ctest . -C Debug -V after_script: - - python - --name "Boost.Test [travis-ci, log=$BOOST_LOG_LEVEL, report=$BOOST_REPORT_LEVEL]" <(curl -s https://raw.githubusercontent.com/report-ci/scripts/master/upload.py) \ No newline at end of file + - curl -s https://raw.githubusercontent.com/report-ci/scripts/master/upload.py | python - --name "Boost.Test [travis-ci, log=$BOOST_LOG_LEVEL, report=$BOOST_REPORT_LEVEL]" \ No newline at end of file