Skip to content

Commit

Permalink
Merge pull request #17968 from michaelnebel/java/movetestutils
Browse files Browse the repository at this point in the history
Move test utilities to the query pack.
  • Loading branch information
michaelnebel authored Dec 16, 2024
2 parents 3171752 + 0bfc1b6 commit aaf0cd5
Show file tree
Hide file tree
Showing 667 changed files with 623 additions and 623 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import cpp
private import semmle.code.cpp.ir.dataflow.DataFlow::DataFlow as IRDataFlow
private import semmle.code.cpp.dataflow.DataFlow::DataFlow as AstDataFlow
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module IRFlowTest<IRDataFlow::GlobalFlowSig Flow> implements TestSig {
string getARelevantTag() { result = "ir" }
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/asExpr/test-indirect.ql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cpp
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import semmle.code.cpp.dataflow.new.DataFlow::DataFlow

bindingset[s]
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/asExpr/test.ql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cpp
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import semmle.code.cpp.dataflow.new.DataFlow::DataFlow

bindingset[s]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
private import cpp
private import semmle.code.cpp.ir.dataflow.DataFlow
private import semmle.code.cpp.controlflow.IRGuards
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import cpp

module AstTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import cpp

module AstTest {
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/dataflow-tests/test.ql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import TestBase
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon
import MakeTest<MergeTests<AstFlowTest<AstTest::AstFlow>, IRFlowTest<IRTest::IRFlow>>>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cpp
import semmle.code.cpp.dataflow.new.DataFlow
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cpp
import semmle.code.cpp.dataflow.new.DataFlow
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import cpp

module AstTest {
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/external-models/flow.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon
import cpp
import semmle.code.cpp.security.FlowSources
import IRTest::IRFlow::PathGraph
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/fields/flow.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon

module AstTest {
import ASTConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import testModels

module InterpretElementTest implements TestSig {
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/models-as-data/taint.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon
import testModels

module IRTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon
import semmle.code.cpp.dataflow.new.DataFlow

module ParamConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon

module AstTest {
private import semmle.code.cpp.dataflow.TaintTracking
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** This tests that we are able to detect local flow sources. */

import cpp
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import semmle.code.cpp.security.FlowSources

module LocalFlowSourceTest implements TestSig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** This tests that we are able to detect remote flow sources and sinks. */

import cpp
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import semmle.code.cpp.security.FlowSources

module RemoteFlowSourceTest implements TestSig {
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/dataflow/taint-tests/taint.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestUtilities.dataflow.FlowTestCommon
import utils.test.dataflow.FlowTestCommon

module TaintModels {
class SetMemberFunction extends TaintFunction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysi
import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysisImpl
import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific
import semmle.code.cpp.ir.IR as IR
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module ModulusAnalysisInstantiated = ModulusAnalysis<SemLocation, Sem, FloatDelta, ConstantBounds>;

Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/ir/points_to/points_to.ql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cpp
private import TestUtilities.InlineExpectationsTest
private import utils.test.InlineExpectationsTest
private import semmle.code.cpp.ir.internal.IntegerConstant as Ints

private predicate ignoreAllocation(string name) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/ir/range-analysis/Overflow.ql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cpp
import semmle.code.cpp.rangeanalysis.new.SimpleRangeAnalysis
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module RangeAnalysisTest implements TestSig {
string getARelevantTag() { result = "overflow" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysi
import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic
import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific
import semmle.code.cpp.ir.IR as IR
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module RangeAnalysisTest implements TestSig {
string getARelevantTag() { result = "range" }
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/ir/sign-analysis/SignAnalysis.ql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta
import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysisRelativeSpecific
import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprSpecific
import semmle.code.cpp.ir.IR as IR
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module SignAnalysisInstantiated = SignAnalysis<FloatDelta>;

Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/library-tests/ir/types/irtypes.ql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
private import cpp
private import semmle.code.cpp.ir.implementation.raw.IR
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest

module IRTypesTest implements TestSig {
string getARelevantTag() { result = "irtype" }
Expand Down
2 changes: 1 addition & 1 deletion cpp/ql/test/query-tests/Critical/SizeCheck/SizeCheck.qlref
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Critical/SizeCheck.ql
postprocess: TestUtilities/InlineExpectationsTestQuery.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security/CWE/CWE-022/TaintedPath.ql
postprocess: TestUtilities/InlineExpectationsTestQuery.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cpp
import semmle.code.cpp.security.InvalidPointerDereference.AllocationToInvalidPointer
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import semmle.code.cpp.ir.IR
import semmle.code.cpp.dataflow.new.DataFlow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cpp
import semmle.code.cpp.security.InvalidPointerDereference.InvalidPointerToDereference
import TestUtilities.InlineExpectationsTest
import utils.test.InlineExpectationsTest
import semmle.code.cpp.ir.IR
import semmle.code.cpp.dataflow.new.DataFlow

Expand Down
File renamed without changes.
File renamed without changes.

This file was deleted.

2 changes: 0 additions & 2 deletions csharp/ql/test/TestUtilities/inline-tests/ProblemQuery.qlref

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: experimental/Security Features/CWE-759/HashWithoutSalt.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
2 changes: 1 addition & 1 deletion csharp/ql/test/library-tests/dataflow/async/Async.ql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import csharp
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>

class MySink extends DataFlow::ExprNode {
MySink() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StringConstCompareBarrier extends DataFlow::Node {
}
}

import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import PathGraph

module FlowConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.ProvenancePathGraph::ShowProvenance<ArrayFlow::PathNode, ArrayFlow::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ArrayFlow::PathNode, ArrayFlow::PathGraph>

module ArrayFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import ValueFlowTest<DefaultFlowConfig>
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import csharp
import semmle.code.csharp.dataflow.internal.ExternalFlow
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import ModelValidation

module TaintConfig implements DataFlow::ConfigSig {
Expand Down
2 changes: 1 addition & 1 deletion csharp/ql/test/library-tests/dataflow/fields/FieldFlow.ql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import semmle.code.csharp.security.dataflow.flowsources.FlowSources
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import TaintFlowTest<DatabaseConfig>

module DatabaseConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import semmle.code.csharp.security.dataflow.flowsources.FlowSources
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import TaintFlowTest<FilesConfig>

module FilesConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import csharp
import Common
import TestUtilities.ProvenancePathGraph::ShowProvenance<Flow::PathNode, Flow::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Flow::PathNode, Flow::PathGraph>

from Flow::PathNode source, Flow::PathNode sink, string s
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import csharp
import Common
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>

module Taint = TaintTracking::Global<FlowConfig>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
2 changes: 1 addition & 1 deletion csharp/ql/test/library-tests/dataflow/tuples/Tuples.ql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Loading

0 comments on commit aaf0cd5

Please sign in to comment.