Home | History | Annotate | Download | only in bin
      1 #!/usr/bin/env python2.7
      2 
      3 # Copyright 2015 The Chromium Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 """Runs the unit test suite for systrace."""
      8 
      9 import os
     10 import sys
     11 import unittest
     12 
     13 _SYSTRACE_DIR = os.path.abspath(
     14     os.path.join(os.path.dirname(__file__), os.path.pardir))
     15 
     16 def main():
     17   systrace_package_path = os.path.join(_SYSTRACE_DIR, 'systrace')
     18   suite = unittest.TestLoader().discover(
     19       systrace_package_path,
     20       pattern = '*_unittest.py',
     21       top_level_dir=_SYSTRACE_DIR)
     22   result = unittest.TextTestRunner(verbosity=2).run(suite)
     23   if result.wasSuccessful():
     24     sys.exit(0)
     25   else:
     26     sys.exit(1)
     27 
     28 if __name__ == '__main__':
     29   main()
     30