test(tools): Added test for installing supported tool version

Added test_export_supported_version_cmake in `test_idf_tools.py`,
that installs and exports supported version of tool - cmake.
This commit is contained in:
Marek Fiala
2025-06-02 15:08:44 +02:00
committed by BOT
parent 79ebe0b306
commit 335ba6b3c2
3 changed files with 30 additions and 2 deletions

View File

@ -113,7 +113,8 @@ test_cli_installer:
script:
# Tools must be downloaded for testing
# We could use "idf_tools.py download all", but we don't want to install clang because of its huge size
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
# cmake@version that is supported
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake cmake@3.16.3
- cd ${IDF_PATH}/tools/test_idf_tools
- python3 -m pip install jsonschema
- python3 ./test_idf_tools.py -v

View File

@ -35,7 +35,8 @@ test_cli_installer_win:
timeout: 3h
script:
# Tools must be downloaded for testing
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
# cmake@version that is supported
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake cmake@3.16.3
- cd ${IDF_PATH}\tools\test_idf_tools
- python -m pip install jsonschema
- python .\test_idf_tools.py

View File

@ -313,6 +313,32 @@ class TestUsage(TestUsageBase):
self.assertIn(os.path.join(tool_to_test, tool_version), output)
def test_export_supported_version_cmake(self):
tool_to_test = 'cmake'
supported_version = ''
recommended_version = ''
for tool in self.tools_dict['tools']:
if tool['name'] != tool_to_test:
continue
for version in tool['versions']:
if version['status'] == 'supported':
supported_version = version['name']
elif version['status'] == 'recommended':
recommended_version = version['name']
self.run_idf_tools_with_action(['install'])
output = self.run_idf_tools_with_action(['install', f'{tool_to_test}@{supported_version}'])
self.assert_tool_installed(output, tool_to_test, supported_version)
# Remove the recommended version folder installed by install command (in case of Windows)
recommended_version_folder = os.path.join(self.temp_tools_dir, 'tools', tool_to_test, recommended_version)
if os.path.exists(recommended_version_folder):
shutil.rmtree(recommended_version_folder)
output = self.run_idf_tools_with_action(['export'])
self.assertIn(os.path.join(tool_to_test, supported_version), output)
self.assertNotIn(os.path.join(tool_to_test, recommended_version), output)
def test_export_prefer_system_cmake(self):
tool_to_test = 'cmake'
self.run_idf_tools_with_action(['install'])