summaryrefslogtreecommitdiffstats
path: root/tools/memory_inspector/run_tests
blob: 522ce80f362df0adda887d50d16c445a8192f132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
# Copyright 2014 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 logging
import memory_inspector
import sys
import unittest


if __name__ == '__main__':
  logging.basicConfig(
      level=logging.DEBUG if '-v' in sys.argv else logging.WARNING,
      format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')

  suite = unittest.TestSuite()
  loader = unittest.TestLoader()
  pattern = '*%s*_unittest.py' % ('' if len(sys.argv) < 2 else sys.argv[1])
  suite.addTests(loader.discover(start_dir=memory_inspector.ROOT_DIR,
                                 pattern=pattern))
  res = unittest.TextTestRunner(verbosity=2).run(suite)
  if res.wasSuccessful():
    sys.exit(0)
  else:
    sys.exit(1)