blob: cbb2134f6d92f9d7a8c8e7dda3a3a2e9e1c0a45c [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001#!/usr/bin/env python
2# Copyright 2014 the V8 project authors. All rights reserved.
Ben Murdoch3ef787d2012-04-12 10:51:47 +01003# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are
5# met:
6#
7# * Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# * Redistributions in binary form must reproduce the above
10# copyright notice, this list of conditions and the following
11# disclaimer in the documentation and/or other materials provided
12# with the distribution.
13# * Neither the name of Google Inc. nor the names of its
14# contributors may be used to endorse or promote products derived
15# from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
Ben Murdochb8a8cc12014-11-26 15:28:44 +000029# Wraps test execution with a coverage analysis. To get the best speed, the
30# native python coverage version >= 3.7.1 should be installed.
31
32import coverage
33import os
34import unittest
35import sys
36
37
38def Main(argv):
39 script_path = os.path.dirname(os.path.abspath(__file__))
40 cov = coverage.coverage(include=([os.path.join(script_path, '*.py')]))
41 cov.start()
42 import test_scripts
43 alltests = map(unittest.TestLoader().loadTestsFromTestCase, [
44 test_scripts.ToplevelTest,
45 test_scripts.ScriptTest,
46 test_scripts.SystemTest,
47 ])
48 unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(alltests))
49 cov.stop()
50 print cov.report()
51
52
53if __name__ == '__main__':
54 sys.exit(Main(sys.argv))