blob: 5d7a6510a1d900b8b7a9e43c5f9f281df04988d5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/bash
#
# Script to collect the coverage report for the specified contents
# in yql/essentials/core (i.e. type annotation machinery, optimizers)
# to the directory, given as the first argument.
set -eu
ARC_ROOT=$(arc rev-parse --show-toplevel)
# Save the coverage report with to the given directory; otherwise,
# save the list into the temporary file.
REPORT_ROOT=${1:-$(mktemp --tmpdir -d yql-essentials-core-coverage-XXXXXXX)}
# Define the array of the prefixes to be collected to the coverage
# report.
COVERAGE_PREFIXES=(
'yql/essentials/core/type_ann'
)
# XXX: Join the prefixes listed above by a pipe (|) to make a
# valid regexp alternatives for COVERAGE_TARGET_REGEXP parameter.
COVERAGE_PREFIX_ALTERNATIVES=$(IFS='|'; echo "${COVERAGE_PREFIXES[*]}")
# Run the command to collect code coverage over the sources in
# /yql/essentials/core/ by the minirun test suite.
# XXX: Here are the rationales for the particular options:
# * --clang-coverage -- collect the code coverage only for C++
# sources;
# * --coverage-report --output $REPORT_ROOT -- build the HTML
# report for the collected code coverage;
# * -DCOVERAGE_TARGET_REGEXP -- collect the code coverage only
# for the dedicated source files;
# XXX: --coverage-prefix-filter doesn't work properly if several
# paths are given, but fortunately, there is a recipe for C++
# coverage in DEVTOOLSSUPPORT-52275#67093d22473c6c1da0bd17fd, that
# uses -DCOVERAGE_TARGET_REGEXP and allows to specify several
# paths by regexp.
# See more info here: https://docs.yandex-team.ru/devtools/test/coverage.
ya make -tA \
-C ${ARC_ROOT}/yql/essentials/tests/sql/minirun \
-C ${ARC_ROOT}/yql/essentials/tests/s-expressions/minirun \
-DCOVERAGE_TARGET_REGEXP="($COVERAGE_PREFIX_ALTERNATIVES)" \
--build profile \
--clang-coverage \
--coverage-report \
--output ${REPORT_ROOT} \
--test-disable-timeout
# Create an anchor for each prefix, to ensure the analyzer part
# that the coverage for particular prefixes is collected.
for prefix in ${COVERAGE_PREFIXES[@]}; do
COLLECTED_PREFIX=${REPORT_ROOT}/$(basename $0)/$prefix
mkdir -p ${COLLECTED_PREFIX}
touch ${COLLECTED_PREFIX}/collected
done
echo "The coverage report is stored in ${REPORT_ROOT}"
|