summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2019-11-05 15:53:58 -0800
committerYabin Cui <yabinc@google.com>2019-11-05 15:53:58 -0800
commite43663b33403149cc191fffe43d88897bf43e461 (patch)
tree3bea460b41b35679ec01a986d8f8bbfbb16da0f6
parenta3ae53117165460a18b5ea7eaab8231b62c63025 (diff)
downloadextras-e43663b33403149cc191fffe43d88897bf43e461.tar.gz
simpleperf: add browser option in test.py.
To control whether generated html files should be shown in browser. Bug: none Test: test.py. Change-Id: I58eeae716e42068bd5f278bb8006d8818e3fc63c
-rwxr-xr-xsimpleperf/scripts/test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/simpleperf/scripts/test.py b/simpleperf/scripts/test.py
index f6295d4e..caf3fb2a 100755
--- a/simpleperf/scripts/test.py
+++ b/simpleperf/scripts/test.py
@@ -115,6 +115,7 @@ class TestHelper(object):
self.adb = AdbHelper(enable_switch_to_root=True)
self.android_version = self.adb.get_android_version()
self.device_features = None
+ self.browser_option = []
def get_test_base_dir(self, python_version):
""" Return the dir of generated data for a python version. """
@@ -185,6 +186,8 @@ class TestBase(unittest.TestCase):
os.chdir(self.test_dir)
def run_cmd(self, args, return_output=False):
+ if args[0] == 'report_html.py' or args[0] == INFERNO_SCRIPT:
+ args += TEST_HELPER.browser_option
if args[0].endswith('.py'):
args = [sys.executable, TEST_HELPER.script_path(args[0])] + args[1:]
use_shell = args[0].endswith('.bat')
@@ -1682,6 +1685,7 @@ def main():
parser.add_argument('--repeat', type=int, nargs=1, default=[1], help='run test multiple times')
parser.add_argument('--no-test-result', dest='report_test_result',
action='store_false', help="Don't report test result.")
+ parser.add_argument('--browser', action='store_true', help='pop report html file in browser.')
parser.add_argument('pattern', nargs='*', help='Run tests matching the selected pattern.')
args = parser.parse_args()
tests = get_all_tests()
@@ -1717,6 +1721,9 @@ def main():
for python_version in python_versions:
remove(TEST_HELPER.get_test_base_dir(python_version))
+ if not args.browser:
+ TEST_HELPER.browser_option = ['--no_browser']
+
test_results = []
for version in python_versions:
os.chdir(TEST_HELPER.cur_dir)