Project

General

Profile

Necessary Maintenance #13477

Boost unit test interface changed

Added by Gianluca Petrillo about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Other
Target version:
Start date:
08/08/2016
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
Experiment:
LArSoft
Duration:

Description

Boost unit test module has changed the way it parses the command line arguments of the test executable.
It started requiring a double-dash (--) to precede all the user arguments:

executable_test --boost --unit --options -- --user --options

Since we don't use Boost options, this translates into just inserting a -- as a first parameter of the TEST_ARGS directive in cet_test.

This change has been introduced in Boost 1.61 (or earlier?) and we have lived with it for a while: it appears that even without -- Boost does the right thing in all our tests, which still succeed. It only prints a worrying exception message, that went ignored because it lands in the test log that nobody looks at until a real failure happens.
So it's not urgent, but it needs to be fixed.


Related issues

Related to LArSoft - Bug #13453: tests using boost unit do not work with art 2.02.01Closed08/04/2016

Associated revisions

Revision 24a0fb7e (diff)
Added by Gianluca Petrillo about 4 years ago

Fix the way we pass arguments to Boost unit tests (issue #13477)

Also, one of the tests did not need USE_BOOST_UNIT.

Revision 24a0fb7e (diff)
Added by Gianluca Petrillo about 4 years ago

Fix the way we pass arguments to Boost unit tests (issue #13477)

Also, one of the tests did not need USE_BOOST_UNIT.

Revision 031f2a6e (diff)
Added by Gianluca Petrillo about 4 years ago

Fix the way we pass arguments to Boost unit tests (issue #13477)

Also, one of the tests did not need USE_BOOST_UNIT.

Revision 21ac60b3 (diff)
Added by Gianluca Petrillo about 4 years ago

Fix the way we pass arguments to Boost unit tests (issue #13477)

Also updated README.

Revision 2d523019 (diff)
Added by Gianluca Petrillo about 4 years ago

Fix the way we pass arguments to Boost unit tests (issue #13477)

History

#1 Updated by Gianluca Petrillo about 4 years ago

  • Related to Bug #13453: tests using boost unit do not work with art 2.02.01 added

#2 Updated by Gianluca Petrillo about 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Gianluca Petrillo
  • Target version set to v06_03_00

#3 Updated by Gianluca Petrillo about 4 years ago

This issue is relevant when Boost unit test framework is reading command line arguments.
There are a few scenarios:

  1. the test does not use Boost unit test framework at all: obviously, nothing is affected by Boost unit test framework in this case; cet_test should not mention Boost unit test at all
  2. the unit test has no explicit main() function: Boost unit test framework needs to provide main(): ask cet_test to do so and to load the relevant libraries, by adding USE_BOOST_UNIT
  3. the unit test has its own main(), but uses Boost unit test facilities (e.g. BOOST_CHECK_EQUAL()): not sure if this is really supported, but it works this way: do not set USE_BOOST_UNIT, but add Boost unit test library in the link list of the test executable (as ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
  4. the test links to another library that happens to use Boost unit test facilities, but the executable itself does not, and provides its own main() function (e.g. geometry_test in larcore/test/Geometry, using GeoemtryTestLib): it's the library's duty to link to Boost as it needs it, and the test executable should not bother with boost (like in the first scenario)
  5. the test runs under lar and does not provide its own main() function: here there is no link list since nothing is being compiled (if the test module uses Boost, then it should link to ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}, but that's in its simple_plugin/art_make macro, not in cet_test), and no USE_BOOST_UNIT either.

The double dash (--) is needed only when it is the Boost-provided main() function which parses the command line. As such, it is needed only in scenario (2) and, of course, only if TEST_ARGS is present at all (that is, if we are passing any argument).

It turns out, that happens in LArSoft only in three tests: two geometry tests and... one example.
I have pushed fixes to these three.

#4 Updated by Gianluca Petrillo about 4 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100
  • Experiment LArSoft added
  • Experiment deleted (-)

MicroBooNE and DUNE code look already fine.
I have fixed argoneutcode and lariatsoft, whose geometry tests were also affected (same author as LArSoft's, I guess...). Fix is pushed in develop branches.

All tests are currently successful with develop, and the test log does not show any warning like the one reported here.

#5 Updated by Gianluca Petrillo almost 4 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF