Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Test change between 1.56 and 1.64
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2017-07-26 08:26:44


>
> To list test suites and test cases of our test exes, I implemented a
> custom visitor in Boost 1.56 and simply did
>
> const auto& master_ts = but::framework::master_test_suite();
> but::traverse_test_tree(master_ts, visitor);
>
> This is broken in 1.64, none of the old methods from the visitor are
> called, and thus no suites or cases are discovered.
>

Turns out that the new visit() method is not the one called after all, but
still the old ones.
traverse_test_tree() have a new bool arg, which is false by default, and
combine with the
fact that the master-test-suite has RS_INVALID(3) in its p_run_status field
instead of
RS_ENABLED(1), is_enabled() returned false, and thus traverse_test_tree()
returned early.

void
traverse_test_tree( test_suite const& suite, test_tree_visitor& V, bool
ignore_status )
{
    // skip disabled test suite unless we asked to ignore this condition
    if( !ignore_status && !suite.is_enabled() )
        return;
...
}

class BOOST_TEST_DECL test_unit { ...
    bool is_enabled() const { return p_run_status == RS_ENABLED; }
};

So my fix simply needs to be as below. At least this one was easy, unlike
the Boost.PO one... --DD

PS: Then there's also the new --list_content which makes my old code kinda
obsolete...

#if (BOOST_VERSION >= 106000)
        but::traverse_test_tree(master_ts, visitor, true);
#else
        but::traverse_test_tree(master_ts, visitor);
#endif



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