diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 395eebefec..b5e4f024ec 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -2122,8 +2122,12 @@ def process_tool( if not tool.versions_installed: if tool.get_install_type() == IDFTool.INSTALL_ALWAYS: - handle_missing_versions(tool, tool_name, install_cmd, prefer_system_hint) - tool_found = False + if os.getenv('IDF_SKIP_TOOLS_CHECK', '0') == '1': + warn(f'Tool {tool_name} is not installed and IDF_SKIP_TOOLS_CHECK is set. ' + 'This may cause build failures.') + else: + handle_missing_versions(tool, tool_name, install_cmd, prefer_system_hint) + tool_found = False # If a tool found, but it is optional and does not have versions installed, use whatever is in PATH. return tool_export_paths, tool_export_vars, tool_found diff --git a/tools/test_idf_tools/test_idf_tools.py b/tools/test_idf_tools/test_idf_tools.py index 1275430ef0..87eab1dee0 100755 --- a/tools/test_idf_tools/test_idf_tools.py +++ b/tools/test_idf_tools/test_idf_tools.py @@ -312,6 +312,19 @@ class TestUsage(TestUsageBase): self.assertNotIn(tool_to_test, output) + def test_export_with_required_tools_check_skipped(self): + self.run_idf_tools_with_error(['export'], assertError=True) + + new_os_environ = os.environ.copy() + new_os_environ['IDF_SKIP_TOOLS_CHECK'] = '1' + with patch('os.environ', new_os_environ): + self.run_idf_tools_with_action(['export']) + + 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) + # TestUsageUnix tests installed tools on UNIX platforms @unittest.skipIf(sys.platform == 'win32', reason='Tools for UNIX differ')