lit-test: collect coverage if ran with COVERAGE=1.

This commit is contained in:
whitequark 2015-12-03 16:24:37 +08:00
parent 2b71cd2556
commit 8e01d0b9a1
1 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,5 @@
# -*- python -*-
import os, subprocess
import lit.util
import lit.formats
@ -10,8 +12,14 @@ config.suffixes = ['.py']
python_executable = 'python3.5'
harness = '{} {}'.format(python_executable, os.path.join(root, 'harness.py'))
config.substitutions.append( ('%python', harness) )
harness = os.path.join(root, 'harness.py')
if os.getenv('COVERAGE'):
harness = 'coverage run --append --source=artiq {}'.format(harness)
config.environment['COVERAGE_FILE'] = os.path.join(root, '..', '.coverage')
config.substitutions.append( ('%python', harness) )
else:
harness = '{} {}'.format(python_executable, harness)
config.substitutions.append( ('%python', harness) )
not_ = '{} {}'.format(python_executable, os.path.join(root, 'not.py'))
config.substitutions.append( ('%not', not_) )