From d5a76e8c988960f0d1fdba207eb7a28af86c6fe4 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Mon, 7 Mar 2022 11:58:26 +0100 Subject: [PATCH] Python: delete test that only used deprecated classes --- .../PointsTo/customise/test.expected | 10 ---- .../library-tests/PointsTo/customise/test.py | 11 ---- .../library-tests/PointsTo/customise/test.ql | 35 ----------- .../PointsTo/extensions/Extend.expected | 23 -------- .../PointsTo/extensions/Extend.ql | 59 ------------------- .../library-tests/PointsTo/extensions/test.py | 17 ------ 6 files changed, 155 deletions(-) delete mode 100644 python/ql/test/library-tests/PointsTo/customise/test.expected delete mode 100644 python/ql/test/library-tests/PointsTo/customise/test.py delete mode 100644 python/ql/test/library-tests/PointsTo/customise/test.ql delete mode 100644 python/ql/test/library-tests/PointsTo/extensions/Extend.expected delete mode 100644 python/ql/test/library-tests/PointsTo/extensions/Extend.ql delete mode 100644 python/ql/test/library-tests/PointsTo/extensions/test.py diff --git a/python/ql/test/library-tests/PointsTo/customise/test.expected b/python/ql/test/library-tests/PointsTo/customise/test.expected deleted file mode 100644 index 009572ad1c5..00000000000 --- a/python/ql/test/library-tests/PointsTo/customise/test.expected +++ /dev/null @@ -1,10 +0,0 @@ -WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (test.ql:9,27-51) -| 9 | ControlFlowNode for has_type_int | Function has_type_int | builtin-class function | -| 9 | ControlFlowNode for has_type_int() | has_type_int() | builtin-class int | -| 9 | ControlFlowNode for x | has_type_int() | builtin-class int | -| 10 | ControlFlowNode for has_type_float | Function has_type_float | builtin-class function | -| 10 | ControlFlowNode for has_type_float() | has_type_float() | builtin-class float | -| 10 | ControlFlowNode for y | has_type_float() | builtin-class float | -| 11 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | -| 11 | ControlFlowNode for x | has_type_int() | builtin-class int | -| 11 | ControlFlowNode for y | has_type_float() | builtin-class float | diff --git a/python/ql/test/library-tests/PointsTo/customise/test.py b/python/ql/test/library-tests/PointsTo/customise/test.py deleted file mode 100644 index f6aef15a9ff..00000000000 --- a/python/ql/test/library-tests/PointsTo/customise/test.py +++ /dev/null @@ -1,11 +0,0 @@ -def has_type_int(): - return untaceable() - -def has_type_float(): - return untaceable2() - -def test(): - #Ignore before this comment - x = has_type_int() - y = has_type_float() - return x, y \ No newline at end of file diff --git a/python/ql/test/library-tests/PointsTo/customise/test.ql b/python/ql/test/library-tests/PointsTo/customise/test.ql deleted file mode 100644 index f101e4f2a5d..00000000000 --- a/python/ql/test/library-tests/PointsTo/customise/test.ql +++ /dev/null @@ -1,35 +0,0 @@ -import python -import semmle.python.types.Extensions - -/* - * Customise: Claim any function called has_type_XXX return any class - * whose name matches XXX - */ - -class HasTypeFact extends CustomPointsToOriginFact { - HasTypeFact() { - exists(FunctionObject func, string name | - func.getACall() = this and - name = func.getName() and - name.matches("has\\_type\\_%") - ) - } - - override predicate pointsTo(Object value, ClassObject cls) { - exists(FunctionObject func, string name | - func.getACall() = this and - name = func.getName() and - name.matches("has\\_type\\_%") - | - cls.getName() = name.suffix("has_type_".length()) - ) and - value = this - } -} - -from int line, ControlFlowNode f, Object o, ClassObject c -where - f.getLocation().getStartLine() = line and - exists(Comment ct | ct.getLocation().getStartLine() < line) and - f.refersTo(o, c, _) -select line, f.toString(), o.toString(), c.toString() diff --git a/python/ql/test/library-tests/PointsTo/extensions/Extend.expected b/python/ql/test/library-tests/PointsTo/extensions/Extend.expected deleted file mode 100644 index ddd6e90582c..00000000000 --- a/python/ql/test/library-tests/PointsTo/extensions/Extend.expected +++ /dev/null @@ -1,23 +0,0 @@ -WARNING: Type CustomPointsToAttribute has been deprecated and may be removed in future (Extend.ql:22,34-57) -WARNING: Type CustomPointsToObjectFact has been deprecated and may be removed in future (Extend.ql:38,32-56) -WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:5,28-52) -WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:49,38-62) -| test.py:4:1:4:3 | ControlFlowNode for one | int 1 | -| test.py:5:1:5:3 | ControlFlowNode for two | int 2 | -| test.py:8:1:8:1 | ControlFlowNode for IntegerLiteral | int 1 | -| test.py:8:1:8:11 | ControlFlowNode for Tuple | Tuple | -| test.py:8:3:8:3 | ControlFlowNode for IntegerLiteral | int 2 | -| test.py:8:5:8:5 | ControlFlowNode for IntegerLiteral | int 3 | -| test.py:8:7:8:7 | ControlFlowNode for IntegerLiteral | int 4 | -| test.py:8:9:8:9 | ControlFlowNode for IntegerLiteral | int 5 | -| test.py:8:11:8:11 | ControlFlowNode for IntegerLiteral | int 6 | -| test.py:10:1:10:2 | ControlFlowNode for a3 | int 3 | -| test.py:10:6:10:7 | ControlFlowNode for Tuple | Tuple | -| test.py:10:6:10:13 | ControlFlowNode for Attribute | int 3 | -| test.py:11:1:11:2 | ControlFlowNode for a4 | int 4 | -| test.py:11:6:11:10 | ControlFlowNode for False | bool False | -| test.py:11:6:11:15 | ControlFlowNode for Attribute | int 4 | -| test.py:13:1:13:2 | ControlFlowNode for a3 | int 3 | -| test.py:14:1:14:2 | ControlFlowNode for a4 | int 4 | -| test.py:16:1:16:4 | ControlFlowNode for five | int 5 | -| test.py:17:1:17:3 | ControlFlowNode for six | int 6 | diff --git a/python/ql/test/library-tests/PointsTo/extensions/Extend.ql b/python/ql/test/library-tests/PointsTo/extensions/Extend.ql deleted file mode 100644 index 078b925a1df..00000000000 --- a/python/ql/test/library-tests/PointsTo/extensions/Extend.ql +++ /dev/null @@ -1,59 +0,0 @@ -import python -import semmle.python.pointsto.PointsTo -private import semmle.python.types.Extensions - -class CfgExtension extends CustomPointsToOriginFact { - CfgExtension() { - this.(NameNode).getId() = "one" - or - this.(NameNode).getId() = "two" - } - - override predicate pointsTo(Object value, ClassObject cls) { - cls = theIntType() and - ( - this.(NameNode).getId() = "one" and value.(NumericObject).intValue() = 1 - or - this.(NameNode).getId() = "two" and value.(NumericObject).intValue() = 2 - ) - } -} - -class AttributeExtension extends CustomPointsToAttribute { - AttributeExtension() { this = this } - - override predicate attributePointsTo( - string name, Object value, ClassObject cls, ControlFlowNode origin - ) { - cls = theIntType() and - origin = any(Module m).getEntryNode() and - ( - name = "three" and value.(NumericObject).intValue() = 3 - or - name = "four" and value.(NumericObject).intValue() = 4 - ) - } -} - -class NoClassExtension extends CustomPointsToObjectFact { - NoClassExtension() { this = this } - - override predicate pointsTo(Object value) { - this.(NameNode).getId() = "five" and value.(NumericObject).intValue() = 5 - or - this.(NameNode).getId() = "six" and value.(NumericObject).intValue() = 6 - } -} - -/* Check that we can use old API without causing non-monotonic recursion */ -class RecurseIntoOldPointsTo extends CustomPointsToOriginFact { - RecurseIntoOldPointsTo() { PointsTo::points_to(this, _, unknownValue(), _, _) } - - override predicate pointsTo(Object value, ClassObject cls) { - value = unknownValue() and cls = theUnknownType() - } -} - -from ControlFlowNode f, Object o -where f.getLocation().getFile().getBaseName() = "test.py" and f.refersTo(o) -select f, o.toString() diff --git a/python/ql/test/library-tests/PointsTo/extensions/test.py b/python/ql/test/library-tests/PointsTo/extensions/test.py deleted file mode 100644 index 7422cce15d2..00000000000 --- a/python/ql/test/library-tests/PointsTo/extensions/test.py +++ /dev/null @@ -1,17 +0,0 @@ - -#Magical values - -one -two - -#Make sure values exist in DB -1,2,3,4,5,6 - -a3 = ().three -a4 = False.four - -a3 -a4 - -five -six