5 # Expect to be run from the parent lit directory.
6 if [ ! -f setup.py ] || [ ! -d lit ]; then
7 printf 1>&2 "%s: expected to be run from base lit directory\n" "$prog"
11 # Parse command line arguments.
12 if [ "$1" = "--generate-html" ]; then
17 # If invoked with no arguments, run all the tests.
22 # Check that the active python has been modified to enable coverage in its
25 'import sitecustomize, sys; sys.exit("coverage" not in dir(sitecustomize))' \
27 printf 1>&2 "error: active python does not appear to enable coverage in its 'sitecustomize.py'\n"
31 # First, remove any existing coverage data files.
33 find tests -name .coverage.\* -exec rm {} \;
35 # Next, run the tests.
36 lit -sv --param check-coverage=1 "$@"
38 # Next, move all the data files from subdirectories up.
39 find tests/* -name .coverage.\* -exec mv {} tests \;
41 # Combine all the data files.
42 (cd tests && python -m coverage combine)
44 # Finally, generate the report.
45 (cd tests && python -m coverage report)
47 # Generate the HTML report, if requested.
48 if [ ! -z "$GENERATE_HTML" ]; then
49 (cd tests && python -m coverage html)