Skip to content

Commit afa4b6d

Browse files
committed
Make paths test an inline expectations test
1 parent 5490f3a commit afa4b6d

33 files changed

+302
-158
lines changed

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_IEmbedI1_subtypes_true.expected

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1+
testFailures
12
invalidModelRow
2-
paths
3-
| test.go:8:7:8:16 | call to Source | test.go:10:9:10:9 | y |
4-
| test.go:14:7:14:16 | call to Source | test.go:16:9:16:9 | y |
5-
| test.go:20:7:20:16 | call to Source | test.go:22:9:22:9 | y |
6-
| test.go:26:7:26:16 | call to Source | test.go:28:9:28:9 | y |
7-
| test.go:32:7:32:16 | call to Source | test.go:34:9:34:9 | y |
8-
| test.go:38:7:38:16 | call to Source | test.go:40:9:40:9 | y |
9-
| test.go:44:7:44:16 | call to Source | test.go:46:9:46:9 | y |
10-
| test.go:50:7:50:16 | call to Source | test.go:52:9:52:9 | y |
11-
| test.go:56:7:56:16 | call to Source | test.go:58:9:58:9 | y |
12-
| test.go:62:7:62:16 | call to Source | test.go:64:9:64:9 | y |
13-
| test.go:68:7:68:16 | call to Source | test.go:70:9:70:9 | y |
14-
| test.go:74:7:74:16 | call to Source | test.go:76:9:76:9 | y |
15-
| test.go:80:7:80:16 | call to Source | test.go:82:9:82:9 | y |
16-
| test.go:86:7:86:16 | call to Source | test.go:88:9:88:9 | y |
3+
failures
174
sources
185
| test.go:8:7:8:16 | call to Source |
196
| test.go:14:7:14:16 | call to Source |

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_IEmbedI1_subtypes_true.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import go
22
import semmle.go.dataflow.ExternalFlow
33
import ModelValidation
44
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
5+
import TestUtilities.InlineExpectationsTest
6+
import MakeTest<FlowTest>
57

68
module Config implements DataFlow::ConfigSig {
79
predicate isSource(DataFlow::Node source) { sources(source) }
810

911
predicate isSink(DataFlow::Node sink) { sinks(sink) }
1012
}
1113

12-
module Flow = DataFlow::Global<Config>;
14+
module Flow = TaintTracking::Global<Config>;
1315

14-
query predicate paths(DataFlow::Node source, DataFlow::Node sink) { Flow::flow(source, sink) }
16+
module FlowTest implements TestSig {
17+
string getARelevantTag() { result = "IEmbedI1[t]" }
18+
19+
predicate hasActualResult(Location location, string element, string tag, string value) {
20+
tag = "IEmbedI1[t]" and
21+
exists(DataFlow::Node sink | Flow::flowTo(sink) |
22+
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
23+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
24+
element = sink.toString() and
25+
value = ""
26+
)
27+
}
28+
}
1529

1630
query predicate sources(DataFlow::Node source) { source instanceof RemoteFlowSource }
1731

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_IEmbedI2_subtypes_true.expected

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1+
testFailures
12
invalidModelRow
2-
paths
3-
| test.go:14:7:14:16 | call to Source | test.go:16:9:16:9 | y |
4-
| test.go:26:7:26:16 | call to Source | test.go:28:9:28:9 | y |
5-
| test.go:38:7:38:16 | call to Source | test.go:40:9:40:9 | y |
6-
| test.go:50:7:50:16 | call to Source | test.go:52:9:52:9 | y |
7-
| test.go:62:7:62:16 | call to Source | test.go:64:9:64:9 | y |
8-
| test.go:74:7:74:16 | call to Source | test.go:76:9:76:9 | y |
9-
| test.go:86:7:86:16 | call to Source | test.go:88:9:88:9 | y |
3+
failures
104
sources
115
| test.go:14:7:14:16 | call to Source |
126
| test.go:26:7:26:16 | call to Source |

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_IEmbedI2_subtypes_true.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import go
22
import semmle.go.dataflow.ExternalFlow
33
import ModelValidation
44
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
5+
import TestUtilities.InlineExpectationsTest
6+
import MakeTest<FlowTest>
57

