From 8e01d0b9a19f007a57191f87912e9dfbae76a329 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 3 Dec 2015 16:24:37 +0800 Subject: [PATCH] lit-test: collect coverage if ran with COVERAGE=1. --- lit-test/test/lit.cfg | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lit-test/test/lit.cfg b/lit-test/test/lit.cfg index 08f024e55..21b0acc09 100644 --- a/lit-test/test/lit.cfg +++ b/lit-test/test/lit.cfg @@ -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_) )