From e5219e9b1674491c9889d2ad82e6c09d29ad402d Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 15 Jan 2025 11:55:18 +0100 Subject: [PATCH] [autogen_testutils] Change how IPs with DIFs are detected In the next commit, we will remove all the autogenerated files in sw/device/lib/dif/autogen. This will break how autogen_testutils detects IPs with diff. The logic is change to the following: go through the list of IPs for the top of interest, check in sw/device/lib/dif if there is a file called dif_.h. This produces exactly the same result. Signed-off-by: Amaury Pouly --- util/autogen_testutils.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/util/autogen_testutils.py b/util/autogen_testutils.py index 7b292ca151147..215f991a14252 100755 --- a/util/autogen_testutils.py +++ b/util/autogen_testutils.py @@ -14,7 +14,6 @@ """ import argparse -import glob import logging import sys from pathlib import Path @@ -51,18 +50,17 @@ def main(): topcfg = hjson.loads(topcfg_text, use_decimal=True) # Define autogen DIF directory. - autogen_dif_directory = REPO_TOP / "sw/device/lib/dif/autogen" + autogen_dif_directory = REPO_TOP / "sw/device/lib/dif" # Create list of IPs to generate shared testutils code for. This is all IPs # that have a DIF library, that the testutils functions can use. Note, the # templates will take care of only generating ISR testutil functions for IPs # that can actually generate interrupts. ips_with_difs = [] - for autogen_dif_filename in glob.iglob(str(autogen_dif_directory / "*.h")): - # NOTE: the line below takes as input a file path - # (/path/to/dif_uart_autogen.c) and returns the IP name in lower - # case snake mode (i.e., uart). - ip_name_snake = Path(autogen_dif_filename).stem[4:-8] + + for ip_name_snake in sorted({m["type"] for m in topcfg["module"]}): + if not (autogen_dif_directory / f"dif_{ip_name_snake}.h").exists(): + continue hjson_file = topgen_lib.get_ip_hjson_path(ip_name_snake, topcfg, REPO_TOP)