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