From 859745f1a92462fa21af54d80ad6a01cca484dd8 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Fri, 26 Apr 2024 10:38:09 -0700 Subject: Run audits on windows Add debug log for external detection tests. The debug log is used to print which test is being executed. Skip version audit on Windows where appropriate --- lib/spack/spack/audit.py | 8 ++++---- lib/spack/spack/cmd/audit.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 96225fd6ac..6d3a63c8a6 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -1046,7 +1046,7 @@ external_detection = AuditClass( group="externals", tag="PKG-EXTERNALS", description="Sanity checks for external software detection", - kwargs=("pkgs",), + kwargs=("pkgs", "debug_log"), ) @@ -1069,7 +1069,7 @@ def packages_with_detection_tests(): @external_detection -def _test_detection_by_executable(pkgs, error_cls): +def _test_detection_by_executable(pkgs, debug_log, error_cls): """Test drive external detection for packages""" import spack.detection @@ -1095,6 +1095,7 @@ def _test_detection_by_executable(pkgs, error_cls): for idx, test_runner in enumerate( spack.detection.detection_tests(pkg_name, spack.repo.PATH) ): + debug_log(f"[{__file__}]: running test {idx} for package {pkg_name}") specs = test_runner.execute() expected_specs = test_runner.expected_specs @@ -1115,11 +1116,10 @@ def _test_detection_by_executable(pkgs, error_cls): for candidate in expected_specs: try: idx = specs.index(candidate) + matched_detection.append((candidate, specs[idx])) except (AttributeError, ValueError): pass - matched_detection.append((candidate, specs[idx])) - def _compare_extra_attribute(_expected, _detected, *, _spec): result = [] # Check items are of the same type diff --git a/lib/spack/spack/cmd/audit.py b/lib/spack/spack/cmd/audit.py index c8cef494ef..77bbbc5d82 100644 --- a/lib/spack/spack/cmd/audit.py +++ b/lib/spack/spack/cmd/audit.py @@ -84,7 +84,7 @@ def externals(parser, args): return pkgs = args.name or spack.repo.PATH.all_package_names() - reports = spack.audit.run_group(args.subcommand, pkgs=pkgs) + reports = spack.audit.run_group(args.subcommand, pkgs=pkgs, debug_log=tty.debug) _process_reports(reports) -- cgit v1.2.3-70-g09d2