Boost.Test change between 1.56 and 1.64

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Boost.Test change between 1.56 and 1.64

Boost - Users mailing list
1.56

class BOOST_TEST_DECL test_tree_visitor {
public:
    // test tree visitor interface
    virtual void    visit( test_case const& )               {}
    virtual bool    test_suite_start( test_suite const& )   { return true; }
    virtual void    test_suite_finish( test_suite const& )  {}

protected:
    BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {}
};


1.64

class BOOST_TEST_DECL test_tree_visitor {
public:
    // test tree visitor interface
    virtual bool    visit( test_unit const& )               { return true; }
    virtual void    visit( test_case const& tc )            { visit( (test_unit const&)tc ); }
    virtual bool    test_suite_start( test_suite const& ts ){ return visit( (test_unit const&)ts ); }
    virtual void    test_suite_finish( test_suite const& )  {}

protected:
    BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {}
};

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. Two out of 3 of the old methods are forwards to the new visit() method,
and obviously the implementation only calls the new visit(). The forwarding should be in the other direction for backward-compatibility.


Can someone please shed some light on this incompatible change? Thanks, --DD

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Boost.Test change between 1.56 and 1.64

Boost - Users mailing list
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 mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Boost.Test change between 1.56 and 1.64

Boost - Users mailing list
In reply to this post by Boost - Users mailing list
Le 25.07.17 à 19:09, Dominique Devienne via Boost-users a écrit :
> [snip]
>
> Looking for visit/visitor
> in http://www.boost.org/doc/libs/1_64_0/libs/test/doc/html/boost_test/change_log.html
> yield nothing.
>

Yes, because this is internal.

> Can someone please shed some light on this incompatible change? Thanks, --DD

Please use --list_content.

Raffi


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Loading...