Draft: tests: Add Boost.Test example
In this MR I have ported old_tests::attr_manip
to Boost.Test. old_tests:attr_misc
was chosen as it is short (only ~100 lines long). The original test was not asserting anything, but for the Boost.Test version I have added some assertions.
I am imagining when we have several suites running under Boost.Test we will compile them into the same binary and use the --run_test
flag to select which suite. For now I have everything in one file (boost_tests.cpp), that is, this file contains both common infrastructure code and the attr_manip
test. I am leaving it to the next person to workout if/how we split this up into different files.
The test accepts a "custom command line argument" to specify the device server to connect to, similar to the existing attr_misc test.
I found that when a Tango::DevFailed exception leaked from the test Boost.Test would not be very helpful partly because Tango::DevFailed
does not inherit from std::exception
. By default we get something like:
unknown location(0): fatal error: in "attr_manip/read": unknown type
I have added a wrapper macro around BOOST_(AUTO|FIXTURE)_TEST_CASE
called TANGO_(AUTO|FIXTURE)_TEST_CASE
which improves things by logging the output of Tango::Except::print_exception
when we have an uncaught Tango::DevFailed
. There is another macro BOOST_DATA_TEST_CASE
that lets you run the same test with different input data. This might be useful but I have not wrapped this yet to print out uncaught Tango::DevFailed
. It should be possible to wrap, but the macro is a bit more hairy as the test function takes arguments and I didn't bother working it out at this point.
TODO
-
Fix the CI (I hope I just need to add boost to the docker images) -
Fix Linux -
Fix Windows
-
-
Print DevFailed that occur during fixture construction -
Tag docker images: -
debian12:v6 -
debian12-cross-32bit:v5 -
debian11:v5 -
ubuntu-20.04:v5 -
ubuntu-20.04-jpeg9:v5 -
llvm-latest:v8 -
gcc-latest:v5 -
fedora37:v5 -
alpine-3.15:v5 -
debian-minimum-versions:v5 -
debian-maximum-cmake:v4
-
-
Update CI with released docker images
Working towards #870 (closed).