| #!/bin/sh | |
| prog=$(basename $0) | |
| # Expect to be run from the parent LNT directory. | |
| if [ ! -f README.txt ] || [ ! -d lnt ]; then | |
| printf 1>&2 "%s: expected to be run from base LNT directory\n" "$prog" | |
| exit 1 | |
| fi | |
| # Check arguments. | |
| if [ $# == "0" ]; then | |
| printf 1>&2 "usage: %s {lit-arguments}*\n" "$prog" | |
| 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 |