Commit 3435503b by Tim Van Patten Committed by Commit Bot

Add test running flag: --delay-test-start

Add the following flag to the test runner to aid debugging: --delay-test-start=<number of seconds> This delays the start of each test by <number of seconds>. This is useful when using debuggers, like RenderDoc, that need some extra time to attach to the process before capturing data. Bug: angleproject:5312 Change-Id: Ie1aab155e780dfae7311e046af0a7702904cd9eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2522504Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
parent b441ffed
...@@ -316,6 +316,7 @@ constexpr char kUseConfig[] = "--use-config="; ...@@ -316,6 +316,7 @@ constexpr char kUseConfig[] = "--use-config=";
constexpr char kReuseDisplays[] = "--reuse-displays"; constexpr char kReuseDisplays[] = "--reuse-displays";
constexpr char kEnableANGLEPerTestCaptureLabel[] = "--angle-per-test-capture-label"; constexpr char kEnableANGLEPerTestCaptureLabel[] = "--angle-per-test-capture-label";
constexpr char kBatchId[] = "--batch-id="; constexpr char kBatchId[] = "--batch-id=";
constexpr char kDelayTestStart[] = "--delay-test-start=";
void SetupEnvironmentVarsForCaptureReplay() void SetupEnvironmentVarsForCaptureReplay()
{ {
...@@ -328,6 +329,18 @@ void SetupEnvironmentVarsForCaptureReplay() ...@@ -328,6 +329,18 @@ void SetupEnvironmentVarsForCaptureReplay()
} }
} // anonymous namespace } // anonymous namespace
int gTestStartDelaySeconds = 0;
int GetTestStartDelaySeconds()
{
return gTestStartDelaySeconds;
}
void SetTestStartDelay(const char *testStartDelay)
{
gTestStartDelaySeconds = std::stoi(testStartDelay);
}
// static // static
std::array<Vector3, 6> ANGLETestBase::GetQuadVertices() std::array<Vector3, 6> ANGLETestBase::GetQuadVertices()
{ {
...@@ -488,6 +501,12 @@ void ANGLETestBase::ANGLETestSetUp() ...@@ -488,6 +501,12 @@ void ANGLETestBase::ANGLETestSetUp()
{ {
mSetUpCalled = true; mSetUpCalled = true;
// Delay test startup to allow a debugger to attach.
if (GetTestStartDelaySeconds())
{
angle::Sleep(GetTestStartDelaySeconds() * 1000);
}
gDefaultPlatformMethods.overrideWorkaroundsD3D = TestPlatform_overrideWorkaroundsD3D; gDefaultPlatformMethods.overrideWorkaroundsD3D = TestPlatform_overrideWorkaroundsD3D;
gDefaultPlatformMethods.overrideFeaturesVk = TestPlatform_overrideFeaturesVk; gDefaultPlatformMethods.overrideFeaturesVk = TestPlatform_overrideFeaturesVk;
gDefaultPlatformMethods.logError = TestPlatform_logError; gDefaultPlatformMethods.logError = TestPlatform_logError;
...@@ -1396,5 +1415,9 @@ void ANGLEProcessTestArgs(int *argc, char *argv[]) ...@@ -1396,5 +1415,9 @@ void ANGLEProcessTestArgs(int *argc, char *argv[])
{ {
gEnableANGLEPerTestCaptureLabel = true; gEnableANGLEPerTestCaptureLabel = true;
} }
else if (strncmp(argv[argIndex], kDelayTestStart, strlen(kDelayTestStart)) == 0)
{
SetTestStartDelay(argv[argIndex] + strlen(kDelayTestStart));
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment