blob: 50af0c08bf6fdd3ae80b2c5134d61d5ab635e7ce [file] [log] [blame]
Paweł Hajdan, Jr643409b2014-10-23 08:34:061#!/usr/bin/env python
2# Copyright 2014 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
6import json
7import os
8import sys
9
10
11import common
12
13
14def main_run(args):
15 filter_tests = []
16 if args.filter_file:
17 filter_tests = json.load(args.filter_file)
18
19 with common.temporary_file() as tempfile_path:
Paweł Hajdan, Jr5647b452014-10-29 13:08:3020 rc = common.run_runtest(args, [
Paweł Hajdan, Jr643409b2014-10-23 08:34:0621 '--annotate', 'gtest',
22 '--test-type', 'telemetry_unittests',
Paweł Hajdan, Jr643409b2014-10-23 08:34:0623 '--run-python-script',
24 os.path.join(common.SRC_DIR, 'tools', 'telemetry', 'run_tests'),
25 '--browser', args.build_config_fs.lower(),
26 '--retry-limit', '3',
27 '--write-full-results-to', tempfile_path,
28 ] + filter_tests)
29
30 with open(tempfile_path) as f:
31 results = json.load(f)
32
Paweł Hajdan, Jr03ee6e032014-10-27 12:51:0833 parsed_results = common.parse_common_test_results(results, test_separator='.')
Paweł Hajdan, Jr643409b2014-10-23 08:34:0634 failures = parsed_results['unexpected_failures']
35
36 json.dump({
37 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and
38 ((rc == 0) or failures)),
39 'failures': failures.keys(),
40 }, args.output)
41
42 return rc
43
44
45def main_compile_targets(args):
46 json.dump(['chrome'], args.output)
47
48
49if __name__ == '__main__':
50 funcs = {
51 'run': main_run,
52 'compile_targets': main_compile_targets,
53 }
54 sys.exit(common.run_script(sys.argv[1:], funcs))