summaryrefslogtreecommitdiffstats
path: root/tools/perf/list_affected_benchmarks
blob: 63dbc80692c3bef5d1a8bef3a9b59bc8e00ceb02 (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
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import argparse
import os
import json
import sys

from core import path_util
from core import benchmark_finders


def main():
  parser = argparse.ArgumentParser(
      description=('List all benchmarks defined in a benchmark file as a json '
                   'string.'))
  parser.add_argument('benchmark_file_paths', type=str, nargs='+')
  args = parser.parse_args()
  benchmark_names = set()
  for path in args.benchmark_file_paths:
    assert os.path.isfile(path), '%s does not exist' % path
    benchmark_names.update(benchmark_finders.GetBenchmarkNamesForFile(
        path_util.GetPerfDir(), os.path.abspath(path)))
  print json.dumps(list(benchmark_names))


if __name__ == '__main__':
  sys.exit(main())