Add support for TaaS smoketesting of images.

For developers and Jenkins etc. A short hand command for
testing the just built image on real hardware. To be
used before pushing commits and nightly images to public.
This commit is contained in:
Ronny Nilsson 2020-10-28 16:11:16 +01:00
parent 8c69fc062a
commit b098ef3dc2
2 changed files with 74 additions and 1 deletions

View file

@ -35,7 +35,7 @@ _iop()
iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \
feeds_update genconfig generate_tarballs install_key \
scp_changes setup_host ssh_install_key status \
update_package update_feed_branches ssh_upgrade"
update_package update_feed_branches ssh_upgrade smoketest"
if [ $COMP_CWORD -eq 1 ] ; then

73
iop/scripts/smoketest.sh Normal file
View file

@ -0,0 +1,73 @@
# Shorthand command for doing a HIL runtime smoketest on the
# latest built image. Does the image boot up correctly?
# More info here:
# https://dev.iopsys.eu/iopsys/iopsys-taas
function smoketest {
local image app
# Path to TaaS binarys. Try some likely ones.
if ! which taas-smoketest >/dev/null; then
PATH="${PATH}:${PWD}/../iopsys-taas/bin"
PATH="${PATH}:${PWD}/../taas/bin"
PATH="${PATH}:${HOME}/iopsys-taas/bin"
PATH="${PATH}:${HOME}/taas/bin"
PATH="${PATH}:${HOME}/bin"
PATH="${PATH}:/opt/iopsys-taas/bin"
PATH="${PATH}:/opt/taas/bin"
fi
if ! which taas-smoketest >/dev/null; then
echo "Error; missing command \"taas-smoketest\". Install it with:"
echo "git clone git@dev.iopsys.eu:iopsys/iopsys-taas.git ../iopsys-taas"
exit 1
fi
# Prerequisites?
for app in expect socat timeout stdbuf bash env head strings \
tee cut tr grep curl ssh; do
if ! which $app >/dev/null; then
echo "Error; missing command \"$app\""
echo "Install it from your Linux distro!"
exit 1
fi
done
# Find the default latest image (.y3 or FIT).
for image in bin/targets/iopsys-*/generic/last.y3 \
bin/targets/iopsys-*/generic/last.pkgtb; do
[ -s "$image" ] || continue
# Convert Iopsys target name to the TaaS product name format.
product=$(grep CONFIG_TARGET_PROFILE .config | \
tr -s "=\"" " " | cut -d " " -f 2)
case "$product" in
smarthub3)
product="SmartHub3a"
;;
dg400prime|eg400)
product=$(echo -n "$product" | tr [[:lower:]] [[:upper:]])
;;
*)
product=""
;;
esac
if [ -n "$product" ]; then
taas-smoketest "$image" "$product" || exit
echo "Smoketest OK"
else
echo "Unsupported target; skipping smoketest."
fi
exit 0
done
echo "No image found"
exit 1
}
register_command "smoketest" "Write image to a device in the lab and check if it boots up."