68
module Config implements DataFlow::ConfigSig {
79
predicate isSource(DataFlow::Node source) { sources(source) }
810

911
predicate isSink(DataFlow::Node sink) { sinks(sink) }
1012
}
1113

12-
module Flow = DataFlow::Global<Config>;
14+
module Flow = TaintTracking::Global<Config>;
1315

14-
query predicate paths(DataFlow::Node source, DataFlow::Node sink) { Flow::flow(source, sink) }
16+
module FlowTest implements TestSig {
17+
string getARelevantTag() { result = "IEmbedI2[t]" }
18+
19+
predicate hasActualResult(Location location, string element, string tag, string value) {
20+
tag = "IEmbedI2[t]" and
21+
exists(DataFlow::Node sink | Flow::flowTo(sink) |
22+
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
23+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
24+
element = sink.toString() and
25+
value = ""
26+
)
27+
}
28+
}
1529

1630
query predicate sources(DataFlow::Node source) { source instanceof RemoteFlowSource }
1731

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_SEmbedI1_subtypes_true.expected

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1+
testFailures
12
invalidModelRow
2-
paths
3-
| test.go:8:7:8:16 | call to Source | test.go:10:9:10:9 | y |
4-
| test.go:14:7:14:16 | call to Source | test.go:16:9:16:9 | y |
5-
| test.go:20:7:20:16 | call to Source | test.go:22:9:22:9 | y |
6-
| test.go:26:7:26:16 | call to Source | test.go:28:9:28:9 | y |
7-
| test.go:32:7:32:16 | call to Source | test.go:34:9:34:9 | y |
8-
| test.go:38:7:38:16 | call to Source | test.go:40:9:40:9 | y |
9-
| test.go:44:7:44:16 | call to Source | test.go:46:9:46:9 | y |
10-
| test.go:50:7:50:16 | call to Source | test.go:52:9:52:9 | y |
11-
| test.go:56:7:56:16 | call to Source | test.go:58:9:58:9 | y |
12-
| test.go:62:7:62:16 | call to Source | test.go:64:9:64:9 | y |
13-
| test.go:68:7:68:16 | call to Source | test.go:70:9:70:9 | y |
14-
| test.go:74:7:74:16 | call to Source | test.go:76:9:76:9 | y |
15-
| test.go:80:7:80:16 | call to Source | test.go:82:9:82:9 | y |
16-
| test.go:86:7:86:16 | call to Source | test.go:88:9:88:9 | y |
3+
failures
174
sources
185
| test.go:8:7:8:16 | call to Source |
196
| test.go:14:7:14:16 | call to Source |

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_SEmbedI1_subtypes_true.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import go
22
import semmle.go.dataflow.ExternalFlow
33
import ModelValidation
44
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
5+
import TestUtilities.InlineExpectationsTest
6+
import MakeTest<FlowTest>
57

68
module Config implements DataFlow::ConfigSig {
79
predicate isSource(DataFlow::Node source) { sources(source) }
810

911
predicate isSink(DataFlow::Node sink) { sinks(sink) }
1012
}
1113

12-
module Flow = DataFlow::Global<Config>;
14+
module Flow = TaintTracking::Global<Config>;
1315

14-
query predicate paths(DataFlow::Node source, DataFlow::Node sink) { Flow::flow(source, sink) }
16+
module FlowTest implements TestSig {
17+
string getARelevantTag() { result = "SEmbedI1[t]" }
18+
19+
predicate hasActualResult(Location location, string element, string tag, string value) {
20+
tag = "SEmbedI1[t]" and
21+
exists(DataFlow::Node sink | Flow::flowTo(sink) |
22+
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
23+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
24+
element = sink.toString() and
25+
value = ""
26+
)
27+
}
28+
}
1529

