From 0f1a1503ad1f986887dd4ba0730da760571f7a91 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Wed, 29 Apr 2026 09:44:54 +0530 Subject: [PATCH] ci(esp_wifi): Update cleanup in script --- .../esp_wifi/remote/scripts/generate_and_check.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/esp_wifi/remote/scripts/generate_and_check.py b/components/esp_wifi/remote/scripts/generate_and_check.py index ad2234c19f5..fac36d38a95 100644 --- a/components/esp_wifi/remote/scripts/generate_and_check.py +++ b/components/esp_wifi/remote/scripts/generate_and_check.py @@ -218,6 +218,8 @@ def preprocess(idf_path: str, header: str) -> str: from pycparser import preprocess_file preprocessed_code = preprocess_file(temp_file) + if os.path.exists(temp_file): + os.remove(temp_file) return cast(str, preprocessed_code) @@ -705,6 +707,7 @@ making changes you might need to modify 'copyright_header.h' in the script direc parser.add_argument( '-s', '--skip-check', help='Skip checking the versioned files against the re-generated', action='store_true' ) + parser.add_argument('-k', '--keep-test', help='Keep the generated test directory', action='store_true') parser.add_argument('--base-dir', help='Base directory to compare generated files against') args = parser.parse_args() @@ -732,6 +735,15 @@ making changes you might need to modify 'copyright_header.h' in the script direc if rc != 0: modified_files.append(f) + # Cleanup test directory if not requested to keep it + if not args.keep_test: + test_dir = os.path.join(component_path, 'test') + if os.path.exists(test_dir): + try: + shutil.rmtree(test_dir) + except Exception as e: + print(f'Warning: Failed to clean up test directory {test_dir}: {e}') + if modified_files: print('WiFi-remote API files were updated:') for f in modified_files: