forked from OSchip/llvm-project
[analyzer] Fix scan-build and exploded-graph-rewriter tests on Windows.
Detect script locations in a more straightforward way: we don't need to search for them because we know exactly where they are anyway. Fix a file path escaping issue in exploded-graph-rewriter with Windows backslashes in the path. 'REQUIRES: shell' remains in scan-build tests for now, so that to observe the buildbot reaction on removing it in a cleaner experiment. Patch by Denys Petrov! Differential Revision: https://reviews.llvm.org/D76768
This commit is contained in:
parent
b36c19bc4f
commit
2ddd3325c4
|
@ -97,9 +97,13 @@ inline void printSourceLocationAsJson(raw_ostream &Out, SourceLocation Loc,
|
||||||
// The macro expansion and spelling pos is identical for file locs.
|
// The macro expansion and spelling pos is identical for file locs.
|
||||||
if (AddBraces)
|
if (AddBraces)
|
||||||
Out << "{ ";
|
Out << "{ ";
|
||||||
|
std::string filename(PLoc.getFilename());
|
||||||
|
#ifdef _WIN32 // Handle windows-specific path delimiters.
|
||||||
|
std::replace(filename.begin(), filename.end(), '\\', '/');
|
||||||
|
#endif
|
||||||
Out << "\"line\": " << PLoc.getLine()
|
Out << "\"line\": " << PLoc.getLine()
|
||||||
<< ", \"column\": " << PLoc.getColumn()
|
<< ", \"column\": " << PLoc.getColumn()
|
||||||
<< ", \"file\": \"" << PLoc.getFilename() << "\"";
|
<< ", \"file\": \"" << filename << "\"";
|
||||||
if (AddBraces)
|
if (AddBraces)
|
||||||
Out << " }";
|
Out << " }";
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// CHECK: <b>Checker State: </b>
|
// CHECK: <b>Checker State: </b>
|
||||||
// CHECK-SAME: <td align="left"><i>alpha.core.FooChecker</i>:</td>
|
// CHECK-SAME: <td align="left"><i>alpha.core.FooChecker</i>:</td>
|
||||||
// CHECK-SAME: <td align="left">Foo stuff:</td>
|
// CHECK-SAME: <td align="left">Foo stuff:</td>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
Node0x1 [shape=record,label=
|
Node0x1 [shape=record,label=
|
||||||
"{
|
"{
|
||||||
{ "state_id": 2,
|
{ "state_id": 2,
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// CHECK: <tr><td align="left"><b>Ranges: </b></td></tr>
|
// CHECK: <tr><td align="left"><b>Ranges: </b></td></tr>
|
||||||
// CHECK-SAME: <tr><td align="left"><table border="0">
|
// CHECK-SAME: <tr><td align="left"><table border="0">
|
||||||
// CHECK-SAME: <tr>
|
// CHECK-SAME: <tr>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
Node0x1 [shape=record,label=
|
Node0x1 [shape=record,label=
|
||||||
"{
|
"{
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
||||||
// REQUIRES: asserts
|
// REQUIRES: asserts
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
struct S {};
|
struct S {};
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// RUN: %exploded_graph_rewriter %s | FileCheck %s -check-prefix=LIGHT
|
// RUN: %exploded_graph_rewriter %s | FileCheck %s -check-prefix=LIGHT
|
||||||
// RUN: %exploded_graph_rewriter --dark %s | FileCheck %s -check-prefixes=DARK
|
// RUN: %exploded_graph_rewriter --dark %s | FileCheck %s -check-prefixes=DARK
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
Node0x1 [shape=record,label=
|
Node0x1 [shape=record,label=
|
||||||
"{{ "state_id": 0, "program_state": null, "program_points": [
|
"{{ "state_id": 0, "program_state": null, "program_points": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
// RUN: %exploded_graph_rewriter --dark %s | FileCheck %s \
|
// RUN: %exploded_graph_rewriter --dark %s | FileCheck %s \
|
||||||
// RUN: -check-prefixes=CHECK,DARK
|
// RUN: -check-prefixes=CHECK,DARK
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
digraph "Exploded Graph" {
|
digraph "Exploded Graph" {
|
||||||
label="Exploded Graph";
|
label="Exploded Graph";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// CHECK: <b>Expressions: </b>
|
// CHECK: <b>Expressions: </b>
|
||||||
// CHECK-SAME: <table border="0">
|
// CHECK-SAME: <table border="0">
|
||||||
// CHECK-SAME: <tr>
|
// CHECK-SAME: <tr>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// No diffs on the first node, nothing to check.
|
// No diffs on the first node, nothing to check.
|
||||||
Node0x1 [shape=record,label=
|
Node0x1 [shape=record,label=
|
||||||
"{
|
"{
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
||||||
// REQUIRES: asserts
|
// REQUIRES: asserts
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
void escapes() {
|
void escapes() {
|
||||||
// CHECK: <td align="left"><b>Store: </b> <font color="gray">(0x{{[0-9a-f]*}})</font></td>
|
// CHECK: <td align="left"><b>Store: </b> <font color="gray">(0x{{[0-9a-f]*}})</font></td>
|
||||||
// CHECK-SAME: <td align="left">foo</td><td align="left">0</td>
|
// CHECK-SAME: <td align="left">foo</td><td align="left">0</td>
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
||||||
// REQUIRES: asserts
|
// REQUIRES: asserts
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
struct A {
|
struct A {
|
||||||
A() {}
|
A() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,9 +10,8 @@ config.test_format = lit.formats.ShTest(use_lit_shell == "0")
|
||||||
config.substitutions.append(('%exploded_graph_rewriter',
|
config.substitutions.append(('%exploded_graph_rewriter',
|
||||||
'\'%s\' %s --dump-dot-only' % (
|
'\'%s\' %s --dump-dot-only' % (
|
||||||
config.python_executable,
|
config.python_executable,
|
||||||
lit.util.which('exploded-graph-rewriter.py',
|
|
||||||
os.path.join(
|
os.path.join(
|
||||||
config.clang_src_dir,
|
config.clang_src_dir,
|
||||||
'utils', 'analyzer')))))
|
'utils', 'analyzer', 'exploded-graph-rewriter.py'))))
|
||||||
|
|
||||||
config.suffixes.add('.dot')
|
config.suffixes.add('.dot')
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
#define NULL 0
|
||||||
|
void *foo() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The code above shall go first, because check tags below are sensetive to the line numbers on which the code is placed.
|
||||||
|
// You can change lines below in the way you need.
|
||||||
|
|
||||||
// FIXME: Figure out how to use %clang_analyze_cc1 with our lit.local.cfg.
|
// FIXME: Figure out how to use %clang_analyze_cc1 with our lit.local.cfg.
|
||||||
// RUN: %clang_cc1 -analyze -triple x86_64-unknown-linux-gnu \
|
// RUN: %clang_cc1 -analyze -triple x86_64-unknown-linux-gnu \
|
||||||
// RUN: -analyzer-checker=core \
|
// RUN: -analyzer-checker=core \
|
||||||
|
@ -5,14 +13,7 @@
|
||||||
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
||||||
// REQUIRES: asserts
|
// REQUIRES: asserts
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
// CHECK: macros.c:<b>3</b>:<b>10</b>
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// CHECK: macros.c:<b>17</b>:<b>10</b>
|
|
||||||
// CHECK-SAME: <font color="royalblue1">
|
// CHECK-SAME: <font color="royalblue1">
|
||||||
// CHECK-SAME: (<i>spelling at </i> macros.c:<b>15</b>:<b>14</b>)
|
// CHECK-SAME: (<i>spelling at </i> macros.c:<b>1</b>:<b>14</b>)
|
||||||
// CHECK-SAME: </font>
|
// CHECK-SAME: </font>
|
||||||
#define NULL 0
|
|
||||||
void *foo() {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
// RUN: %exploded_graph_rewriter %s --gray --dark \
|
// RUN: %exploded_graph_rewriter %s --gray --dark \
|
||||||
// RUN: | FileCheck %s -check-prefixes CHECK,DARK,GRAY
|
// RUN: | FileCheck %s -check-prefixes CHECK,DARK,GRAY
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// LIGHT: Node0x1 [shape=record,label=<
|
// LIGHT: Node0x1 [shape=record,label=<
|
||||||
// DARK: Node0x1 [shape=record,color="white",fontcolor="gray80",label=<
|
// DARK: Node0x1 [shape=record,color="white",fontcolor="gray80",label=<
|
||||||
// CHECK-SAME: <tr>
|
// CHECK-SAME: <tr>
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
// RUN: %exploded_graph_rewriter %t.dot | FileCheck %s
|
||||||
// REQUIRES: asserts
|
// REQUIRES: asserts
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
struct S {
|
struct S {
|
||||||
S() {}
|
S() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// CHECK: <b>Program points:</b>
|
// CHECK: <b>Program points:</b>
|
||||||
// CHECK-SAME: <table border="0" align="left" width="0">
|
// CHECK-SAME: <table border="0" align="left" width="0">
|
||||||
// CHECK-SAME: <tr>
|
// CHECK-SAME: <tr>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// CHECK: <b>Store: </b>
|
// CHECK: <b>Store: </b>
|
||||||
// CHECK-SAME: <font color="gray">(0x2)</font>
|
// CHECK-SAME: <font color="gray">(0x2)</font>
|
||||||
// CHECK-SAME: <table border="0">
|
// CHECK-SAME: <table border="0">
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
// RUN: %exploded_graph_rewriter -d %s | FileCheck %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
Node0x1 [shape=record,label=
|
Node0x1 [shape=record,label=
|
||||||
"{
|
"{
|
||||||
{ "node_id": 1,
|
{ "node_id": 1,
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
// RUN: %exploded_graph_rewriter -t %s \
|
// RUN: %exploded_graph_rewriter -t %s \
|
||||||
// RUN: | FileCheck -check-prefixes=TOPOLOGY %s
|
// RUN: | FileCheck -check-prefixes=TOPOLOGY %s
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
// NORMAL: Program point
|
// NORMAL: Program point
|
||||||
// TOPOLOGY-NOT: Program point
|
// TOPOLOGY-NOT: Program point
|
||||||
// NORMAL: Checker State
|
// NORMAL: Checker State
|
||||||
|
|
|
@ -13,9 +13,6 @@
|
||||||
// RUN: %exploded_graph_rewriter --to 4 -s %s \
|
// RUN: %exploded_graph_rewriter --to 4 -s %s \
|
||||||
// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
|
// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
|
||||||
|
|
||||||
// FIXME: Substitution doesn't seem to work on Windows.
|
|
||||||
// UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
Node0x1 [shape=record,label=
|
Node0x1 [shape=record,label=
|
||||||
"{{ "state_id": 0, "program_state": null, "program_points": [
|
"{{ "state_id": 0, "program_state": null, "program_points": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// FIXME: Actually, "perl".
|
// FIXME: Actually, "perl".
|
||||||
REQUIRES: shell
|
REQUIRES: shell
|
||||||
|
|
||||||
// FIXME: Should ideally work on Windows.
|
|
||||||
UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
||||||
RUN: %scan-build -o %t.output_dir %clang -S \
|
RUN: %scan-build -o %t.output_dir %clang -S \
|
||||||
RUN: %S/Inputs/multidirectory_project/directory1/file1.c \
|
RUN: %S/Inputs/multidirectory_project/directory1/file1.c \
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// FIXME: Actually, "perl".
|
// FIXME: Actually, "perl".
|
||||||
REQUIRES: shell
|
REQUIRES: shell
|
||||||
|
|
||||||
// FIXME: Should ideally work on Windows.
|
|
||||||
UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
RUN: %scan-build -h | FileCheck %s
|
RUN: %scan-build -h | FileCheck %s
|
||||||
RUN: %scan-build --help | FileCheck %s
|
RUN: %scan-build --help | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// FIXME: Actually, "perl".
|
// FIXME: Actually, "perl".
|
||||||
REQUIRES: shell
|
REQUIRES: shell
|
||||||
|
|
||||||
// FIXME: Should ideally work on Windows.
|
|
||||||
UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
||||||
RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \
|
RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \
|
||||||
RUN: | FileCheck %s -check-prefix CHECK-STDOUT
|
RUN: | FileCheck %s -check-prefix CHECK-STDOUT
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// FIXME: Actually, "perl".
|
// FIXME: Actually, "perl".
|
||||||
REQUIRES: shell
|
REQUIRES: shell
|
||||||
|
|
||||||
// FIXME: Should ideally work on Windows.
|
|
||||||
UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
||||||
RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \
|
RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \
|
||||||
RUN: | FileCheck %s -check-prefix CHECK-STDOUT
|
RUN: | FileCheck %s -check-prefix CHECK-STDOUT
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// FIXME: Actually, "perl".
|
// FIXME: Actually, "perl".
|
||||||
REQUIRES: shell
|
REQUIRES: shell
|
||||||
|
|
||||||
// FIXME: Should ideally work on Windows.
|
|
||||||
UNSUPPORTED: system-windows
|
|
||||||
|
|
||||||
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
RUN: rm -rf %t.output_dir && mkdir %t.output_dir
|
||||||
RUN: %scan-build -plist -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \
|
RUN: %scan-build -plist -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \
|
||||||
RUN: | FileCheck %s -check-prefix CHECK-STDOUT
|
RUN: | FileCheck %s -check-prefix CHECK-STDOUT
|
||||||
|
|
Loading…
Reference in New Issue