Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / tools / memory_inspector / run_tests
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import logging
7 import os
8 import sys
9 import unittest
10
11
12 if __name__ == '__main__':
13   cur_dir = os.path.abspath(os.path.dirname(__file__))
14   chromium_dir = os.path.abspath(os.path.join(cur_dir, os.pardir, os.pardir))
15
16   sys.path += [
17       cur_dir,
18
19       # Include all dependencies.
20       os.path.join(chromium_dir, 'build', 'android'),  # For pylib.
21   ]
22
23   logging.basicConfig(
24       level=logging.DEBUG if '-v' in sys.argv else logging.WARNING,
25       format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')
26
27   suite = unittest.TestSuite()
28   loader = unittest.TestLoader()
29   suite.addTests(loader.discover(start_dir=cur_dir, pattern='*_unittest.py'))
30
31   res = unittest.TextTestRunner(verbosity=2).run(suite)
32   if res.wasSuccessful():
33     sys.exit(0)
34   else:
35     sys.exit(1)