#!/usr/bin/env python
# Copyright 2017 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 os
import subprocess
import sys


_TELEMETRY_BIN_DIR = os.path.abspath(
    os.path.join(os.path.dirname(__file__), '..', 'telemetry', 'bin'))


def main(args):
  print 'Fetching Telemetry dependencies...'
  subprocess.check_call(
      [sys.executable,
       os.path.join(_TELEMETRY_BIN_DIR, 'fetch_telemetry_binary_dependencies')])

  print 'Done fetching Telemetry dependencies.'
  print 'Running Telemetry tests...'
  subprocess.check_call(
      [sys.executable, os.path.join(_TELEMETRY_BIN_DIR, 'run_tests')] + args)


if __name__ == '__main__':
  sys.exit(main(sys.argv[1:]))
