@@ -185,6 +185,96 @@ run_west_sdk_install_with_proxy_fallback() {
185185 run_command_block_from_readme " ${ZEPHYR_README_PATH} " " <!-- RUN west_sdk_install -->"
186186}
187187
188+ print_tool_details () {
189+ local tool=" $1 "
190+ local path
191+
192+ if path=" $( command -v " ${tool} " 2> /dev/null) " ; then
193+ echo " ${tool} : ${path} "
194+ file " ${path} " || true
195+ " ${path} " --version || true
196+ else
197+ echo " ${tool} : not found"
198+ fi
199+ }
200+
201+ print_path_details () {
202+ local label=" $1 "
203+ local path=" $2 "
204+ local interpreter
205+
206+ echo " ${label} : ${path} "
207+ if [[ -e " ${path} " ]]; then
208+ ls -ld " ${path} " || true
209+ file " ${path} " || true
210+ interpreter=" $( file " ${path} " | sed -n ' s/.*interpreter \([^,]*\).*/\1/p' ) "
211+ if [[ -n " ${interpreter} " && -x " ${interpreter} " ]]; then
212+ echo " ${label} dynamic loader: ${interpreter} "
213+ " ${interpreter} " --list " ${path} " || true
214+ fi
215+ if [[ -x " ${path} " ]]; then
216+ " ${path} " --version || true
217+ fi
218+ else
219+ echo " ${label} : missing"
220+ fi
221+ }
222+
223+ print_zephyr_diagnostics () {
224+ local sdk_version sdk_dir
225+
226+ echo " ---- Zephyr diagnostics ----"
227+ echo " uname -a: $( uname -a) "
228+ echo " uname -m: $( uname -m) "
229+ echo " PATH: ${PATH} "
230+ echo " LD_LIBRARY_PATH: ${LD_LIBRARY_PATH:- <unset>} "
231+ echo " VIRTUAL_ENV: ${VIRTUAL_ENV:- <unset>} "
232+ echo " ZEPHYR_PROJ_ROOT: ${ZEPHYR_PROJ_ROOT:- <unset>} "
233+ echo " EXECUTORCH_PROJ_ROOT: ${EXECUTORCH_PROJ_ROOT} "
234+ echo " ZEPHYR_SDK_INSTALL_DIR: ${ZEPHYR_SDK_INSTALL_DIR:- <unset>} "
235+ echo " ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT:- <unset>} "
236+ echo " ZEPHYR_SDK_RELEASE_PROXY_CACHE_DIR: ${ZEPHYR_SDK_RELEASE_PROXY_CACHE_DIR:- <unset>} "
237+
238+ sdk_version=" $( python3 " ${EXECUTORCH_PROJ_ROOT} /.ci/docker/common/zephyr_sdk_release_proxy.py" --print-version) "
239+ echo " Zephyr SDK version: ${sdk_version} "
240+ echo " Zephyr SDK release assets for this host:"
241+ python3 - << PY
242+ import importlib.util
243+ spec = importlib.util.spec_from_file_location(
244+ "zephyr_sdk_release_proxy",
245+ "${EXECUTORCH_PROJ_ROOT} /.ci/docker/common/zephyr_sdk_release_proxy.py",
246+ )
247+ module = importlib.util.module_from_spec(spec)
248+ spec.loader.exec_module(module)
249+ print("host_tuple:", module.host_tuple())
250+ for name in module.asset_names("${sdk_version} ", "arm-zephyr-eabi"):
251+ print(" ", name)
252+ PY
253+
254+ for sdk_dir in \
255+ " ${HOME} /zephyr-sdk-${sdk_version} " \
256+ " /opt/zephyr-sdk-${sdk_version} " \
257+ " /var/lib/ci-user/zephyr-sdk-${sdk_version} " ; do
258+ if [[ -d " ${sdk_dir} " ]]; then
259+ echo " Found Zephyr SDK dir: ${sdk_dir} "
260+ print_path_details " SDK dtc" " ${sdk_dir} /hosttools/sysroots/x86_64-pokysdk-linux/usr/bin/dtc"
261+ print_path_details " SDK arm-zephyr-eabi-g++" " ${sdk_dir} /gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++"
262+ print_path_details " SDK arm-zephyr-eabi-gcc" " ${sdk_dir} /gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc"
263+ fi
264+ done
265+
266+ print_tool_details python3
267+ print_tool_details cmake
268+ print_tool_details west
269+ print_tool_details dtc
270+ print_tool_details arm-zephyr-eabi-gcc
271+ print_tool_details arm-zephyr-eabi-g++
272+
273+ echo " pip packages:"
274+ python3 -m pip list | grep -E ' ^(cmake|west|pyelftools|ninja|jsonschema|setuptools|pip)[[:space:]]' || true
275+ echo " ---- End Zephyr diagnostics ----"
276+ }
277+
188278setup_zephyr_workspace () {
189279 # Check that zephyr/README.md and zephyr/executorch.yaml are in sync.
190280 verify_zephyr_readme
@@ -221,6 +311,7 @@ setup_zephyr_workspace() {
221311 # Install through a temporary local proxy so CI can use SDK release assets
222312 # cached in the Docker image and avoid downloading them in every job.
223313 run_west_sdk_install_with_proxy_fallback
314+ print_zephyr_diagnostics
224315
225316 # Setup git local user for Executorch git to allow
226317 # modules/lib/executorch/examples/arm/setup.sh to run inside CI later.
@@ -246,6 +337,7 @@ use_existing_zephyr_workspace() {
246337
247338if [[ ${SKIP_ZEPHYR_SETUP} -eq 1 ]]; then
248339 use_existing_zephyr_workspace
340+ print_zephyr_diagnostics
249341else
250342 setup_zephyr_workspace
251343fi
@@ -272,6 +364,9 @@ for TARGET in "${TARGETS[@]}"; do
272364 echo " ---- ${TARGET} Board ${BOARD} FVP setup ----"
273365 run_command_block_from_readme " ${ZEPHYR_SAMPLES_README_PATH} " " <!-- RUN setup_${BOARD} -->"
274366
367+ echo " ---- ${TARGET} tool diagnostics before README test blocks ----"
368+ print_zephyr_diagnostics
369+
275370 # Run all blocks that match <!-- RUN test_${target}* -->
276371 run_target_test_blocks_from_readme " ${ZEPHYR_SAMPLES_README_PATH} " " ${TARGET} "
277372done
0 commit comments