Skip to content

Commit f9918cc

Browse files
author
Benjamin Muskalla
committed
Test generator uses InlineFlowTest
1 parent e71173d commit f9918cc

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

java/ql/src/utils/testFooter.qlfrag

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +0,0 @@
1-
2-
class ValueFlowConf extends DataFlow::Configuration {
3-
ValueFlowConf() { this = "qltest:valueFlowConf" }
4-
5-
override predicate isSource(DataFlow::Node n) { n.asExpr().(MethodAccess).getMethod().hasName("source") }
6-
7-
override predicate isSink(DataFlow::Node n) { n.asExpr().(Argument).getCall().getCallee().hasName("sink") }
8-
}
9-
10-
class TaintFlowConf extends TaintTracking::Configuration {
11-
TaintFlowConf() { this = "qltest:taintFlowConf" }
12-
13-
override predicate isSource(DataFlow::Node n) { n.asExpr().(MethodAccess).getMethod().hasName("source") }
14-
15-
override predicate isSink(DataFlow::Node n) { n.asExpr().(Argument).getCall().getCallee().hasName("sink") }
16-
}
17-
18-
class HasFlowTest extends InlineExpectationsTest {
19-
HasFlowTest() { this = "HasFlowTest" }
20-
21-
override string getARelevantTag() { result = ["hasValueFlow", "hasTaintFlow"] }
22-
23-
override predicate hasActualResult(Location location, string element, string tag, string value) {
24-
tag = "hasValueFlow" and
25-
exists(DataFlow::Node src, DataFlow::Node sink, ValueFlowConf conf | conf.hasFlow(src, sink) |
26-
sink.getLocation() = location and
27-
element = sink.toString() and
28-
value = ""
29-
)
30-
or
31-
tag = "hasTaintFlow" and
32-
exists(DataFlow::Node src, DataFlow::Node sink, TaintFlowConf conf | conf.hasFlow(src, sink) and not any(ValueFlowConf c).hasFlow(src, sink) |
33-
sink.getLocation() = location and
34-
element = sink.toString() and
35-
value = ""
36-
)
37-
}
38-
}

java/ql/src/utils/testHeader.qlfrag

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
import java
2-
import semmle.code.java.dataflow.DataFlow
3-
import semmle.code.java.dataflow.ExternalFlow
4-
import semmle.code.java.dataflow.TaintTracking
5-
import TestUtilities.InlineExpectationsTest
2+
import TestUtilities.InlineFlowTest

0 commit comments

Comments
 (0)