Add IsAutomaticTest() function to the unit tests.

This allows to easily test if we're running on a buildbot slave and disable
some difficult to debug test failures there.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-06-01 16:21:06 +00:00
parent e84d989930
commit f1287154cd
4 changed files with 25 additions and 2 deletions

View File

@@ -412,6 +412,23 @@ extern bool IsNetworkAvailable()
return online;
}
extern bool IsAutomaticTest()
{
static int s_isAutomatic = -1;
if ( s_isAutomatic == -1 )
{
// Allow setting an environment variable to emulate buildslave user for
// testing.
wxString username;
if ( !wxGetEnv("WX_TEST_USER", &username) )
username = wxGetUserId();
s_isAutomatic = username.Lower().Matches("buildslave*");
}
return s_isAutomatic == 1;
}
// helper of OnRun(): gets the test with the given name, returning NULL (and
// not an empty test suite) if there is no such test
static Test *GetTestByName(const wxString& name)