Turn missing {trace_name}.json trace files into test failures.
Before this change, a missing or broken trace json file results in all
trace tests "disappear" from the list with only ERR in logs. After this
change, a missing or broken trace json will result in that specific test
FAIL status and error in logs.
Note that this also allows for inconsistency between
restricted_traces.json and trace json files on the device because we're
no longer requiring for trace json to be loaded unless the test is
actually being run.
Bug: angleproject:7410
Change-Id: I07532dc0bf85a0d2fcaf425ce8d4a589473a898d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3690734
Commit-Queue: Roman Lavrov <romanl@google.com>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/perf_tests/TracePerfTest.cpp b/src/tests/perf_tests/TracePerfTest.cpp
index af57196..32f2385 100644
--- a/src/tests/perf_tests/TracePerfTest.cpp
+++ b/src/tests/perf_tests/TracePerfTest.cpp
@@ -723,6 +723,12 @@
TracePerfTest::TracePerfTest(const TracePerfParams ¶ms)
: ANGLERenderTest("TracePerf", params, "ms"), mParams(params), mStartFrame(0), mEndFrame(0)
{
+ if (!params.traceInfo.initialized)
+ {
+ failTest("Failed to load trace json.");
+ return;
+ }
+
if (IsWindows() && IsIntel() && mParams.isVulkan() && traceNameIs("manhattan_10"))
{
skipTest(
@@ -2070,11 +2076,8 @@
std::string traceJsonPath = traceJsonStream.str();
TraceInfo traceInfo = {};
- if (!LoadTraceInfoFromJSON(trace, traceJsonPath, &traceInfo))
- {
- ERR() << "Unable to load traced data from JSON file: " << traceJsonPath;
- return;
- }
+ strncpy(traceInfo.name, trace.c_str(), kTraceInfoMaxNameLen);
+ traceInfo.initialized = LoadTraceInfoFromJSON(trace, traceJsonPath, &traceInfo);
traceInfos.push_back(traceInfo);
}
diff --git a/util/capture/frame_capture_test_utils.cpp b/util/capture/frame_capture_test_utils.cpp
index 399cc68..674be95 100644
--- a/util/capture/frame_capture_test_utils.cpp
+++ b/util/capture/frame_capture_test_utils.cpp
@@ -112,6 +112,7 @@
meta["IsBindGeneratesResourcesEnabled"].GetBool();
traceInfoOut->isWebGLCompatibilityEnabled = meta["IsWebGLCompatibilityEnabled"].GetBool();
traceInfoOut->isRobustResourceInitEnabled = meta["IsRobustResourceInitEnabled"].GetBool();
+ traceInfoOut->initialized = true;
return true;
}
diff --git a/util/capture/frame_capture_test_utils.h b/util/capture/frame_capture_test_utils.h
index 53f0dac..dffd92d 100644
--- a/util/capture/frame_capture_test_utils.h
+++ b/util/capture/frame_capture_test_utils.h
@@ -138,6 +138,7 @@
struct TraceInfo
{
char name[kTraceInfoMaxNameLen];
+ bool initialized = false;
uint32_t contextClientMajorVersion;
uint32_t contextClientMinorVersion;
uint32_t frameStart;