Commit 903647ab authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge branch 'simplify-status-code-fail-test' into 'master'

Simplify StatusCode compilation failure test

See merge request gaudi/Gaudi!1206
parents a4ae2988 8522946f
......@@ -73,6 +73,7 @@ before_script:
- cp Testing/$(head -1 Testing/TAG)/Test.xml ..
- cd ..
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
artifacts:
paths:
......@@ -173,6 +174,7 @@ view-gcc8:test:
- cp Testing/$(head -1 Testing/TAG)/Test.xml ..
- cd ..
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
lhcb-gcc9:test:
......@@ -190,6 +192,7 @@ lhcb-gcc9:test:
- cp build.${BINARY_TAG}/Testing/$(head -1 build.${BINARY_TAG}/Testing/TAG)/Test.xml .
- mv build.${BINARY_TAG}/html .
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
artifacts:
paths:
......
......@@ -253,12 +253,16 @@ gaudi_add_executable(test_MonotonicArena SOURCES tests/src/test_MonotonicArena.c
gaudi_add_executable(test_GaudiTimer SOURCES tests/src/test_GaudiTimer.cpp
LINK GaudiKernel Boost::unit_test_framework TEST)
add_executable(test_StatusCodeFail tests/src/test_StatusCode_fail.cxx)
target_link_libraries(test_StatusCodeFail PRIVATE GaudiKernel)
set_target_properties(test_StatusCodeFail PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
add_test(NAME ${package_name}.test_StatusCodeFail
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target test_StatusCodeFail)
set_property(TEST ${package_name}.test_StatusCodeFail PROPERTY PASS_REGULAR_EXPRESSION "FAIL01;FAIL02;FAIL03;FAIL04")
foreach(test_case IN ITEMS 01 02 03 04)
add_executable(test_StatusCodeFail_case${test_case} tests/src/test_StatusCode_fail.cxx)
target_link_libraries(test_StatusCodeFail_case${test_case} PRIVATE GaudiKernel)
set_target_properties(test_StatusCodeFail_case${test_case} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
target_compile_definitions(test_StatusCodeFail_case${test_case} PRIVATE CASE${test_case})
add_test(NAME ${package_name}.test_StatusCodeFail.case${test_case}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}
--target ${package_name}/CMakeFiles/test_StatusCodeFail_case${test_case}.dir/tests/src/test_StatusCode_fail.cxx.o)
set_property(TEST ${package_name}.test_StatusCodeFail.case${test_case} PROPERTY PASS_REGULAR_EXPRESSION "FAIL${test_case}")
endforeach()
if(GAUDI_USE_CPPUNIT)
gaudi_add_executable(test_SerializeSTL SOURCES tests/src/test_SerializeSTL.cpp
......
......@@ -11,16 +11,30 @@
#include "GaudiKernel/StatusCode.h"
int main() {
#ifdef CASE01
{
StatusCode sc{};
sc = 42; // FAIL01: no implicit conversion from int
int i = sc; // FAIL02: no implicit conversion to int
bool b = sc; // FAIL03: no implicit conversion to bool
(void)i;
(void)b; // silence "unused" compiler warnings
sc = 42; // FAIL01: no implicit conversion from int
}
#endif
#ifdef CASE02
{
StatusCode sc{};
int i = sc; // FAIL02: no implicit conversion to int
(void)i; // silence "unused" compiler warnings
}
#endif
#ifdef CASE03
{
StatusCode sc{};
bool b = sc; // FAIL03: no implicit conversion to bool
(void)b; // silence "unused" compiler warnings
}
#endif
#ifdef CASE04
{
StatusCode sc1, sc2;
StatusCode sc = sc1 && sc2; // FAIL04: no conversion from bool
}
#endif
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment