aboutsummaryrefslogtreecommitdiff
path: root/crosperf/benchmark_run_unittest.py
blob: 0e7c92ff54a0c1de44dd1b6691ad7ad79a7be309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python

# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Testing of benchmark_run."""

import unittest

from utils import logger

from suite_runner import MockSuiteRunner
from benchmark_run import MockBenchmarkRun
from label import MockLabel
from benchmark import Benchmark
from machine_manager import MockMachineManager
from results_cache import MockResultsCache


class BenchmarkRunTest(unittest.TestCase):
  def testDryRun(self):
    my_label = MockLabel("test1", "image1", "/tmp/test_benchmark_run",
                         "x86-alex", "chromeos2-row1-rack4-host9.cros",
                         image_args="",
                         cache_dir="")
    logging_level="average"
    m = MockMachineManager("/tmp/chromeos_root", 0, logging_level)
    m.AddMachine("chromeos2-row1-rack4-host9.cros")
    bench = Benchmark("page_cycler.netsim.top_10",    # name
                      "page_cycler.netsim.top_10",    # test_name
                      "",             # test_args
                      1,              # iteratins
                      False,          # rm_chroot_tmp
                      "",             # perf_args
                      suite="telemetry_Crosperf")     # suite
    b = MockBenchmarkRun("test run",
                         bench,
                         my_label,
                         1,
                         [],
                         m,
                         logger.GetLogger(),
                         logging_level,
                         "")
    b.cache = MockResultsCache()
    b.suite_runner = MockSuiteRunner()
    b.start()


if __name__ == "__main__":
  unittest.main()