blob: 70770f41b56e2f9e971efefa503d640f5bedd82a [file] [log] [blame]
Dirk Pranke4c9955b2021-06-16 21:13:491#!/usr/bin/env python
2# Copyright 2021 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Runs //tools/metrics/metrics_python_tests.py as a 'script' test."""
7
8import json
9import os
10import sys
11
12
13import common
14
15
16def main_run(args):
17 with common.temporary_file() as tempfile_path:
18 rc = common.run_command(['vpython',
19 os.path.join(common.SRC_DIR, 'testing', 'test_env.py'),
20 os.path.join(common.SRC_DIR, 'tools', 'metrics',
21 'metrics_python_tests.py'),
Kuan Huangf4e199e2021-11-04 22:53:1122 '--isolated-script-test-output', tempfile_path,
23 '--skip-set-lpac-acls=1',
Dirk Pranke4c9955b2021-06-16 21:13:4924 ], cwd=os.path.join(common.SRC_DIR, 'out', args.build_config_fs))
25
26 with open(tempfile_path) as f:
27 isolated_results = json.load(f)
28
29 results = common.parse_common_test_results(isolated_results,
30 test_separator='.')
31
Ben Pastene58c7818f2021-07-01 16:58:0732 failures = [
33 '%s: %s' % (k, v) for k, v in results['unexpected_failures'].items()
34 ]
35 common.record_local_script_results(
36 'metrics_python_tests', args.output, failures, True)
Dirk Pranke4c9955b2021-06-16 21:13:4937
38 return rc
39
40
41def main_compile_targets(args):
42 json.dump([], args.output)
43
44
45if __name__ == '__main__':
46 funcs = {
47 'run': main_run,
48 'compile_targets': main_compile_targets,
49 }
50 sys.exit(common.run_script(sys.argv[1:], funcs))