summaryrefslogtreecommitdiff
path: root/build-aux/measurestack/test_app_plugins.py
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/measurestack/test_app_plugins.py')
-rw-r--r--build-aux/measurestack/test_app_plugins.py70
1 files changed, 0 insertions, 70 deletions
diff --git a/build-aux/measurestack/test_app_plugins.py b/build-aux/measurestack/test_app_plugins.py
deleted file mode 100644
index aed0bb4..0000000
--- a/build-aux/measurestack/test_app_plugins.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# build-aux/measurestack/test_app_plugins.py - Tests for app_plugins.py
-#
-# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com>
-# SPDX-License-Identifier: AGPL-3.0-or-later
-
-# pylint: disable=unused-variable
-
-import typing
-
-from . import analyze, app_plugins, testutil, util
-from .analyze import QName
-
-
-def test_fct() -> None:
- # 1. | a + | b + |
- # 2. | fmt_vsnprintf + | vprintf + |
- # 3. | fmt_vfctprintf + | fmt_vfctprintf + |
- # 4. | fmt_state_putchar + | fmt_state_putchar + |
- # 5. | _out_buffer + | stdio_buffered_printer + |
- max_call_depth = 5
- exp_a = ["a", "fmt_vsnprintf", "fmt_vfctprintf", "fmt_state_putchar", "_out_buffer"]
- exp_b = [
- "b",
- "__wrap_vprintf",
- "fmt_vfctprintf",
- "fmt_state_putchar",
- "stdio_buffered_printer",
- ]
- graph: typing.Sequence[tuple[str, typing.Collection[str]]] = [
- # main.c
- ("a", {"fmt_vsnprintf"}), # _out_buffer
- ("b", {"vprintf"}), # stdio_buffered_printer
- # wrappers
- ("fmt_vsnprintf", {"fmt_vfctprintf"}),
- ("__wrap_vprintf", {"fmt_vfctprintf"}),
- # printf.c
- ("fmt_vfctprintf", {"fmt_state_putchar"}),
- ("fmt_state_putchar", {"_out_buffer", "stdio_buffered_printer"}),
- # fcts
- ("_out_buffer", {}),
- ("stdio_buffered_printer", {}),
- ]
- graph_plugin = testutil.GraphProviderPlugin(max_call_depth, graph)
-
- plugins: list[util.Plugin] = [
- graph_plugin,
- app_plugins.LibMiscPlugin(arg_c_fnames=[]),
- # fmt_vsnprintf => fct=_out_buffer
- # if rp2040:
- # __wrap_vprintf => fct=stdio_buffered_printer
- # stdio_vprintf => fct=stdio_buffered_printer
- app_plugins.PicoFmtPlugin("rp2040", []),
- ]
-
- def test_filter(name: QName) -> tuple[int, bool]:
- if str(name.base()) in ["a", "b", "c"]:
- return 1, True
- return 0, False
-
- result = analyze.analyze(
- ci_fnames=[],
- app_func_filters={
- "Main": test_filter,
- },
- app=util.PluginApplication(testutil.nop_location_xform, plugins),
- cfg_max_call_depth=max_call_depth,
- )
-
- graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("a")].nstatic, exp_a)
- graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("b")].nstatic, exp_b)