[llvm] r174000 - [lit] Add a script for checking test coverage.

Daniel Dunbar daniel at zuster.org
Wed Jan 30 16:21:44 PST 2013


Author: ddunbar
Date: Wed Jan 30 18:21:44 2013
New Revision: 174000

URL: http://llvm.org/viewvc/llvm-project?rev=174000&view=rev
Log:
[lit] Add a script for checking test coverage.

Added:
    llvm/trunk/utils/lit/tests/.coveragerc
    llvm/trunk/utils/lit/utils/
    llvm/trunk/utils/lit/utils/README.txt
    llvm/trunk/utils/lit/utils/check-coverage   (with props)

Added: llvm/trunk/utils/lit/tests/.coveragerc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/.coveragerc?rev=174000&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/.coveragerc (added)
+++ llvm/trunk/utils/lit/tests/.coveragerc Wed Jan 30 18:21:44 2013
@@ -0,0 +1,11 @@
+# .coveragerc to control coverage.py
+[run]
+branch = False
+parallel = False
+source = lit
+
+[html]
+directory = coverage_html_report
+
+[report]
+omit = Inputs

Added: llvm/trunk/utils/lit/utils/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/utils/README.txt?rev=174000&view=auto
==============================================================================
--- llvm/trunk/utils/lit/utils/README.txt (added)
+++ llvm/trunk/utils/lit/utils/README.txt Wed Jan 30 18:21:44 2013
@@ -0,0 +1,2 @@
+Utilities for the project that aren't intended to be part of a source
+distribution.

Added: llvm/trunk/utils/lit/utils/check-coverage
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/utils/check-coverage?rev=174000&view=auto
==============================================================================
--- llvm/trunk/utils/lit/utils/check-coverage (added)
+++ llvm/trunk/utils/lit/utils/check-coverage Wed Jan 30 18:21:44 2013
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+prog=$(basename $0)
+
+# Expect to be run from the parent lit directory.
+if [ ! -f setup.py ] || [ ! -d lit ]; then
+    printf 1>&2 "%s: expected to be run from base lit directory\n" "$prog"
+    exit 1
+fi
+
+# Parse command line arguments.
+if [ "$1" == "--generate-html" ]; then
+    GENERATE_HTML=1
+    shift
+fi
+
+# If invoked with no arguments, run all the tests.
+if [ $# == "0" ]; then
+    set -- "tests"
+fi
+
+# Check that the active python has been modified to enable coverage in its
+# sitecustomize.
+if ! python -c \
+      'import sitecustomize, sys; sys.exit("coverage" not in dir(sitecustomize))' \
+      &> /dev/null; then
+    printf 1>&2 "error: active python does not appear to enable coverage in its 'sitecustomize.py'\n"
+    exit 1
+fi
+
+# First, remove any existing coverage data files.
+rm -f tests/.coverage
+find tests -name .coverage.\* -exec rm {} \;
+
+# Next, run the tests.
+lit -sv --param check-coverage=1 "$@"
+
+# Next, move all the data files from subdirectories up.
+find tests/* -name .coverage.\* -exec mv {} tests \;
+
+# Combine all the data files.
+(cd tests && python -m coverage combine)
+
+# Finally, generate the report.
+(cd tests && python -m coverage report)
+
+# Generate the HTML report, if requested.
+if [ ! -z "$GENERATE_HTML" ]; then
+    (cd tests && python -m coverage html)
+fi

Propchange: llvm/trunk/utils/lit/utils/check-coverage
------------------------------------------------------------------------------
    svn:executable = *





More information about the llvm-commits mailing list