Improve diagnostics of cmake macro errors: cet_test
I have a snippet of
cet_test(Track_test HANDBUILT DATAFILES test_trackproxy.fcl TEST_EXEC lar --rethrow-all -c ./test_trackproxy.fcl USE_BOOST_UNIT )
and I receive the error:
CMake Error at /products/cetbuildtools/v5_09_01/Modules/CetTest.cmake:311 (message): cet_test: DATAFILES option is now mandatory: non-option arguments are no longer permitted. Call Stack (most recent call first): lardata/test/RecoBaseProxy/CMakeLists.txt:6 (cet_test)
This kind of errors happened to me a number of types, where I mistype a keyword (in this case, I should have split the command line between
cet_testpushes upon me its interpretation of the error rather than detailing what triggered it.
The simplest solution is to hint which was the error token. In my case,
TEST_EXECis actually a valid keyword, so I believe the error token was
--rethrow-all. If the message had said:
CMake Error at /products/cetbuildtools/v5_09_01/Modules/CetTest.cmake:311 (message): cet_test: non-option argument found: '--rethrow-all'. Non-option arguments are no longer permitted. Also note that DATAFILES option is now mandatory. Call Stack (most recent call first): lardata/test/RecoBaseProxy/CMakeLists.txt:6 (cet_test)
instead of assuming that my mistake of today is from an ancient cet_test breaking change, I would at least been put on the right track.
A more sophisticate logic to detect that I tried to append more arguments to a keyword (
TEST_EXEC) than allowed would be ideal, but maybe not worth the effort.
#3 Updated by Christopher Green over 3 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Fixed in f9d83bd. Example error message:
CMake Error at /Users/greenc/work/cet-is/products/cetbuildtools/v5_13_01/Modules/CetTest.cmake:370 (message): cet_test: Unparsed (non-option) arguments detected: "ethel;lucy;ricky" Check for missing keyword(s) in the definition of test regex_standalone_t in your CMakeLists.txt. Call Stack (most recent call first): cetlib/cetlib/test/CMakeLists.txt:135 (cet_test)