diff options
Diffstat (limited to 'catapult/systrace/systrace/tracing_agents/atrace_from_file_agent_unittest.py')
-rwxr-xr-x | catapult/systrace/systrace/tracing_agents/atrace_from_file_agent_unittest.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/catapult/systrace/systrace/tracing_agents/atrace_from_file_agent_unittest.py b/catapult/systrace/systrace/tracing_agents/atrace_from_file_agent_unittest.py index 2531c919..610b5707 100755 --- a/catapult/systrace/systrace/tracing_agents/atrace_from_file_agent_unittest.py +++ b/catapult/systrace/systrace/tracing_agents/atrace_from_file_agent_unittest.py @@ -49,6 +49,31 @@ class AtraceFromFileAgentTest(unittest.TestCase): @decorators.HostOnlyTest + def test_default_output_filename(self): + update_systrace_trace_viewer.update(force_update=True) + self.assertTrue(os.path.exists( + update_systrace_trace_viewer.SYSTRACE_TRACE_VIEWER_HTML_FILE)) + output_file_name = os.path.join(TEST_DIR, 'compressed_atrace_data.html') + try: + # use from-file to create a specific expected output + run_systrace.main_impl(['./run_systrace.py', + '--from-file', + COMPRESSED_ATRACE_DATA]) + # and verify file contents + with contextlib.nested(open(output_file_name, 'r'), + open(DECOMPRESSED_ATRACE_DATA, 'r')) as (f1, f2): + full_trace = f1.read() + expected_contents = f2.read() + self.assertTrue(expected_contents in full_trace) + except: + raise + finally: + os.remove(update_systrace_trace_viewer.SYSTRACE_TRACE_VIEWER_HTML_FILE) + if os.path.exists(output_file_name): + os.remove(output_file_name) + + + @decorators.HostOnlyTest def test_missing_file(self): try: run_systrace.main_impl(['./run_systrace.py', |