Skip to content

Commit 335ba6b

Browse files
Marek Fialaespressif-bot
authored andcommitted
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.
1 parent 79ebe0b commit 335ba6b

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.gitlab/ci/host-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ test_cli_installer:
113113
script:
114114
# Tools must be downloaded for testing
115115
# We could use "idf_tools.py download all", but we don't want to install clang because of its huge size
116-
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
116+
# cmake@version that is supported
117+
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake [email protected]
117118
- cd ${IDF_PATH}/tools/test_idf_tools
118119
- python3 -m pip install jsonschema
119120
- python3 ./test_idf_tools.py -v

.gitlab/ci/test-win.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ test_cli_installer_win:
3535
timeout: 3h
3636
script:
3737
# Tools must be downloaded for testing
38-
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
38+
# cmake@version that is supported
39+
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake [email protected]
3940
- cd ${IDF_PATH}\tools\test_idf_tools
4041
- python -m pip install jsonschema
4142
- python .\test_idf_tools.py

tools/test_idf_tools/test_idf_tools.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,32 @@ def test_export_recommended_version_cmake(self):
313313

314314
self.assertIn(os.path.join(tool_to_test, tool_version), output)
315315

316+
def test_export_supported_version_cmake(self):
317+
tool_to_test = 'cmake'
318+
supported_version = ''
319+
recommended_version = ''
320+
for tool in self.tools_dict['tools']:
321+
if tool['name'] != tool_to_test:
322+
continue
323+
for version in tool['versions']:
324+
if version['status'] == 'supported':
325+
supported_version = version['name']
326+
elif version['status'] == 'recommended':
327+
recommended_version = version['name']
328+
329+
self.run_idf_tools_with_action(['install'])
330+
output = self.run_idf_tools_with_action(['install', f'{tool_to_test}@{supported_version}'])
331+
self.assert_tool_installed(output, tool_to_test, supported_version)
332+
333+
# Remove the recommended version folder installed by install command (in case of Windows)
334+
recommended_version_folder = os.path.join(self.temp_tools_dir, 'tools', tool_to_test, recommended_version)
335+
if os.path.exists(recommended_version_folder):
336+
shutil.rmtree(recommended_version_folder)
337+
338+
output = self.run_idf_tools_with_action(['export'])
339+
self.assertIn(os.path.join(tool_to_test, supported_version), output)
340+
self.assertNotIn(os.path.join(tool_to_test, recommended_version), output)
341+
316342
def test_export_prefer_system_cmake(self):
317343
tool_to_test = 'cmake'
318344
self.run_idf_tools_with_action(['install'])

0 commit comments

Comments
 (0)