Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
Yunlian Jiang | 04dc5dc | 2013-04-23 15:05:05 -0700 | [diff] [blame] | 3 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
Ahmad Sharif | 4467f00 | 2012-12-20 12:09:49 -0800 | [diff] [blame] | 6 | |
| 7 | """Testing of benchmark_run.""" |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 8 | |
| 9 | import unittest |
Ahmad Sharif | 4467f00 | 2012-12-20 12:09:49 -0800 | [diff] [blame] | 10 | |
| 11 | from utils import logger |
| 12 | |
Yunlian Jiang | 04dc5dc | 2013-04-23 15:05:05 -0700 | [diff] [blame] | 13 | from suite_runner import MockSuiteRunner |
Ahmad Sharif | 4467f00 | 2012-12-20 12:09:49 -0800 | [diff] [blame] | 14 | from benchmark_run import MockBenchmarkRun |
| 15 | from label import MockLabel |
| 16 | from benchmark import Benchmark |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 17 | from machine_manager import MockMachineManager |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 18 | from results_cache import MockResultsCache |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 19 | |
| 20 | |
| 21 | class BenchmarkRunTest(unittest.TestCase): |
| 22 | def testDryRun(self): |
Ahmad Sharif | 4467f00 | 2012-12-20 12:09:49 -0800 | [diff] [blame] | 23 | my_label = MockLabel("test1", "image1", "/tmp/test_benchmark_run", |
cmtice | c454cee | 2014-04-09 10:58:51 -0700 | [diff] [blame] | 24 | "x86-alex", "chromeos2-row1-rack4-host9.cros", |
Luis Lozano | f81680c | 2013-03-15 14:44:13 -0700 | [diff] [blame] | 25 | image_args="", |
Luis Lozano | f81680c | 2013-03-15 14:44:13 -0700 | [diff] [blame] | 26 | cache_dir="") |
cmtice | c454cee | 2014-04-09 10:58:51 -0700 | [diff] [blame] | 27 | logging_level="average" |
| 28 | m = MockMachineManager("/tmp/chromeos_root", 0, logging_level) |
| 29 | m.AddMachine("chromeos2-row1-rack4-host9.cros") |
| 30 | bench = Benchmark("page_cycler.netsim.top_10", # name |
| 31 | "page_cycler.netsim.top_10", # test_name |
| 32 | "", # test_args |
| 33 | 1, # iteratins |
cmtice | c454cee | 2014-04-09 10:58:51 -0700 | [diff] [blame] | 34 | False, # rm_chroot_tmp |
| 35 | "", # perf_args |
| 36 | suite="telemetry_Crosperf") # suite |
Ahmad Sharif | 4467f00 | 2012-12-20 12:09:49 -0800 | [diff] [blame] | 37 | b = MockBenchmarkRun("test run", |
| 38 | bench, |
| 39 | my_label, |
| 40 | 1, |
| 41 | [], |
| 42 | m, |
Luis Lozano | f81680c | 2013-03-15 14:44:13 -0700 | [diff] [blame] | 43 | logger.GetLogger(), |
cmtice | c454cee | 2014-04-09 10:58:51 -0700 | [diff] [blame] | 44 | logging_level, |
Luis Lozano | f81680c | 2013-03-15 14:44:13 -0700 | [diff] [blame] | 45 | "") |
Ahmad Sharif | 4467f00 | 2012-12-20 12:09:49 -0800 | [diff] [blame] | 46 | b.cache = MockResultsCache() |
Yunlian Jiang | 9e53333 | 2013-09-30 15:45:46 -0700 | [diff] [blame] | 47 | b.suite_runner = MockSuiteRunner() |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 48 | b.start() |
| 49 | |
| 50 | |
| 51 | if __name__ == "__main__": |
| 52 | unittest.main() |