How can I skip a BOOST unit test? I would like to programatically skip some of my unit tests depending on, (for instance) the platform on which I am executing them. My current solution is:
#define REQUIRE_LINUX char * os_cpu = getenv("OS_CPU"); if ( os_cpu != "Linux-x86_64" ) return;
BOOST_AUTO_TEST_CASE(onlylinux) {
REQUIRE_LINUX
...
the rest of the test code.
}
(note that our build environment sets the variable OS_CPU). This seems ugly and error-prone, and also like the silent skips could cause users to be skipping tests without knowing about it.
How can I cleanly skip boost unit tests based on arbitrary logic?