mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
C++: Add library tests for YML extension models.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
testFailures
|
||||
failures
|
||||
24
cpp/ql/test/library-tests/dataflow/external-models/flow.ql
Normal file
24
cpp/ql/test/library-tests/dataflow/external-models/flow.ql
Normal file
@@ -0,0 +1,24 @@
|
||||
import TestUtilities.dataflow.FlowTestCommon
|
||||
import cpp
|
||||
import semmle.code.cpp.ir.dataflow.DataFlow
|
||||
import semmle.code.cpp.dataflow.ExternalFlow
|
||||
|
||||
module IRTest {
|
||||
private import semmle.code.cpp.ir.IR
|
||||
private import semmle.code.cpp.ir.dataflow.TaintTracking
|
||||
|
||||
/** Common data flow configuration to be used by tests. */
|
||||
module TestAllocationConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) {
|
||||
sourceNode(source, _)
|
||||
}
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
sinkNode(sink, "test-sink")
|
||||
}
|
||||
}
|
||||
|
||||
module IRFlow = TaintTracking::Global<TestAllocationConfig>;
|
||||
}
|
||||
|
||||
import MakeTest<IRFlowTest<IRTest::IRFlow>>
|
||||
@@ -0,0 +1,7 @@
|
||||
import cpp
|
||||
import semmle.code.cpp.ir.dataflow.DataFlow
|
||||
import semmle.code.cpp.dataflow.ExternalFlow
|
||||
|
||||
from DataFlow::Node node, string kind
|
||||
where sinkNode(node, kind)
|
||||
select node, kind
|
||||
@@ -0,0 +1,7 @@
|
||||
import cpp
|
||||
import semmle.code.cpp.ir.dataflow.DataFlow
|
||||
import semmle.code.cpp.dataflow.ExternalFlow
|
||||
|
||||
from DataFlow::Node node, string kind
|
||||
where sourceNode(node, kind)
|
||||
select node, kind
|
||||
@@ -0,0 +1,8 @@
|
||||
import cpp
|
||||
import semmle.code.cpp.ir.dataflow.DataFlow
|
||||
import semmle.code.cpp.dataflow.ExternalFlow
|
||||
import semmle.code.cpp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
|
||||
|
||||
from DataFlow::Node node1, DataFlow::Node node2
|
||||
where FlowSummaryImpl::Private::Steps::summaryThroughStepTaint(node1, node2, _)
|
||||
select node1, node2
|
||||
16
cpp/ql/test/library-tests/dataflow/external-models/test.cpp
Normal file
16
cpp/ql/test/library-tests/dataflow/external-models/test.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
int ymlSource();
|
||||
void ymlSink(int value);
|
||||
int ymlStep(int value);
|
||||
|
||||
void test() {
|
||||
int x = ymlSource();
|
||||
|
||||
ymlSink(0);
|
||||
|
||||
ymlSink(x); // $ MISSING: ir
|
||||
|
||||
int y = ymlStep(x);
|
||||
|
||||
ymlSink(y); // $ MISSING: ir
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
| Dubious namespace "" in sink model. |
|
||||
| Dubious namespace "" in source model. |
|
||||
| Dubious namespace "" in summary model. |
|
||||
| Dubious type "" in sink model. |
|
||||
| Dubious type "" in source model. |
|
||||
| Dubious type "" in summary model. |
|
||||
| Invalid kind "remote-sink" in sink model. |
|
||||
@@ -0,0 +1,2 @@
|
||||
import cpp
|
||||
import semmle.code.cpp.dataflow.ExternalFlow::CsvValidation
|
||||
Reference in New Issue
Block a user