1630
query predicate sources(DataFlow::Node source) { source instanceof RemoteFlowSource }
1731

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_SEmbedI2_subtypes_true.expected

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1+
testFailures
12
invalidModelRow
2-
paths
3-
| test.go:14:7:14:16 | call to Source | test.go:16:9:16:9 | y |
4-
| test.go:26:7:26:16 | call to Source | test.go:28:9:28:9 | y |
5-
| test.go:38:7:38:16 | call to Source | test.go:40:9:40:9 | y |
6-
| test.go:50:7:50:16 | call to Source | test.go:52:9:52:9 | y |
7-
| test.go:62:7:62:16 | call to Source | test.go:64:9:64:9 | y |
8-
| test.go:74:7:74:16 | call to Source | test.go:76:9:76:9 | y |
9-
| test.go:86:7:86:16 | call to Source | test.go:88:9:88:9 | y |
3+
failures
104
sources
115
| test.go:14:7:14:16 | call to Source |
126
| test.go:26:7:26:16 | call to Source |

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_SEmbedI2_subtypes_true.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import go
22
import semmle.go.dataflow.ExternalFlow
33
import ModelValidation
44
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
5+
import TestUtilities.InlineExpectationsTest
6+
import MakeTest<FlowTest>
57

68
module Config implements DataFlow::ConfigSig {
79
predicate isSource(DataFlow::Node source) { sources(source) }
810

911
predicate isSink(DataFlow::Node sink) { sinks(sink) }
1012
}
1113

12-
module Flow = DataFlow::Global<Config>;
14+
module Flow = TaintTracking::Global<Config>;
1315

14-
query predicate paths(DataFlow::Node source, DataFlow::Node sink) { Flow::flow(source, sink) }
16+
module FlowTest implements TestSig {
17+
string getARelevantTag() { result = "SEmbedI2[t]" }
18+
19+
predicate hasActualResult(Location location, string element, string tag, string value) {
20+
tag = "SEmbedI2[t]" and
21+
exists(DataFlow::Node sink | Flow::flowTo(sink) |
22+
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
23+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
24+
element = sink.toString() and
25+
value = ""
26+
)
27+
}
28+
}
1529

1630
query predicate sources(DataFlow::Node source) { source instanceof RemoteFlowSource }
1731

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
testFailures
12
invalidModelRow
2-
paths
3+
failures
34
sources
45
sinks

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlowInheritance/mad_SEmbedS1_subtypes_true.ql

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import go
22
import semmle.go.dataflow.ExternalFlow
33
import ModelValidation
44
import semmle.go.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
5+
import TestUtilities.InlineExpectationsTest
6+
import MakeTest<FlowTest>
57

68
module Config implements DataFlow::ConfigSig {
79
predicate isSource(DataFlow::Node source) { sources(source) }
810

911
predicate isSink(DataFlow::Node sink) { sinks(sink) }
1012
}
1113

12-
module Flow = DataFlow::Global<Config>;
14+
module Flow = TaintTracking::Global<Config>;
1315

14-
query predicate paths(DataFlow::Node source, DataFlow::Node sink) { Flow::flow(source, sink) }
16+
module FlowTest implements TestSig {
17+
string getARelevantTag() { result = "SEmbedS1[t]" }
18+
19+
predicate hasActualResult(Location location, string element, string tag, string value) {
20+
tag = "SEmbedS1[t]" and
21+
exists(DataFlow::Node sink | Flow::flowTo(sink) |
22+
sink.hasLocationInfo(location.getFile().getAbsolutePath(), location.getStartLine(),
23+
location.getStartColumn(), location.getEndLine(), location.getEndColumn()) and
24+
element = sink.toString() and
25+
value = ""
26+
)
27+
}
28+
}
1529

1630
query predicate sources(DataFlow::Node source) { source instanceof RemoteFlowSource }
1731

0 commit comments

Comments
 (0)