Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1507)

Side by Side Diff: mojo/devtools/common/devtoolslib/benchmark_unittest.py

Issue 1435523002: Refactor mojo_benchmark. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/devtools/common/devtoolslib/benchmark.py ('k') | mojo/devtools/common/mojo_benchmark » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Tests for the logic that drives runs of the benchmarking mojo app and parses
6 its output."""
7
8 import imp
9 import os.path
10 import sys
11 import unittest
12
13 try:
14 imp.find_module("devtoolslib")
15 except ImportError:
16 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
17
18 from devtoolslib import benchmark
19
20
21 class BenchmarkTest(unittest.TestCase):
22 """Tests the benchmark module."""
23
24 def test_parse_measurement_results_empty(self):
25 """Tests parsing empty output."""
26 output = """"""
27 results = benchmark._parse_measurement_results(output)
28 self.assertEquals({}, results)
29
30 def test_parse_measurement_results_typical(self):
31 """Tests parsing typical output with unrelated log entries."""
32 output = """
33 [INFO:network_fetcher.cc(322)] Caching mojo app http://127.0.0.1:31839/benchmark .mojo at /usr/local/google/home/user/.mojo_url_response_disk_cache/cache/4F6FAE7 52C7958AE122C6A2D778F2014C15578250B3C6746D54B99E4F15A4458/4F6FAE752C7958AE122C6A 2D778F2014C15578250B3C6746D54B99E4F15A4458
34 [INFO:network_fetcher.cc(322)] Caching mojo app http://127.0.0.1:31839/dart_trac ed_application.mojo at /usr/local/google/home/user/.mojo_url_response_disk_cache /cache/AB290478907A1DC5434CBCFD053BE2E74254D882644E76B3C28E3E7E1BCDCC3D/AB290478 907A1DC5434CBCFD053BE2E74254D882644E76B3C28E3E7E1BCDCC3D
35 Observatory listening on http://127.0.0.1:38128
36 [1109/155613:WARNING:event.cc(234)] Ignoring incorrect complete event (no durati on)
37 measurement: time_until/a/b 42.5
38 measurement: time_between/a/b/c/d 21.1
39 measurement: time_between/a/b/e/f FAILED
40 some measurements failed
41 """
42 results = benchmark._parse_measurement_results(output)
43 self.assertEquals({'time_until/a/b': 42.5,
44 'time_between/a/b/c/d': 21.1}, results)
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/benchmark.py ('k') | mojo/devtools/common/mojo_benchmark » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698