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

Side by Side Diff: tools/perf/core/trybot_command_unittest.py

Issue 1873623002: [tools/perf] Make trybot bails out early if the benchmark is disabled on trybot platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 | « tools/perf/core/trybot_command.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 import argparse 4 import argparse
5 import logging 5 import logging
6 import json 6 import json
7 import StringIO 7 import StringIO
8 import unittest 8 import unittest
9 9
10 import mock 10 import mock
11 11
12 from telemetry import benchmark
12 from telemetry.testing import system_stub 13 from telemetry.testing import system_stub
13 14
14 from core import trybot_command 15 from core import trybot_command
15 16
16 17
17 class FakeProcess(object): 18 class FakeProcess(object):
18 19
19 def __init__(self, expected_responses): 20 def __init__(self, expected_responses):
20 self._communicate = expected_responses[1:] 21 self._communicate = expected_responses[1:]
21 self._poll = expected_responses[0] 22 self._poll = expected_responses[0]
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 "target_arch": "ia32", 621 "target_arch": "ia32",
621 "truncate_percent": "0" 622 "truncate_percent": "0"
622 }''''''config = { 623 }''''''config = {
623 "command": "./tools/perf/run_benchmark --browser=android-chromium --verbose", 624 "command": "./tools/perf/run_benchmark --browser=android-chromium --verbose",
624 "max_time_minutes": "120", 625 "max_time_minutes": "120",
625 "repeat_count": "1", 626 "repeat_count": "1",
626 "target_arch": "ia32", 627 "target_arch": "ia32",
627 "truncate_percent": "0" 628 "truncate_percent": "0"
628 }''') 629 }''')
629 self.assertEquals(cfg.read(), config) 630 self.assertEquals(cfg.read(), config)
631
632
633
634 class IsBenchmarkDisabledOnTrybotPlatformTest(unittest.TestCase):
635
636 def IsBenchmarkDisabled(self, benchmark_class, trybot_name):
637 return trybot_command.Trybot.IsBenchmarkDisabledOnTrybotPlatform(
638 benchmark_class, trybot_name)[0]
639
640 def testBenchmarkIsDisabledAll(self):
641 @benchmark.Disabled('all')
642 class FooBenchmark(benchmark.Benchmark):
643 pass
644 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
645 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'all-mac'))
646 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'android-s5'))
647 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'linux'))
648 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))
649
650 def testBenchmarkIsEnabledAll(self):
651 @benchmark.Enabled('all')
652 class FooBenchmark(benchmark.Benchmark):
653 pass
654 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
655 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all-mac'))
656 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'android-s5'))
657 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'linux'))
658 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))
659
660 def testBenchmarkIsDisabledOnMultiplePlatforms(self):
661 @benchmark.Disabled('win', 'mac')
662 class FooBenchmark(benchmark.Benchmark):
663 pass
664 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
665 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'android-s5'))
666 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'linux'))
667
668 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'all-mac'))
669 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))
670
671 def testBenchmarkIsEnabledOnMultiplePlatforms(self):
672 @benchmark.Enabled('win', 'mac')
673 class FooBenchmark(benchmark.Benchmark):
674 pass
675 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all'))
676 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'all-mac'))
677 self.assertFalse(self.IsBenchmarkDisabled(FooBenchmark, 'winx64ati'))
678
679 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'android-s5'))
680 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'linux'))
681 self.assertTrue(self.IsBenchmarkDisabled(FooBenchmark, 'all-linux'))
OLDNEW
« no previous file with comments | « tools/perf/core/trybot_command.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698