#!/usr/bin/env vpython3
# Copyright 2013 The Chromium Authors
# 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
path_util.AddTelemetryToPath()
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())