Boost logo

Boost Users :

Subject: [Boost-users] [boost.test] parsing runtime arguments
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2018-08-12 18:17:08


Hi,
how get an 'user' API for the boost.test like this:

testsuite_xyz -- --help

or even

testsuite_xyz -- --save-path=/foo

to get the user aspects. I know I can get the args by

 Â Â Â  int argc{ framework::master_test_suite().argc };
 Â Â Â  char** argv{ framework::master_test_suite().argv };

Further, at test/include/boost/test/utils/runtime/cla/parser.hpp are
some utils used by boost.test self. Anyway, the problem rises to get the
behaviour desribed above, simply using a global fixture with:

fixture::fixture()
{
 Â Â Â  int argc{ utf::framework::master_test_suite().argc };
 Â Â Â  char** argv{ utf::framework::master_test_suite().argv };

 Â Â Â     for (int i = 0; i != argc; ++i) {
 Â Â Â         std::cerr << "test_observer_fixture: " << argv[i] << "\n";
 Â Â Â     }
}

doesn't give the expected results - all the BOOST_AUTO_TEST_SUITE test
cases are called even they depend on this arguments.

Thanks,
Olaf


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net