Skip to content

Commit 24ef605

Browse files
committed
Zephyr: Add a lot of debuginfo during testing
Signed-off-by: Zingo Andersen <Zingo.Andersen@arm.com> Change-Id: I6e7f8d3ac08f8e557a131a5371c4b2dcbcda6ce9
1 parent 9a522c6 commit 24ef605

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

.ci/scripts/test_zephyr.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,89 @@ 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+
205+
echo "${label}: ${path}"
206+
if [[ -e "${path}" ]]; then
207+
ls -ld "${path}" || true
208+
file "${path}" || true
209+
if [[ -x "${path}" ]]; then
210+
"${path}" --version || true
211+
fi
212+
else
213+
echo "${label}: missing"
214+
fi
215+
}
216+
217+
print_zephyr_diagnostics() {
218+
local sdk_version sdk_dir
219+
220+
echo "---- Zephyr diagnostics ----"
221+
echo "uname -a: $(uname -a)"
222+
echo "uname -m: $(uname -m)"
223+
echo "PATH: ${PATH}"
224+
echo "VIRTUAL_ENV: ${VIRTUAL_ENV:-<unset>}"
225+
echo "ZEPHYR_PROJ_ROOT: ${ZEPHYR_PROJ_ROOT:-<unset>}"
226+
echo "EXECUTORCH_PROJ_ROOT: ${EXECUTORCH_PROJ_ROOT}"
227+
echo "ZEPHYR_SDK_INSTALL_DIR: ${ZEPHYR_SDK_INSTALL_DIR:-<unset>}"
228+
echo "ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT:-<unset>}"
229+
echo "ZEPHYR_SDK_RELEASE_PROXY_CACHE_DIR: ${ZEPHYR_SDK_RELEASE_PROXY_CACHE_DIR:-<unset>}"
230+
231+
sdk_version="$(python3 "${EXECUTORCH_PROJ_ROOT}/.ci/docker/common/zephyr_sdk_release_proxy.py" --print-version)"
232+
echo "Zephyr SDK version: ${sdk_version}"
233+
echo "Zephyr SDK release assets for this host:"
234+
python3 - <<PY
235+
import importlib.util
236+
spec = importlib.util.spec_from_file_location(
237+
"zephyr_sdk_release_proxy",
238+
"${EXECUTORCH_PROJ_ROOT}/.ci/docker/common/zephyr_sdk_release_proxy.py",
239+
)
240+
module = importlib.util.module_from_spec(spec)
241+
spec.loader.exec_module(module)
242+
print("host_tuple:", module.host_tuple())
243+
for name in module.asset_names("${sdk_version}", "arm-zephyr-eabi"):
244+
print(" ", name)
245+
PY
246+
247+
for sdk_dir in \
248+
"${HOME}/zephyr-sdk-${sdk_version}" \
249+
"/opt/zephyr-sdk-${sdk_version}" \
250+
"/var/lib/ci-user/zephyr-sdk-${sdk_version}"; do
251+
if [[ -d "${sdk_dir}" ]]; then
252+
echo "Found Zephyr SDK dir: ${sdk_dir}"
253+
print_path_details "SDK dtc" "${sdk_dir}/hosttools/sysroots/x86_64-pokysdk-linux/usr/bin/dtc"
254+
print_path_details "SDK arm-zephyr-eabi-g++" "${sdk_dir}/gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++"
255+
print_path_details "SDK arm-zephyr-eabi-gcc" "${sdk_dir}/gnu/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc"
256+
fi
257+
done
258+
259+
print_tool_details python3
260+
print_tool_details cmake
261+
print_tool_details west
262+
print_tool_details dtc
263+
print_tool_details arm-zephyr-eabi-gcc
264+
print_tool_details arm-zephyr-eabi-g++
265+
266+
echo "pip packages:"
267+
python3 -m pip list | grep -E '^(cmake|west|pyelftools|ninja|jsonschema|setuptools|pip)[[:space:]]' || true
268+
echo "---- End Zephyr diagnostics ----"
269+
}
270+
188271
setup_zephyr_workspace() {
189272
# Check that zephyr/README.md and zephyr/executorch.yaml are in sync.
190273
verify_zephyr_readme
@@ -221,6 +304,7 @@ setup_zephyr_workspace() {
221304
# Install through a temporary local proxy so CI can use SDK release assets
222305
# cached in the Docker image and avoid downloading them in every job.
223306
run_west_sdk_install_with_proxy_fallback
307+
print_zephyr_diagnostics
224308

225309
# Setup git local user for Executorch git to allow
226310
# modules/lib/executorch/examples/arm/setup.sh to run inside CI later.
@@ -246,6 +330,7 @@ use_existing_zephyr_workspace() {
246330

247331
if [[ ${SKIP_ZEPHYR_SETUP} -eq 1 ]]; then
248332
use_existing_zephyr_workspace
333+
print_zephyr_diagnostics
249334
else
250335
setup_zephyr_workspace
251336
fi

0 commit comments

Comments
 (0)