diff --git a/python/ql/test/library-tests/ControlFlow/evaluation-order/TimerUtils.qll b/python/ql/test/library-tests/ControlFlow/evaluation-order/TimerUtils.qll index 9782152b8cf..23f8f3a50a0 100644 --- a/python/ql/test/library-tests/ControlFlow/evaluation-order/TimerUtils.qll +++ b/python/ql/test/library-tests/ControlFlow/evaluation-order/TimerUtils.qll @@ -1,9 +1,10 @@ /** * Utility library for identifying timer annotations in evaluation-order tests. * - * Identifies `expr @ t[n]` (matmul), `t(expr, n)` (call), and - * `expr @ t.dead[n]` (dead-code) patterns, extracts timestamp values, - * and provides predicates for traversing consecutive annotated CFG nodes. + * Identifies `expr @ t[n]` (matmul) and `t(expr, n)` (call) patterns, + * including `dead(n)` and `never` markers within subscripts, extracts + * timestamp values, and provides predicates for traversing consecutive + * annotated CFG nodes. */ import python diff --git a/python/ql/test/library-tests/ControlFlow/evaluation-order/test_basic.py b/python/ql/test/library-tests/ControlFlow/evaluation-order/test_basic.py index 3e8ee925d91..b98ebe7b95c 100644 --- a/python/ql/test/library-tests/ControlFlow/evaluation-order/test_basic.py +++ b/python/ql/test/library-tests/ControlFlow/evaluation-order/test_basic.py @@ -5,7 +5,7 @@ are evaluated in the expected order (typically left to right for operands of binary operators, elements of collection literals, etc.) Every evaluated expression has a timestamp annotation, except the -timer mechanism itself (t[n], t.dead[n]). +timer mechanism itself (t[n], t[dead(n)], t[never]). """ from timer import test, never diff --git a/python/ql/test/library-tests/ControlFlow/evaluation-order/timer.py b/python/ql/test/library-tests/ControlFlow/evaluation-order/timer.py index e10dde2592a..ccec5d64f7c 100644 --- a/python/ql/test/library-tests/ControlFlow/evaluation-order/timer.py +++ b/python/ql/test/library-tests/ControlFlow/evaluation-order/timer.py @@ -26,6 +26,7 @@ Run a test file directly to self-validate: python test_file.py """ import atexit +import os import sys _results = [] @@ -53,6 +54,10 @@ class _Check: self._dead.add(e.timestamp) elif isinstance(e, _NeverSentinel): self._never = True + else: + raise TypeError( + f"Unknown element in timer subscript: {e!r} (type {type(e).__name__})" + ) def __rmatmul__(self, value): ts = self._timer._tick() @@ -183,7 +188,7 @@ def _report(): print("---") print(f"{passed}/{total} tests passed") if passed < total: - sys.exit(1) + os._exit(1) atexit.register(_report)