diff --git a/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected b/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected index 31ea3f55ff2..9e79328c82b 100644 --- a/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected +++ b/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected @@ -15,6 +15,8 @@ pointsTo_found_typeTracker_notFound | code/func_defined_outside_class.py:42:1:42:7 | ControlFlowNode for Attribute() | B._gen.func | | code/func_defined_outside_class.py:43:1:43:7 | ControlFlowNode for Attribute() | B._gen.func | | code/funky_regression.py:15:9:15:17 | ControlFlowNode for Attribute() | Wat.f2 | +| code/runtime_decision.py:44:1:44:7 | ControlFlowNode for func4() | "code/runtime_decision_defns.py:4:func4" | +| code/runtime_decision.py:44:1:44:7 | ControlFlowNode for func4() | "code/runtime_decision_defns.py:7:func4" | | code/type_tracking_limitation.py:8:1:8:3 | ControlFlowNode for x() | my_func | typeTracker_found_pointsTo_notFound | code/callable_as_argument.py:29:5:29:12 | ControlFlowNode for Attribute() | test_class.InsideTestFunc.sm | diff --git a/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision.py b/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision.py index 3901a770188..d3800080589 100644 --- a/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision.py +++ b/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision.py @@ -24,3 +24,21 @@ else: func2 = rd_bar func2() # $ pt,tt=rd_foo pt,tt=rd_bar + + +# ============================================================================== +# definition is random + +if random.random() < 0.5: + def func3(): + print("func3 A") +else: + def func3(): + print("func3 B") + +func3() # $ pt,tt=33:func3 pt,tt=36:func3 + + +# func4 uses same setup as func3, it's just defined in an other file +from code.runtime_decision_defns import func4 +func4() # $ pt="code/runtime_decision_defns.py:4:func4" pt="code/runtime_decision_defns.py:7:func4" MISSING: tt diff --git a/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision_defns.py b/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision_defns.py new file mode 100644 index 00000000000..931d9246fa1 --- /dev/null +++ b/python/ql/test/experimental/library-tests/CallGraph/code/runtime_decision_defns.py @@ -0,0 +1,8 @@ +import random + +if random.random() < 0.5: + def func4(): + print("func4 A") +else: + def func4(): + print("func4 B")