From 0b780835954ec195b5d753e00cb64df7e5ee24e7 Mon Sep 17 00:00:00 2001 From: Marek Fiala Date: Tue, 10 Dec 2024 13:33:00 +0100 Subject: [PATCH 1/2] fix(tools): fixed test_create_project_with_idf_readonly on Win --- tools/idf_py_actions/create_ext.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/idf_py_actions/create_ext.py b/tools/idf_py_actions/create_ext.py index 3d97147854a..9634bd8ccc4 100644 --- a/tools/idf_py_actions/create_ext.py +++ b/tools/idf_py_actions/create_ext.py @@ -1,9 +1,9 @@ -# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import os import re import sys -from shutil import copy +from shutil import copyfile from shutil import copytree from typing import Dict @@ -42,7 +42,8 @@ def create_project(target_path: str, name: str) -> None: copytree( os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_project'), target_path, - copy_function=copy, + # 'copyfile' ensures only data are copied, without any metadata (file permissions) + copy_function=copyfile, dirs_exist_ok=True, ) main_folder = os.path.join(target_path, 'main') @@ -55,7 +56,8 @@ def create_component(target_path: str, name: str) -> None: copytree( os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_component'), target_path, - copy_function=copy, + # 'copyfile' ensures only data are copied, without any metadata (file permissions) + copy_function=copyfile, dirs_exist_ok=True, ) os.rename(os.path.join(target_path, 'main.c'), os.path.join(target_path, '.'.join((name, 'c')))) From 5930a422d7cf31b96ae465e7bd89b528712e676f Mon Sep 17 00:00:00 2001 From: Marek Fiala Date: Mon, 16 Dec 2024 10:20:24 +0100 Subject: [PATCH 2/2] fix(tools): Fixed timeout and path bug for test_cli_installer_win --- .gitlab/ci/test-win.yml | 1 + tools/test_idf_tools/test_idf_tools.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/test-win.yml b/.gitlab/ci/test-win.yml index 42e24469333..3b8d3d18074 100644 --- a/.gitlab/ci/test-win.yml +++ b/.gitlab/ci/test-win.yml @@ -29,6 +29,7 @@ test_cli_installer_win: expire_in: 1 week variables: IDF_PATH: "$CI_PROJECT_DIR" + timeout: 3h script: # Tools must be downloaded for testing - python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake diff --git a/tools/test_idf_tools/test_idf_tools.py b/tools/test_idf_tools/test_idf_tools.py index 87eab1dee0c..00a82635d33 100755 --- a/tools/test_idf_tools/test_idf_tools.py +++ b/tools/test_idf_tools/test_idf_tools.py @@ -322,8 +322,9 @@ def test_export_with_required_tools_check_skipped(self): self.run_idf_tools_with_action(['install', OPENOCD]) output = self.run_idf_tools_with_action(['export']) - self.assertIn('%s/tools/openocd-esp32/%s/openocd-esp32/bin' % - (self.temp_tools_dir, OPENOCD_VERSION), output) + self.assertIn(os.path.join( + self.temp_tools_dir, 'tools', 'openocd-esp32', OPENOCD_VERSION, 'openocd-esp32', 'bin' + ), output) # TestUsageUnix tests installed tools on UNIX platforms