#!/usr/bin/env python
# Copyright (c) 2015 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 sys
import os

hooks_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if hooks_path not in sys.path:
  sys.path.append(hooks_path)

from hooks import install


from tracing import tracing_project
from tracing.build import d8_runner


def Main(args):
  project = tracing_project.TracingProject()
  cmd = """
  loadHTML('/base/d8_tests.html');
  """
  res = d8_runner.RunJsString(cmd, list(project.source_paths))
  print res.output
  return res.returncode

if __name__ == '__main__':
  install.InstallHooks()

  sys.exit(Main(sys.argv[1:]))