From 6f492845b80133eb78e08ebb22a3df4f50552bde Mon Sep 17 00:00:00 2001 From: Daniel MBouyou Date: Sun, 9 Aug 2026 07:35:04 +0000 Subject: [PATCH] Fix Makefile and documentation paths left behind by moved files Five references still point at files that were moved or renamed by merged pull requests, and nothing in CI notices, because no test asserts that a path named in the build or the docs resolves. Makefile, test-fuzz: invoked tests/cross_fw/sdl/fuzz/quantize_api.py, removed in #3695, which added fuzz_target.py in the same commit. The filename is the only change; both scripts call atheris.Setup(sys.argv, ...) and then atheris.Fuzz(), so argument handling and behaviour are unchanged. This target is the only invocation of the fuzz target in the repository, so no CI job caught the breakage. Makefile, install-openvino-dev: installed from examples/post_training_quantization/openvino/yolov8/, renamed to yolo26 in #3844. docs/usage/IgnoredScope.md, tests/post_training/README.md and the --memory-monitor help text in tests/post_training/conftest.py: tools/ paths moved in #3939. The documented render_dot_to_svg command also passed -m, which the script does not register; its parser accepts -i and --input_file. Adds tests/docs/test_makefile_paths.py, asserting that Python scripts written out literally in Makefile recipes exist. It is deliberately narrow: it does not cover requirements files, paths built from Make variables, or python -m invocations, so a green run is not a claim that every target works. install-models-hub-torch is left alone. It installs from tests/torch/models_hub_test/, deleted in #3553, and the only repair is removing the target, which is a maintainer's decision. --- Makefile | 4 +-- docs/usage/IgnoredScope.md | 2 +- tests/docs/test_makefile_paths.py | 47 +++++++++++++++++++++++++++++++ tests/post_training/README.md | 2 +- tests/post_training/conftest.py | 2 +- 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 tests/docs/test_makefile_paths.py diff --git a/Makefile b/Makefile index 0f208af8e8e..8cb3e246a45 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ install-openvino-test: install-openvino-dev: install-openvino-test install-pre-commit pip install -r examples/post_training_quantization/openvino/mobilenet_v2/requirements.txt pip install -r examples/post_training_quantization/openvino/anomaly_stfpm_quantize_with_accuracy_control/requirements.txt - pip install -r examples/post_training_quantization/openvino/yolov8/requirements.txt + pip install -r examples/post_training_quantization/openvino/yolo26/requirements.txt pip install -r examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/requirements.txt test-openvino: @@ -163,4 +163,4 @@ install-fuzz-test: install-common-test pip install -r tests/cross_fw/sdl/fuzz/requirements.txt test-fuzz: - python tests/cross_fw/sdl/fuzz/quantize_api.py + python tests/cross_fw/sdl/fuzz/fuzz_target.py diff --git a/docs/usage/IgnoredScope.md b/docs/usage/IgnoredScope.md index 78f85ff3872..4e7d126b359 100644 --- a/docs/usage/IgnoredScope.md +++ b/docs/usage/IgnoredScope.md @@ -45,5 +45,5 @@ graph.dump_graph("model.dot") ### Convert dot to svg file ```sh -python tools/render_dot_to_svg.py -m model.dot +python tools/other/render_dot_to_svg.py -i model.dot ``` diff --git a/tests/docs/test_makefile_paths.py b/tests/docs/test_makefile_paths.py new file mode 100644 index 00000000000..a026cc4bc9d --- /dev/null +++ b/tests/docs/test_makefile_paths.py @@ -0,0 +1,47 @@ +# Copyright (c) 2026 Intel Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re + +from tests.cross_fw.shared.paths import PROJECT_ROOT + +MAKEFILE = PROJECT_ROOT / "Makefile" + +# A literal Python path written out in a recipe, e.g. `python tests/.../fuzz_target.py`. +# Deliberately literal-only: a path assembled from a Make variable, reached after a `cd`, +# or run as `python -m package.module` is not matched and not claimed to be. +SCRIPT_RE = re.compile(r"(? list[tuple[int, str]]: + """Literal Python script paths written out in Makefile recipes, with line numbers.""" + found = [] + for lineno, line in enumerate(MAKEFILE.read_text(encoding="utf-8").splitlines(), start=1): + if not line.startswith("\t") or line.lstrip().startswith("#"): + continue # not a recipe command + for match in SCRIPT_RE.finditer(line): + found.append((lineno, match.group(1))) + return found + + +def test_makefile_scripts_exist(): + """Every Python script written out literally in a Makefile recipe must exist. + + This is narrow on purpose. It does not check requirements files, paths built from + Make variables, or `python -m` invocations, so a green run here is not a claim that + every Makefile target works. It catches one recurring mistake: a file is moved or + renamed and the recipe that runs it keeps the old path, which makes the target fail + the moment anyone invokes it. + """ + missing = [ + f"Makefile:{lineno}: {path}" for lineno, path in _referenced_scripts() if not (PROJECT_ROOT / path).is_file() + ] + assert not missing, "Makefile invokes scripts that do not exist:\n" + "\n".join(missing) diff --git a/tests/post_training/README.md b/tests/post_training/README.md index e1a84aafdb1..77a34c2b8d7 100644 --- a/tests/post_training/README.md +++ b/tests/post_training/README.md @@ -66,7 +66,7 @@ Additional arguments: - `--batch-size=N` to use batch_size for calibration. Some of the models do not support --batch-size > 1. For such models, please, use --batch-size=1. - `--benchmark` to collect throughput statistics, add `FPS` column to result.csv - `--extra-columns` to add additional columns to reports.csv, like time for each algorithms -- `--memory-monitor` to using MemoryMonitor from tools/memory_monitor.py +- `--memory-monitor` to using MemoryMonitor from tools/memory_monitor/memory_monitor.py ### Examples diff --git a/tests/post_training/conftest.py b/tests/post_training/conftest.py index 4aa41a94df3..667b4f58c78 100644 --- a/tests/post_training/conftest.py +++ b/tests/post_training/conftest.py @@ -36,7 +36,7 @@ def pytest_addoption(parser): parser.addoption( "--memory-monitor", action="store_true", - help="Report memory using MemoryMonitor from tools/memory_monitor.py. " + help="Report memory using MemoryMonitor from tools/memory_monitor/memory_monitor.py. " "Warning: currently, reported memory values are not always reproducible.", )