@@ -185,6 +185,97 @@ 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+ echo " EXECUTORCH_ZEPHYR_DTC: ${EXECUTORCH_ZEPHYR_DTC:- <unset>} "
238+
239+ sdk_version=" $( python3 " ${EXECUTORCH_PROJ_ROOT} /.ci/docker/common/zephyr_sdk_release_proxy.py" --print-version) "
240+ echo " Zephyr SDK version: ${sdk_version} "
241+ echo " Zephyr SDK release assets for this host:"
242+ python3 - << PY
243+ import importlib.util
244+ spec = importlib.util.spec_from_file_location(
245+ "zephyr_sdk_release_proxy",
246+ "${EXECUTORCH_PROJ_ROOT} /.ci/docker/common/zephyr_sdk_release_proxy.py",
247+ )
248+ module = importlib.util.module_from_spec(spec)
249+ spec.loader.exec_module(module)
250+ print("host_tuple:", module.host_tuple())
251+ for name in module.asset_names("${sdk_version} ", "arm-zephyr-eabi"):
252+ print(" ", name)
253+ PY
254+
255+ for sdk_dir in \
256+ " ${HOME} /zephyr-sdk-${sdk_version} " \
257+ " /opt/zephyr-sdk-${sdk_version} " \
258+ " /var/lib/ci-user/zephyr-sdk-${sdk_version} " ; do
259+ if [[ -d " ${sdk_dir} " ]]; then
260+ echo " Found Zephyr SDK dir: ${sdk_dir} "
261+ print_path_details " SDK dtc" " ${sdk_dir} /hosttools/sysroots/x86_64-pokysdk-linux/usr/bin/dtc"
262+ print_path_details " SDK arm-zephyr-eabi-g++" " ${sdk_dir} /gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++"
263+ print_path_details " SDK arm-zephyr-eabi-gcc" " ${sdk_dir} /gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc"
264+ fi
265+ done
266+
267+ print_tool_details python3
268+ print_tool_details cmake
269+ print_tool_details west
270+ print_tool_details dtc
271+ print_tool_details arm-zephyr-eabi-gcc
272+ print_tool_details arm-zephyr-eabi-g++
273+
274+ echo " pip packages:"
275+ python3 -m pip list | grep -E ' ^(cmake|west|pyelftools|ninja|jsonschema|setuptools|pip)[[:space:]]' || true
276+ echo " ---- End Zephyr diagnostics ----"
277+ }
278+
188279setup_zephyr_workspace () {
189280 # Check that zephyr/README.md and zephyr/executorch.yaml are in sync.
190281 verify_zephyr_readme
@@ -221,6 +312,7 @@ setup_zephyr_workspace() {
221312 # Install through a temporary local proxy so CI can use SDK release assets
222313 # cached in the Docker image and avoid downloading them in every job.
223314 run_west_sdk_install_with_proxy_fallback
315+ print_zephyr_diagnostics
224316
225317 # Setup git local user for Executorch git to allow
226318 # modules/lib/executorch/examples/arm/setup.sh to run inside CI later.
@@ -246,6 +338,7 @@ use_existing_zephyr_workspace() {
246338
247339if [[ ${SKIP_ZEPHYR_SETUP} -eq 1 ]]; then
248340 use_existing_zephyr_workspace
341+ print_zephyr_diagnostics
249342else
250343 setup_zephyr_workspace
251344fi
@@ -272,6 +365,9 @@ for TARGET in "${TARGETS[@]}"; do
272365 echo " ---- ${TARGET} Board ${BOARD} FVP setup ----"
273366 run_command_block_from_readme " ${ZEPHYR_SAMPLES_README_PATH} " " <!-- RUN setup_${BOARD} -->"
274367
368+ echo " ---- ${TARGET} tool diagnostics before README test blocks ----"
369+ print_zephyr_diagnostics
370+
275371 # Run all blocks that match <!-- RUN test_${target}* -->
276372 run_target_test_blocks_from_readme " ${ZEPHYR_SAMPLES_README_PATH} " " ${TARGET} "
277373done
0 commit comments