• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1########################
2# Test "report" command.
3########################
4# Ignore all header files.
5RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
6RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*\.h$' \
7RUN:   %S/Inputs/sources_specified/main.covmapping \
8RUN:   | FileCheck -check-prefix=REPORT_IGNORE_HEADERS %s
9
10REPORT_IGNORE_HEADERS-NOT: {{.*}}dec.h{{.*}}
11REPORT_IGNORE_HEADERS-NOT: {{.*}}inc.h{{.*}}
12REPORT_IGNORE_HEADERS-NOT: {{.*}}abs.h{{.*}}
13REPORT_IGNORE_HEADERS: {{^}}TOTAL 1{{.*}}100.00%{{$}}
14
15# Ignore all files from "extra" directory.
16RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
17RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*extra[/\\].*' \
18RUN:   %S/Inputs/sources_specified/main.covmapping \
19RUN:   | FileCheck -check-prefix=REPORT_IGNORE_DIR %s
20
21REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
22REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
23REPORT_IGNORE_DIR: {{.*}}abs.h{{.*}}
24REPORT_IGNORE_DIR: {{.*}}main.cc{{.*}}
25REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}90.00%{{$}}
26
27# Ignore all files from "extra" directory even when SOURCES specified.
28RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
29RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*extra[/\\].*' \
30RUN:   %S/Inputs/sources_specified/main.covmapping \
31RUN:   %S/Inputs/sources_specified/extra %S/Inputs/sources_specified/abs.h \
32RUN:   | FileCheck -check-prefix=REPORT_IGNORE_DIR_WITH_SOURCES %s
33
34REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
35REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
36REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}main.cc{{.*}}
37REPORT_IGNORE_DIR_WITH_SOURCES: {{.*}}abs.h{{.*}}
38REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}80.00%{{$}}
39
40########################
41# Test "show" command.
42########################
43# Ignore all ".cc" files.
44RUN: llvm-cov show -instr-profile %S/Inputs/sources_specified/main.profdata \
45RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*\.cc$' \
46RUN:   %S/Inputs/sources_specified/main.covmapping \
47RUN:   | FileCheck -check-prefix=SHOW_IGNORE_CC %s
48
49# Order of files may differ, check that there are 3 files and not abs.h.
50SHOW_IGNORE_CC-NOT: {{.*}}main.cc{{.*}}
51SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
52SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
53SHOW_IGNORE_CC: {{.*}}sources_specified{{.*}}
54
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".
60RUN: llvm-cov export -instr-profile %S/Inputs/sources_specified/main.profdata \
61RUN:   -path-equivalence=/tmp,%S/Inputs -ignore-filename-regex='.*...\.h$' \
62RUN:   %S/Inputs/sources_specified/main.covmapping \
63RUN:   > %t.export.json
64
65RUN: FileCheck -check-prefix=NO-EXPORT_IGNORE_3_SYMBOLS_H %s < %t.export.json
66RUN: FileCheck -check-prefix=EXPORT_IGNORE_3_SYMBOLS_H %s < %t.export.json
67
68NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)abs.h"}}
69NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)inc.h"}}
70NO-EXPORT_IGNORE_3_SYMBOLS_H-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)dec.h"}}
71EXPORT_IGNORE_3_SYMBOLS_H: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)main.cc"}}
72