diff options
Diffstat (limited to 'yql/essentials/core')
-rwxr-xr-x | yql/essentials/core/type_ann/type-ann-coverage.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/yql/essentials/core/type_ann/type-ann-coverage.sh b/yql/essentials/core/type_ann/type-ann-coverage.sh new file mode 100755 index 0000000000..0858a7b4e4 --- /dev/null +++ b/yql/essentials/core/type_ann/type-ann-coverage.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Script to collect the type annotation callbacks, being uncovered +# by minirun test suite. Pass the filename as the first argument +# to store the collected list to the particular file. +set -eu + +ARC_ROOT=$(arc rev-parse --show-toplevel) +REPORT_ROOT=$(mktemp -p $TMPDIR -d yql-essentials-core-type_ann-coverage-XXXXXXX) +# Save the list with uncovered callbacks into the file, that is +# given by the first parameter of this script; otherwise, save +# the list into the temporary file. +UNCOVERED_FILE=${1:-$(mktemp -p $TMPDIR yql-essentials-core-type_ann-uncovered-XXXXXXX.list)} + +# Run the command to collect code coverage over the sources in +# /yql/essentials/core/type_ann 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-prefix-filter -- collect the code coverage only +# for the dedicated source files; +# * --coverage-report --output $REPORT_ROOT -- build the HTML +# report for the collected code coverage; +# See more info here: https://docs.yandex-team.ru/devtools/test/coverage. +ya make -tA -C ${ARC_ROOT}/yql/essentials/tests/sql/minirun/ \ + --build profile \ + --clang-coverage \ + --coverage-prefix-filter yql/essentials/core/type_ann \ + --coverage-report \ + --output $REPORT_ROOT \ + --test-disable-timeout + +# Find an anchor to uncovered line in HTML report, ... +UNCOVERED_ANCHOR="<td class='uncovered-line'><pre>0</pre></td>" +# ... find the return type of the type annotation callback, +# preceding the target function name ... +# XXX: See more info re \K here: https://perldoc.perl.org/perlre#%5CK. +CALLBACK_PREFIX="<td class='code'><pre>\s*IGraphTransformer::TStatus\s*\K" +# ... and find the parameters types of the type annotation +# callback, following the target function name. +CALLBACK_SUFFIX="(?=\(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx\))" +grep -oP "$UNCOVERED_ANCHOR$CALLBACK_PREFIX(\w+)$CALLBACK_SUFFIX" \ + -r $REPORT_ROOT/coverage.report/ \ + --no-filename \ + | tee -a $UNCOVERED_FILE + +rm -rf $REPORT_ROOT +echo "The list of the uncovered functions: $UNCOVERED_FILE" |