Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: tools/push-to-trunk/script_test.py

Issue 183923013: Add coverage analysis to push and merge script tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/script_test.py
diff --git a/build/gyp_v8.py b/tools/push-to-trunk/script_test.py
old mode 100644
new mode 100755
similarity index 66%
copy from build/gyp_v8.py
copy to tools/push-to-trunk/script_test.py
index 462ee674acbbc5880fe685507fb4527976f50de2..cbb2134f6d92f9d7a8c8e7dda3a3a2e9e1c0a45c
--- a/build/gyp_v8.py
+++ b/tools/push-to-trunk/script_test.py
@@ -1,4 +1,5 @@
-# Copyright 2013 the V8 project authors. All rights reserved.
+#!/usr/bin/env python
+# Copyright 2014 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
@@ -25,17 +26,29 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# This file is (possibly, depending on python version) imported by
-# gyp_v8 when GYP_PARALLEL=1 and it creates sub-processes through the
-# multiprocessing library.
-
-# Importing in Python 2.6 (fixed in 2.7) on Windows doesn't search for imports
-# that don't end in .py (and aren't directories with an __init__.py). This
-# wrapper makes "import gyp_v8" work with those old versions and makes it
-# possible to execute gyp_v8.py directly on Windows where the extension is
-# useful.
+# Wraps test execution with a coverage analysis. To get the best speed, the
+# native python coverage version >= 3.7.1 should be installed.
+import coverage
import os
+import unittest
+import sys
+
+
+def Main(argv):
+ script_path = os.path.dirname(os.path.abspath(__file__))
+ cov = coverage.coverage(include=([os.path.join(script_path, '*.py')]))
+ cov.start()
+ import test_scripts
+ alltests = map(unittest.TestLoader().loadTestsFromTestCase, [
+ test_scripts.ToplevelTest,
+ test_scripts.ScriptTest,
+ test_scripts.SystemTest,
+ ])
+ unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(alltests))
+ cov.stop()
+ print cov.report()
+
-path = os.path.abspath(os.path.split(__file__)[0])
-execfile(os.path.join(path, 'gyp_v8'))
+if __name__ == '__main__':
+ sys.exit(Main(sys.argv))
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698