[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / test / tools / llvm-cov / ignore-filename-regex.test
blobaea9e4646776d15bf53938d98a3bf272698a2c2f
1 ########################
2 # Test "report" command.
3 ########################
4 # Ignore all header files.
5 RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
6 RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*\.h$' \
7 RUN:   %S/Inputs/sources_specified/main.covmapping --show-branch-summary=false \
8 RUN:   | FileCheck -check-prefix=REPORT_IGNORE_HEADERS %s
10 REPORT_IGNORE_HEADERS-NOT: {{.*}}dec.h{{.*}}
11 REPORT_IGNORE_HEADERS-NOT: {{.*}}inc.h{{.*}}
12 REPORT_IGNORE_HEADERS-NOT: {{.*}}abs.h{{.*}}
13 REPORT_IGNORE_HEADERS: {{^}}TOTAL 1{{.*}}100.00%{{$}}
15 # Ignore all files from "extra" directory.
16 RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
17 RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*extra[/\\].*' \
18 RUN:   %S/Inputs/sources_specified/main.covmapping --show-branch-summary=false \
19 RUN:   | FileCheck -check-prefix=REPORT_IGNORE_DIR %s
21 REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
22 REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
23 REPORT_IGNORE_DIR: {{.*}}abs.h{{.*}}
24 REPORT_IGNORE_DIR: {{.*}}main.cc{{.*}}
25 REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}100.00%{{$}}
27 # Ignore all files from "extra" directory even when SOURCES specified.
28 RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
29 RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*extra[/\\].*' \
30 RUN:   %S/Inputs/sources_specified/main.covmapping --show-branch-summary=false \
31 RUN:   %S/Inputs/sources_specified/extra %S/Inputs/sources_specified/abs.h \
32 RUN:   | FileCheck -check-prefix=REPORT_IGNORE_DIR_WITH_SOURCES %s
34 REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
35 REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
36 REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}main.cc{{.*}}
37 REPORT_IGNORE_DIR_WITH_SOURCES: {{.*}}abs.h{{.*}}
38 REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}100.00%{{$}}
40 ########################
41 # Test "show" command.
42 ########################
43 # Ignore all ".cc" files.
44 RUN: llvm-cov show -instr-profile %S/Inputs/sources_specified/main.profdata \
45 RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*\.cc$' \
46 RUN:   %S/Inputs/sources_specified/main.covmapping \
47 RUN:   | FileCheck -check-prefix=SHOW_IGNORE_CC %s
49 # Order of files may differ, check that there are 3 files and not abs.h.
50 SHOW_IGNORE_CC-NOT: {{.*}}main.cc{{.*}}
51 SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
52 SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
53 SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
55 ########################
56 # Test "export" command.
57 ########################
58 # Use a temp .json file as output in a single line. Ignore headers that have
59 # name in a format of 3 symbols followed by ".h".
60 RUN: llvm-cov export -instr-profile %S/Inputs/sources_specified/main.profdata \
61 RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*...\.h$' \
62 RUN:   %S/Inputs/sources_specified/main.covmapping \
63 RUN:   > %t.export.json
65 RUN: FileCheck -check-prefix=NO-EXPORT_IGNORE_3_SYMBOLS_H %s < %t.export.json
66 RUN: FileCheck -check-prefix=EXPORT_IGNORE_3_SYMBOLS_H %s < %t.export.json
68 NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)abs.h"}}
69 NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)inc.h"}}
70 NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)dec.h"}}
71 EXPORT_IGNORE_3_SYMBOLS_H: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)main.cc"}}