Commit da17d561 by Jamie Madill Committed by Angle LUCI CQ

Trace Tests: Use xvfb consistently on Linux.

Previously there were two places where we missed the xvfb script. This was causing the replay to fail. Bug: angleproject:6085 Change-Id: I833916fa0cdacc163ec2bdd08831249807f319c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2979353Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent bd797f75
......@@ -287,6 +287,13 @@ void SerializeColorUI(JsonSerializer *json, const ColorUI &color)
json->addScalar("Alpha", color.alpha);
}
void SerializeExtents(JsonSerializer *json, const gl::Extents &extents)
{
json->addScalar("Width", extents.width);
json->addScalar("Height", extents.height);
json->addScalar("Depth", extents.depth);
}
template <class ObjectType>
void SerializeOffsetBindingPointerVector(
JsonSerializer *json,
......@@ -387,6 +394,11 @@ Result SerializeFramebufferAttachment(const gl::Context *context,
json->addScalar("ViewIndex", framebufferAttachment.getBaseViewIndex());
json->addScalar("Samples", framebufferAttachment.getRenderToTextureSamples());
{
GroupScope extentsGroup(json, "Extents");
SerializeExtents(json, framebufferAttachment.getSize());
}
if (framebufferAttachment.type() != GL_TEXTURE &&
framebufferAttachment.type() != GL_RENDERBUFFER)
{
......@@ -814,13 +826,6 @@ void SerializeSwizzleState(JsonSerializer *json, const gl::SwizzleState &swizzle
json->addScalar("SwizzleAlpha", swizzleState.swizzleAlpha);
}
void SerializeExtents(JsonSerializer *json, const gl::Extents &extents)
{
json->addScalar("Width", extents.width);
json->addScalar("Height", extents.height);
json->addScalar("Depth", extents.depth);
}
void SerializeInternalFormat(JsonSerializer *json, const gl::InternalFormat *internalFormat)
{
json->addScalar("InternalFormat", internalFormat->internalFormat);
......
......@@ -302,8 +302,8 @@ class ChildProcessesManager():
return self.RunSubprocess(cmd, pipe_stdout=pipe_stdout)
def GetTestsListForFilter(test_path, filter):
cmd = [test_path, "--list-tests", "--gtest_filter=%s" % filter]
def GetTestsListForFilter(args, test_path, filter):
cmd = GetRunCommand(args, test_path) + ["--list-tests", "--gtest_filter=%s" % filter]
info('Getting test list from "%s"' % " ".join(cmd))
return subprocess.check_output(cmd, text=True)
......@@ -321,7 +321,6 @@ def GetSkippedTestPatterns():
def ParseTestNamesFromTestList(output):
def SkipTest(skipped_test_patterns, test):
for skipped_test_pattern in skipped_test_patterns:
if fnmatch.fnmatch(test, skipped_test_pattern):
......@@ -348,6 +347,13 @@ def ParseTestNamesFromTestList(output):
return tests
def GetRunCommand(args, command):
if args.xvfb:
return ['vpython', 'testing/xvfb.py', command]
else:
return [command]
class GroupedResult():
Passed = "Passed"
Failed = "Comparison Failed"
......@@ -414,7 +420,7 @@ class TestBatchResult():
else:
if grouped_result.resultcode == GroupedResult.CompileFailed:
self.repr_str += TestBatchResult.ExtractErrors(grouped_result.output)
else:
elif grouped_result.resultcode != GroupedResult.Passed:
self.repr_str += TestBatchResult.GetAbbreviatedOutput(grouped_result.output)
def ExtractErrors(output):
......@@ -428,7 +434,6 @@ class TestBatchResult():
return "".join(error_lines)
def GetAbbreviatedOutput(output):
# Get all lines after and including the last occurance of "Run".
lines = output.splitlines()
line_count = 0
......@@ -489,13 +494,9 @@ class TestBatch():
CAPTURE_FRAME_END = 100
def __init__(self, use_goma, batch_count, keep_temp_files, goma_dir, verbose):
self.use_goma = use_goma
def __init__(self, args):
self.args = args
self.tests = []
self.batch_count = batch_count
self.keep_temp_files = keep_temp_files
self.goma_dir = goma_dir
self.verbose = verbose
self.results = []
def SetWorkerId(self, worker_id):
......@@ -515,18 +516,15 @@ class TestBatch():
info('Setting ANGLE_CAPTURE_OUT_DIR to %s' % self.trace_folder_path)
env['ANGLE_CAPTURE_OUT_DIR'] = self.trace_folder_path
if not self.keep_temp_files:
if not self.args.keep_temp_files:
ClearFolderContent(self.trace_folder_path)
filt = ':'.join([test.full_test_name for test in self.tests])
if args.xvfb:
cmd = ['vpython', 'testing/xvfb.py', test_exe_path]
else:
cmd = [test_exe_path]
cmd = GetRunCommand(args, test_exe_path)
filter_string = '--gtest_filter=%s' % filt
cmd += [filter_string, '--angle-per-test-capture-label']
if self.verbose:
if self.args.verbose:
info("Run capture: '{} {}'".format(test_exe_path, filter_string))
returncode, output = child_processes_manager.RunSubprocess(
......@@ -555,25 +553,24 @@ class TestBatch():
skipped_tests))
return continued_tests
def BuildReplay(self, args, replay_build_dir, composite_file_id, tests,
child_processes_manager):
def BuildReplay(self, replay_build_dir, composite_file_id, tests, child_processes_manager):
# write gni file that holds all the traces files in a list
self.CreateGNIFile(composite_file_id, tests)
# write header and cpp composite files, which glue the trace files with
# CaptureReplayTests.cpp
self.CreateTestsCompositeFiles(composite_file_id, tests)
gn_args = [("angle_build_capture_replay_tests", "true"),
gn_args = [("angle_build_capture_replay_tests", "true"), ("symbol_level", "1"),
("angle_capture_replay_test_trace_dir", '"%s"' % self.trace_dir),
("angle_capture_replay_composite_file_id", str(composite_file_id))]
returncode, output = child_processes_manager.RunGNGen(args, replay_build_dir, True,
returncode, output = child_processes_manager.RunGNGen(self.args, replay_build_dir, True,
gn_args)
if returncode != 0:
self.results.append(
GroupedResult(GroupedResult.CompileFailed, "Build replay failed at gn generation",
output, tests))
return False
returncode, output = child_processes_manager.RunNinja(args, replay_build_dir,
returncode, output = child_processes_manager.RunNinja(self.args, replay_build_dir,
REPLAY_BINARY, True)
if returncode != 0:
self.results.append(
......@@ -587,12 +584,11 @@ class TestBatch():
env['ANGLE_CAPTURE_ENABLED'] = '0'
env['ANGLE_FEATURE_OVERRIDES_ENABLED'] = 'enable_capture_limits'
if self.verbose:
if self.args.verbose:
info("Run Replay: {}".format(replay_exe_path))
returncode, output = child_processes_manager.RunSubprocess([replay_exe_path],
env,
timeout=SUBPROCESS_TIMEOUT)
returncode, output = child_processes_manager.RunSubprocess(
GetRunCommand(self.args, replay_exe_path), env, timeout=SUBPROCESS_TIMEOUT)
if returncode == -1:
cmd = replay_exe_path
self.results.append(
......@@ -601,7 +597,7 @@ class TestBatch():
return
elif returncode == -2:
self.results.append(
GroupedResult(GroupedResult.TimedOut, "Replay run timed out", "", tests))
GroupedResult(GroupedResult.TimedOut, "Replay run timed out", output, tests))
return
output_lines = output.splitlines()
......@@ -621,9 +617,9 @@ class TestBatch():
count += 1
if len(passes) > 0:
self.results.append(GroupedResult(GroupedResult.Passed, "", "", passes))
self.results.append(GroupedResult(GroupedResult.Passed, "", output, passes))
if len(fails) > 0:
self.results.append(GroupedResult(GroupedResult.Failed, "", "", fails))
self.results.append(GroupedResult(GroupedResult.Failed, "", output, fails))
def PrintContextDiff(self, replay_build_dir, test_name):
frame = 1
......@@ -650,7 +646,7 @@ class TestBatch():
return None
def AddTest(self, test):
assert len(self.tests) <= self.batch_count
assert len(self.tests) <= self.args.batch_count
test.index = len(self.tests)
self.tests.append(test)
......@@ -715,7 +711,7 @@ class TestBatch():
return iter(self.tests)
def GetResults(self):
return TestBatchResult(self.results, self.verbose)
return TestBatchResult(self.results, self.args.verbose)
def ClearFolderContent(path):
......@@ -756,9 +752,9 @@ def RunTests(args, worker_id, job_queue, result_list, message_queue):
result_list.append(test_batch.GetResults())
message_queue.put(str(test_batch.GetResults()))
continue
success = test_batch.BuildReplay(args, replay_build_dir, composite_file_id,
continued_tests, child_processes_manager)
if test_batch.keep_temp_files:
success = test_batch.BuildReplay(replay_build_dir, composite_file_id, continued_tests,
child_processes_manager)
if args.keep_temp_files:
composite_file_id += 1
if not success:
result_list.append(test_batch.GetResults())
......@@ -841,7 +837,7 @@ def main(args):
return EXIT_FAILURE
# get a list of tests
test_path = os.path.join(capture_build_dir, args.test_suite)
test_list = GetTestsListForFilter(test_path, args.gtest_filter)
test_list = GetTestsListForFilter(args, test_path, args.gtest_filter)
test_names = ParseTestNamesFromTestList(test_list)
# objects created by manager can be shared by multiple processes. We use it to create
# collections that are shared by multiple processes such as job queue or result list.
......@@ -851,8 +847,7 @@ def main(args):
# put the test batchs into the job queue
for batch_index in range(test_batch_num):
batch = TestBatch(args.use_goma, int(args.batch_count), args.keep_temp_files,
args.goma_dir, args.verbose)
batch = TestBatch(args)
test_index = batch_index
while test_index < len(test_names):
batch.AddTest(Test(test_names[test_index]))
......@@ -1009,6 +1004,7 @@ if __name__ == "__main__":
parser.add_argument(
'--batch-count',
default=DEFAULT_BATCH_COUNT,
type=int,
help='Number of tests in a batch. Default is %d.' % DEFAULT_BATCH_COUNT)
parser.add_argument(
'--keep-temp-files',
......
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