Commit a8631f68 by Jamie Madill Committed by Commit Bot

Fix running trace tests in non-standard directories.

The change to make the trace tests load the data files using a relative path only worked when running the tests from the "standard" out path. By setting the CWD to the executable dir in test setup we are able to run the tests from any local dir when testing. Also cleans up some repeated code in the test init switch statement. Bug: angleproject:3630 Change-Id: I8e9e5e6e1e9cd31c5b3c7b2f52420d0ba75cf76b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2104548Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent d1d96d73
...@@ -154,70 +154,50 @@ TracePerfTest::TracePerfTest() ...@@ -154,70 +154,50 @@ TracePerfTest::TracePerfTest()
: ANGLERenderTest("TracePerf", GetParam()), mStartFrame(0), mEndFrame(0) : ANGLERenderTest("TracePerf", GetParam()), mStartFrame(0), mEndFrame(0)
{} {}
#define TRACE_TEST_CASE(NAME) \
mStartFrame = NAME::kReplayFrameStart; \
mEndFrame = NAME::kReplayFrameEnd; \
mReplayFunc = NAME::ReplayContext1Frame; \
NAME::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_##NAME); \
NAME::SetupContext1Replay()
void TracePerfTest::initializeBenchmark() void TracePerfTest::initializeBenchmark()
{ {
const auto &params = GetParam(); const auto &params = GetParam();
// TODO: Note the start and end frames in the trace // To load the trace data path correctly we set the CWD to the executable dir.
// i.e. mStartFrame = trex_200_210::kReplayFrameStart if (!IsAndroid())
{
std::string exeDir = angle::GetExecutableDirectory();
angle::SetCWD(exeDir.c_str());
}
switch (params.testID) switch (params.testID)
{ {
// For each case, bootstrap the trace // For each case, bootstrap the trace
case TracePerfTestID::Manhattan10: case TracePerfTestID::Manhattan10:
mStartFrame = 10; TRACE_TEST_CASE(manhattan_10_20);
mEndFrame = 20;
mReplayFunc = manhattan_10_20::ReplayContext1Frame;
manhattan_10_20::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_manhattan_10_20);
manhattan_10_20::SetupContext1Replay();
break; break;
case TracePerfTestID::Manhattan750: case TracePerfTestID::Manhattan750:
mStartFrame = 750; TRACE_TEST_CASE(manhattan_750_760);
mEndFrame = 760;
mReplayFunc = manhattan_750_760::ReplayContext1Frame;
manhattan_750_760::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_manhattan_750_760);
manhattan_750_760::SetupContext1Replay();
break; break;
case TracePerfTestID::Manhattan1100: case TracePerfTestID::Manhattan1100:
mStartFrame = 1100; TRACE_TEST_CASE(manhattan_1100_1110);
mEndFrame = 1110;
mReplayFunc = manhattan_1100_1110::ReplayContext1Frame;
manhattan_1100_1110::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_manhattan_1100_1110);
manhattan_1100_1110::SetupContext1Replay();
break; break;
case TracePerfTestID::Manhattan1440: case TracePerfTestID::Manhattan1440:
mStartFrame = 1440; TRACE_TEST_CASE(manhattan_1440_1450);
mEndFrame = 1450;
mReplayFunc = manhattan_1440_1450::ReplayContext1Frame;
manhattan_1440_1450::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_manhattan_1440_1450);
manhattan_1440_1450::SetupContext1Replay();
break; break;
case TracePerfTestID::TRex200: case TracePerfTestID::TRex200:
mStartFrame = 200; TRACE_TEST_CASE(trex_200_210);
mEndFrame = 210;
mReplayFunc = trex_200_210::ReplayContext1Frame;
trex_200_210::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_trex_200_210);
trex_200_210::SetupContext1Replay();
break; break;
case TracePerfTestID::TRex800: case TracePerfTestID::TRex800:
mStartFrame = 800; TRACE_TEST_CASE(trex_800_810);
mEndFrame = 810;
mReplayFunc = trex_800_810::ReplayContext1Frame;
trex_800_810::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_trex_800_810);
trex_800_810::SetupContext1Replay();
break; break;
case TracePerfTestID::TRex900: case TracePerfTestID::TRex900:
mStartFrame = 900; TRACE_TEST_CASE(trex_900_910);
mEndFrame = 910;
mReplayFunc = trex_900_910::ReplayContext1Frame;
trex_900_910::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_trex_900_910);
trex_900_910::SetupContext1Replay();
break; break;
case TracePerfTestID::TRex1300: case TracePerfTestID::TRex1300:
mStartFrame = 1300; TRACE_TEST_CASE(trex_1300_1310);
mEndFrame = 1310;
mReplayFunc = trex_1300_1310::ReplayContext1Frame;
trex_1300_1310::SetBinaryDataDir(ANGLE_TRACE_DATA_DIR_trex_1300_1310);
trex_1300_1310::SetupContext1Replay();
break; break;
default: default:
assert(0); assert(0);
...@@ -231,6 +211,8 @@ void TracePerfTest::initializeBenchmark() ...@@ -231,6 +211,8 @@ void TracePerfTest::initializeBenchmark()
mIgnoreErrors = true; mIgnoreErrors = true;
} }
#undef TRACE_TEST_CASE
void TracePerfTest::destroyBenchmark() {} void TracePerfTest::destroyBenchmark() {}
void TracePerfTest::sampleTime() void TracePerfTest::sampleTime()
......
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