#!/usr/bin/env python2.7

# Copyright 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.

"""Runs the unit test suite for systrace."""

import os
import sys
import unittest

_CATAPULT = os.path.abspath(
    os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))

def main():
  systrace_package_path = os.path.join(_CATAPULT, 'systrace', 'systrace')
  suite = unittest.TestLoader().discover(
      systrace_package_path, pattern = '*_unittest.py')
  result = unittest.TextTestRunner(verbosity=2).run(suite)
  if result.wasSuccessful():
    sys.exit(0)
  else:
    sys.exit(1)

if __name__ == '__main__':
  main()
