1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/tools/llvm-cov/ignore-filename-regex.test
Max Moroz 9ce45136a8 [llvm-cov] Implement -ignore-filename-regex= option for excluding source files.
Summary:
The option is helpful for large projects where it's not feasible to specify sources which
user would like to see in the report. Instead, it allows to black-list specific sources via
regular expressions (e.g. now it's possible to skip all files that have "test" in its name).

This also partially fixes https://bugs.llvm.org/show_bug.cgi?id=34277

Reviewers: vsk, morehouse, liaoyuke

Reviewed By: vsk

Subscribers: kcc, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D43907

llvm-svn: 329581
2018-04-09 15:20:35 +00:00

72 lines
3.4 KiB
Plaintext

########################
# Test "report" command.
########################
# Ignore all header files.
RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
RUN: -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*\.h$' \
RUN: %S/Inputs/sources_specified/main.covmapping \
RUN: | FileCheck -check-prefix=REPORT_IGNORE_HEADERS %s
REPORT_IGNORE_HEADERS-NOT: {{.*}}dec.h{{.*}}
REPORT_IGNORE_HEADERS-NOT: {{.*}}inc.h{{.*}}
REPORT_IGNORE_HEADERS-NOT: {{.*}}abs.h{{.*}}
REPORT_IGNORE_HEADERS: {{^}}TOTAL 1{{.*}}100.00%{{$}}
# Ignore all files from "extra" directory.
RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
RUN: -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*extra[/\\].*' \
RUN: %S/Inputs/sources_specified/main.covmapping \
RUN: | FileCheck -check-prefix=REPORT_IGNORE_DIR %s
REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
REPORT_IGNORE_DIR: {{.*}}abs.h{{.*}}
REPORT_IGNORE_DIR: {{.*}}main.cc{{.*}}
REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}100.00%{{$}}
# Ignore all files from "extra" directory even when SOURCES specified.
RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
RUN: -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*extra[/\\].*' \
RUN: %S/Inputs/sources_specified/main.covmapping \
RUN: %S/Inputs/sources_specified/extra %S/Inputs/sources_specified/abs.h \
RUN: | FileCheck -check-prefix=REPORT_IGNORE_DIR_WITH_SOURCES %s
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}main.cc{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES: {{.*}}abs.h{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}100.00%{{$}}
########################
# Test "show" command.
########################
# Ignore all ".cc" files.
RUN: llvm-cov show -instr-profile %S/Inputs/sources_specified/main.profdata \
RUN: -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*\.cc$' \
RUN: %S/Inputs/sources_specified/main.covmapping \
RUN: | FileCheck -check-prefix=SHOW_IGNORE_CC %s
# Order of files may differ, check that there are 3 files and not abs.h.
SHOW_IGNORE_CC-NOT: {{.*}}main.cc{{.*}}
SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
########################
# Test "export" command.
########################
# Use a temp .json file as output in a single line. Ignore headers that have
# name in a format of 3 symbols followed by ".h".
RUN: llvm-cov export -instr-profile %S/Inputs/sources_specified/main.profdata \
RUN: -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*...\.h$' \
RUN: %S/Inputs/sources_specified/main.covmapping \
RUN: > %t.export.json
RUN: FileCheck -check-prefix=NO-EXPORT_IGNORE_3_SYMBOLS_H %s < %t.export.json
RUN: FileCheck -check-prefix=EXPORT_IGNORE_3_SYMBOLS_H %s < %t.export.json
NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)abs.h"}}
NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)inc.h"}}
NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)dec.h"}}
EXPORT_IGNORE_3_SYMBOLS_H: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)main.cc"}}