From 9820249c71d8b85805fe5d2f5e14407399863f84 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Tue, 29 Jan 2019 14:34:04 +0000 Subject: [PATCH] Python tests: Further hiding of special ESSA variables in tests, to ease transition from '*' to '$' variable. --- .../ql/test/library-tests/PointsTo/new/Definitions.ql | 2 +- python/ql/test/library-tests/PointsTo/new/SSA.ql | 3 ++- .../PointsTo/new/SourceEdgeDefinitions.ql | 2 +- .../PointsTo/new/SourceNodeDefinitions.ql | 10 ++++++---- python/ql/test/library-tests/PointsTo/new/VarUses.ql | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/python/ql/test/library-tests/PointsTo/new/Definitions.ql b/python/ql/test/library-tests/PointsTo/new/Definitions.ql index 166e9391868..dbaac3b09f9 100644 --- a/python/ql/test/library-tests/PointsTo/new/Definitions.ql +++ b/python/ql/test/library-tests/PointsTo/new/Definitions.ql @@ -4,5 +4,5 @@ import python import Util from EssaDefinition def, Variable v -where v = def.getSourceVariable() +where v = def.getSourceVariable() and not v instanceof SpecialSsaSourceVariable select locate(def.getLocation(), "abdgk"), v.toString(), def.getAQlClass() \ No newline at end of file diff --git a/python/ql/test/library-tests/PointsTo/new/SSA.ql b/python/ql/test/library-tests/PointsTo/new/SSA.ql index e9ed6864567..6c30a5f031f 100644 --- a/python/ql/test/library-tests/PointsTo/new/SSA.ql +++ b/python/ql/test/library-tests/PointsTo/new/SSA.ql @@ -5,6 +5,7 @@ private import semmle.python.pointsto.PointsToContext import Util from EssaVariable v, EssaDefinition def, Object o, ClassObject cls -where def = v.getDefinition() and +where def = v.getDefinition() and +not v.getSourceVariable() instanceof SpecialSsaSourceVariable and PointsTo::ssa_variable_points_to(v, _, o, cls, _) select locate(def.getLocation(), "abcdegjqmns_"), v.getRepresentation() + " = " + def.getRepresentation(), repr(o), repr(cls) diff --git a/python/ql/test/library-tests/PointsTo/new/SourceEdgeDefinitions.ql b/python/ql/test/library-tests/PointsTo/new/SourceEdgeDefinitions.ql index 4feb22b31ba..6a672d884d1 100644 --- a/python/ql/test/library-tests/PointsTo/new/SourceEdgeDefinitions.ql +++ b/python/ql/test/library-tests/PointsTo/new/SourceEdgeDefinitions.ql @@ -6,5 +6,5 @@ import semmle.python.pointsto.PointsTo import Util from SsaSourceVariable var, ControlFlowNode use, BasicBlock pred -where var.hasRefinementEdge(use, pred, _) +where var.hasRefinementEdge(use, pred, _) and not var instanceof SpecialSsaSourceVariable select locate(pred.getLastNode().getLocation(), "ab"), var.(Variable), use.toString() diff --git a/python/ql/test/library-tests/PointsTo/new/SourceNodeDefinitions.ql b/python/ql/test/library-tests/PointsTo/new/SourceNodeDefinitions.ql index 95341360bf4..3e42420156c 100644 --- a/python/ql/test/library-tests/PointsTo/new/SourceNodeDefinitions.ql +++ b/python/ql/test/library-tests/PointsTo/new/SourceNodeDefinitions.ql @@ -6,8 +6,10 @@ import semmle.python.pointsto.PointsTo import Util from SsaSourceVariable var, ControlFlowNode defn, string kind -where -var.hasDefiningNode(defn) and kind = "definition" -or -var.hasRefinement(_, defn) and kind = "refinement" +where not var instanceof SpecialSsaSourceVariable and +( + var.hasDefiningNode(defn) and kind = "definition" + or + var.hasRefinement(_, defn) and kind = "refinement" +) select locate(defn.getLocation(), "ab"), var.(Variable), defn.toString(), kind diff --git a/python/ql/test/library-tests/PointsTo/new/VarUses.ql b/python/ql/test/library-tests/PointsTo/new/VarUses.ql index a8b8b276d47..925f3c1a4a6 100644 --- a/python/ql/test/library-tests/PointsTo/new/VarUses.ql +++ b/python/ql/test/library-tests/PointsTo/new/VarUses.ql @@ -5,5 +5,5 @@ import semmle.python.pointsto.PointsTo import Util from SsaSourceVariable var, ControlFlowNode use -where use = var.getAUse() or var.hasRefinement(use, _) +where (use = var.getAUse() or var.hasRefinement(use, _)) and not var instanceof SpecialSsaSourceVariable select locate(use.getLocation(), "abd"), var.getName(), use.toString()