ignore-filename-regex.test
3.36 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
########################
# 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"}}