parent
edfe24178d
commit
765aff5a42
16 changed files with 205 additions and 116 deletions
@ -1,50 +0,0 @@ |
|||||||
[run] |
|
||||||
branch = True |
|
||||||
concurrency = |
|
||||||
multiprocessing |
|
||||||
data_file = .coverage/coverage |
|
||||||
parallel = True |
|
||||||
source = |
|
||||||
meson.py |
|
||||||
mesonbuild/ |
|
||||||
mesonconf.py |
|
||||||
mesonintrospect.py |
|
||||||
mesonrewriter.py |
|
||||||
mesontest.py |
|
||||||
run_cross_test.py |
|
||||||
run_project_tests.py |
|
||||||
run_tests.py |
|
||||||
run_unittests.py |
|
||||||
|
|
||||||
# Aliases to /root/ are needed because Travis runs in docker at /root/. |
|
||||||
[paths] |
|
||||||
meson = |
|
||||||
meson.py |
|
||||||
/root/meson.py |
|
||||||
mesonbuild = |
|
||||||
mesonbuild/ |
|
||||||
/root/mesonbuild/ |
|
||||||
mesonconf = |
|
||||||
mesonconf.py |
|
||||||
/root/mesonconf.py |
|
||||||
mesonintrospect = |
|
||||||
mesonintrospect.py |
|
||||||
/root/mesonintrospect.py |
|
||||||
mesonrewriter = |
|
||||||
mesonrewriter.py |
|
||||||
/root/mesonrewriter.py |
|
||||||
mesontest = |
|
||||||
mesontest.py |
|
||||||
/root/mesontest.py |
|
||||||
run_cross_test = |
|
||||||
run_cross_test.py |
|
||||||
/root/run_cross_test.py |
|
||||||
run_project_tests = |
|
||||||
run_project_tests.py |
|
||||||
/root/run_project_tests.py |
|
||||||
run_tests = |
|
||||||
run_tests.py |
|
||||||
/root/run_tests.py |
|
||||||
run_unittests = |
|
||||||
run_unittests.py |
|
||||||
/root/run_unittests.py |
|
@ -0,0 +1,13 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
echo "Combining coverage reports..." |
||||||
|
coverage combine |
||||||
|
|
||||||
|
echo "Generating XML report..." |
||||||
|
coverage xml |
||||||
|
|
||||||
|
echo "Printing report" |
||||||
|
coverage report |
||||||
|
|
||||||
|
echo "Uploading to codecov..." |
||||||
|
codecov -f .coverage/coverage.xml -n "$1" |
@ -0,0 +1,19 @@ |
|||||||
|
# Copyright 2021 The Meson development team |
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
# you may not use this file except in compliance with the License. |
||||||
|
# You may obtain a copy of the License at |
||||||
|
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
|
||||||
|
# Unless required by applicable law or agreed to in writing, software |
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
# See the License for the specific language governing permissions and |
||||||
|
# limitations under the License. |
||||||
|
|
||||||
|
# This script is used by coverage (see tools/run_with_cov.py) to enable coverage |
||||||
|
# reports in python subprocesses |
||||||
|
|
||||||
|
import coverage |
||||||
|
coverage.process_startup() |
@ -0,0 +1,25 @@ |
|||||||
|
[run] |
||||||
|
branch = True |
||||||
|
parallel = True |
||||||
|
concurrency = multiprocessing |
||||||
|
data_file = @ROOT@/.coverage/coverage |
||||||
|
source = @ROOT@/mesonbuild/ |
||||||
|
|
||||||
|
[report] |
||||||
|
exclude_lines = |
||||||
|
if T.TYPE_CHECKING: |
||||||
|
|
||||||
|
[paths] |
||||||
|
mesonbuild = |
||||||
|
mesonbuild/ |
||||||
|
__w/meson/meson/mesonbuild/ |
||||||
|
@ROOT@/mesonbuild/ |
||||||
|
|
||||||
|
[html] |
||||||
|
directory = @ROOT@/.coverage/html |
||||||
|
|
||||||
|
[xml] |
||||||
|
output = @ROOT@/.coverage/coverage.xml |
||||||
|
|
||||||
|
[json] |
||||||
|
output = @ROOT@/.coverage/coverage.json |
@ -0,0 +1,53 @@ |
|||||||
|
#!/usr/bin/env python3 |
||||||
|
# Copyright 2021 The Meson development team |
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
# you may not use this file except in compliance with the License. |
||||||
|
# You may obtain a copy of the License at |
||||||
|
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
|
||||||
|
# Unless required by applicable law or agreed to in writing, software |
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
# See the License for the specific language governing permissions and |
||||||
|
# limitations under the License. |
||||||
|
|
||||||
|
import subprocess |
||||||
|
import coverage |
||||||
|
import os |
||||||
|
import sys |
||||||
|
from pathlib import Path |
||||||
|
|
||||||
|
root_path = Path(__file__).parent.parent.absolute() |
||||||
|
|
||||||
|
# Python magic so we can import mesonlib |
||||||
|
sys.path.append(root_path.as_posix()) |
||||||
|
from mesonbuild import mesonlib |
||||||
|
|
||||||
|
def generate_coveragerc() -> Path: |
||||||
|
i_file = (root_path / 'data' / '.coveragerc.in') |
||||||
|
o_file = (root_path / '.coveragerc') |
||||||
|
raw = i_file.read_text() |
||||||
|
raw = raw.replace('@ROOT@', root_path.as_posix()) |
||||||
|
o_file.write_text(raw) |
||||||
|
return o_file |
||||||
|
|
||||||
|
def main() -> int: |
||||||
|
# Remove old run data |
||||||
|
out_dir = root_path / '.coverage' |
||||||
|
mesonlib.windows_proof_rmtree(out_dir.as_posix()) |
||||||
|
out_dir.mkdir(parents=True, exist_ok=True) |
||||||
|
|
||||||
|
# Setup coverage |
||||||
|
python_path = (root_path / 'ci').as_posix() |
||||||
|
os.environ['PYTHONPATH'] = os.pathsep.join([python_path, os.environ.get('PYTHONPATH', '')]) |
||||||
|
os.environ['COVERAGE_PROCESS_START'] = generate_coveragerc().as_posix() |
||||||
|
coverage.process_startup() |
||||||
|
|
||||||
|
# Run the actual command |
||||||
|
cmd = mesonlib.python_command + sys.argv[1:] |
||||||
|
return subprocess.run(cmd, env=os.environ.copy()).returncode |
||||||
|
|
||||||
|
if __name__ == '__main__': |
||||||
|
raise SystemExit(main()) |
Loading…
Reference in new issue