iop: Refactor, extract to separate function.

This commit is contained in:
Ronny Nilsson 2020-11-08 01:10:53 +01:00
parent f49c4f4a64
commit fe86ade858

View file

@ -5,9 +5,8 @@
# https://dev.iopsys.eu/iopsys/iopsys-taas # https://dev.iopsys.eu/iopsys/iopsys-taas
function smoketest { #--------------------------------------------------------------
local image app function taas-init() {
# Path to TaaS binarys. Try some likely ones. # Path to TaaS binarys. Try some likely ones.
if ! which taas-smoketest >/dev/null; then if ! which taas-smoketest >/dev/null; then
PATH="${PATH}:${PWD}/../iopsys-taas/bin" PATH="${PATH}:${PWD}/../iopsys-taas/bin"
@ -34,6 +33,15 @@ function smoketest {
exit 1 exit 1
fi fi
done done
}
#--------------------------------------------------------------
function taas-smoketest {
local image app
taas-init || return
# Find the default latest image (.y3 or FIT). # Find the default latest image (.y3 or FIT).
for image in bin/targets/iopsys-*/generic/last.y3 \ for image in bin/targets/iopsys-*/generic/last.y3 \
@ -56,7 +64,7 @@ function smoketest {
esac esac
if [ -n "$product" ]; then if [ -n "$product" ]; then
taas-smoketest "$image" "$product" || exit command taas-smoketest "$image" "$product" || exit
echo "Smoketest OK" echo "Smoketest OK"
else else
echo "Unsupported target; skipping smoketest." echo "Unsupported target; skipping smoketest."
@ -69,5 +77,5 @@ function smoketest {
exit 1 exit 1
} }
register_command "smoketest" "Write image to a device in the lab and check if it boots up." register_command "taas-smoketest" "Write image to a device in the lab and check if it boots up."