mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
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:
@@ -125,7 +125,9 @@ test_idf_tools:
|
||||
entrypoint: [""] # use system python3. no extra pip package installed
|
||||
script:
|
||||
# Tools must be downloaded for testing
|
||||
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa
|
||||
# We could use "idf_tools.py download all", but we don't want to install clang because of its huge size
|
||||
# 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
|
||||
|
@@ -502,10 +502,29 @@ class TestUsage(unittest.TestCase):
|
||||
|
||||
def test_export_supported_version_cmake(self):
|
||||
tool_to_test = 'cmake'
|
||||
self.run_idf_tools_with_action(['install'])
|
||||
output = self.run_idf_tools_with_action(['export'])
|
||||
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.assertNotIn(tool_to_test, output)
|
||||
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)
|
||||
|
||||
|
||||
class TestMaintainer(unittest.TestCase):
|
||||
|
Reference in New Issue
Block a user