net: scripts: Make test runner script fully generic
Move actual test cases from the run-sample-tests.sh script to the network samples directory that are supported by Docker based testing. Each network sample directory that supports Docker testing, will contain docker-test.sh script that is sourced by the runner script. The docker-test.sh script will run the test as needed and then return return value to the runner script. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
03df709a46
commit
d1901d6a2f
10 changed files with 341 additions and 216 deletions
30
samples/net/gptp/docker-test.sh
Normal file
30
samples/net/gptp/docker-test.sh
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Running gPTP sample using Docker testing
|
||||
|
||||
start_configuration || return $?
|
||||
start_docker \
|
||||
"/usr/local/sbin/ptp4l -2 -f /etc/gptp.cfg -m -q -l 6 -S -i eth0" \
|
||||
|| return $?
|
||||
|
||||
# For native_posix gPTP run, the delay threshold needs to be huge
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_RUN_DURATION=10" \
|
||||
"-DCONFIG_NET_GPTP_NEIGHBOR_PROP_DELAY_THR=12000000"
|
||||
|
||||
wait_zephyr
|
||||
gptp_result=$?
|
||||
|
||||
if [ $gptp_result -eq 1 -o $gptp_result -eq 2 ]; then
|
||||
result=0
|
||||
else
|
||||
result=1
|
||||
fi
|
||||
|
||||
stop_docker
|
57
samples/net/mqtt_publisher/docker-test.sh
Normal file
57
samples/net/mqtt_publisher/docker-test.sh
Normal file
|
@ -0,0 +1,57 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting MQTT test"
|
||||
|
||||
start_configuration || return $?
|
||||
start_docker \
|
||||
"/usr/local/sbin/mosquitto -v -c /usr/local/etc/mosquitto/mosquitto.conf" || return $?
|
||||
|
||||
start_zephyr -DOVERLAY_CONFIG=overlay-sample.conf "$overlay"
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
||||
|
||||
stop_docker
|
||||
|
||||
# test TLS
|
||||
echo "Starting MQTT TLS test"
|
||||
|
||||
start_docker \
|
||||
"/usr/local/sbin/mosquitto -v -c /usr/local/etc/mosquitto/mosquitto-tls.conf" || return $?
|
||||
|
||||
start_zephyr -DOVERLAY_CONFIG="overlay-tls.conf overlay-sample.conf" "$overlay"
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
||||
|
||||
stop_docker
|
||||
return $result
|
||||
|
||||
# FIXME: proxy test does not work as expected
|
||||
|
||||
# TLS and SOCKS5, mosquitto TLS is already running
|
||||
echo "Starting MQTT TLS + proxy test"
|
||||
|
||||
start_docker "/usr/sbin/danted" || return $?
|
||||
|
||||
start_zephyr -DOVERLAY_CONFIG="overlay-tls.conf overlay-sample.conf overlay-socks5.conf" "$overlay" || return $?
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
stop_docker
|
19
samples/net/sockets/coap_server/docker-test.sh
Normal file
19
samples/net/sockets/coap_server/docker-test.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start_configuration || return $?
|
||||
start_zephyr
|
||||
start_docker "/net-tools/libcoap/examples/etsi_coaptest.sh -i eth0 192.0.2.1" \
|
||||
|| return $?
|
||||
|
||||
wait $docker_pid
|
||||
result=$?
|
||||
|
||||
stop_docker
|
||||
stop_zephyr
|
64
samples/net/sockets/dumb_http_server_mt/docker-test.sh
Normal file
64
samples/net/sockets/dumb_http_server_mt/docker-test.sh
Normal file
|
@ -0,0 +1,64 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First the non-tls version
|
||||
start_configuration || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SERVE_LARGE_FILE=y" || return $?
|
||||
start_docker "/usr/local/bin/http-get-file-test.sh 5" || return $?
|
||||
wait_docker
|
||||
docker_result=$?
|
||||
|
||||
# curl timeout is return code 28. If we get that, zephyr will never
|
||||
# return so we can just kill it here
|
||||
if [ $docker_result -eq 28 ]; then
|
||||
stop_zephyr
|
||||
result=1
|
||||
else
|
||||
sleep 1
|
||||
wait_zephyr
|
||||
result=$?
|
||||
fi
|
||||
|
||||
stop_docker
|
||||
stop_zephyr
|
||||
|
||||
if [ $result -ne 0 ] || [ $docker_result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
||||
|
||||
# Then the TLS version
|
||||
if [ -n "$zephyr_overlay" ]; then
|
||||
overlay="${zephyr_overlay};overlay-tls.conf"
|
||||
else
|
||||
overlay="-DOVERLAY_CONFIG=overlay-tls.conf"
|
||||
fi
|
||||
|
||||
start_configuration || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SERVE_LARGE_FILE=y" || return $?
|
||||
start_docker "/usr/local/bin/https-get-file-test.sh 5" || return $?
|
||||
wait_docker
|
||||
docker_result=$?
|
||||
|
||||
# curl timeout is return code 28. If we get that, zephyr will never
|
||||
# return so we can just kill it here
|
||||
if [ $docker_result -eq 28 ]; then
|
||||
stop_zephyr
|
||||
result=1
|
||||
else
|
||||
sleep 1
|
||||
wait_zephyr
|
||||
result=$?
|
||||
fi
|
||||
|
||||
stop_docker
|
||||
stop_zephyr
|
||||
|
||||
if [ $result -ne 0 ] || [ $docker_result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
18
samples/net/sockets/echo_client/docker-test.sh
Normal file
18
samples/net/sockets/echo_client/docker-test.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start_configuration "--ip=192.0.2.1 --ip6=2001:db8::1" || return $?
|
||||
start_docker "/net-tools/echo-server -i eth0" || return $?
|
||||
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=10"
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
stop_docker
|
21
samples/net/sockets/echo_server/docker-test.sh
Normal file
21
samples/net/sockets/echo_server/docker-test.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start_configuration || return $?
|
||||
start_zephyr "$overlay" || return $?
|
||||
|
||||
start_docker "/net-tools/echo-client -i eth0 192.0.2.1" \
|
||||
"/net-tools/echo-client -i eth0 2001:db8::1" \
|
||||
"/net-tools/echo-client -i eth0 192.0.2.1 -t" \
|
||||
"/net-tools/echo-client -i eth0 2001:db8::1 -t"
|
||||
|
||||
wait_docker
|
||||
result=$?
|
||||
|
||||
stop_zephyr
|
40
samples/net/sockets/http_client/docker-test.sh
Normal file
40
samples/net/sockets/http_client/docker-test.sh
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Copyright (c) 2020 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
|
||||
echo "Do not run this script directly!"
|
||||
echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First the non-tls version
|
||||
echo "HTTP client test"
|
||||
start_configuration "--ip=192.0.2.2 --ip6=2001:db8::2" || return $?
|
||||
start_docker "/usr/local/bin/http-server.py" || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=5"
|
||||
wait_zephyr
|
||||
result=$?
|
||||
stop_docker
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
||||
|
||||
return $result
|
||||
|
||||
# If everything is ok so far, do the TLS version
|
||||
echo "HTTPS client test"
|
||||
|
||||
if [ -n "$zephyr_overlay" ]; then
|
||||
overlay="${zephyr_overlay};overlay-tls.conf"
|
||||
else
|
||||
overlay="-DOVERLAY_CONFIG=overlay-tls.conf"
|
||||
fi
|
||||
|
||||
start_configuration "--ip=192.0.2.2 --ip6=2001:db8::2" || return $?
|
||||
start_docker "/usr/local/bin/https-server.py 192.0.2.2" \
|
||||
"/usr/local/bin/https-server.py 2001:db8::2" || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=5"
|
||||
wait_zephyr
|
||||
result=$?
|
||||
stop_docker
|
|
@ -1,5 +1,5 @@
|
|||
The shell script run-sample-tests.sh runs a few Zephyr samples against the
|
||||
network test applications container provided by the 'net-tools'
|
||||
The shell script run-sample-tests.sh runs selected Zephyr samples against
|
||||
the network test applications Docker container provided by the 'net-tools'
|
||||
Zephyr project, https://github.com/zephyrproject-rtos/net-tools.
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@ As a prerequisite it is assumed that Docker is installed and that the
|
|||
'net-tools' Docker container has been created, see the first bullet point
|
||||
at the net-tools Docker README file
|
||||
https://github.com/zephyrproject-rtos/net-tools/blob/master/README.docker.
|
||||
|
||||
In essence, the following needs to be done:
|
||||
|
||||
* Install Docker
|
||||
|
@ -25,28 +26,33 @@ its counterpart when testing various network sample applications.
|
|||
Using
|
||||
*****
|
||||
|
||||
The scripts/net/run-sample-tests.sh shell script is meant to be run from a
|
||||
Zephyr network sample test directory. Currently the following samples are
|
||||
supported:
|
||||
The scripts/net/run-sample-tests.sh shell script can be used in two ways:
|
||||
|
||||
* samples/net/sockets/echo_client
|
||||
* samples/net/sockets/echo_server
|
||||
* samples/net/mqtt_publisher
|
||||
1. From a Zephyr network sample test directory.
|
||||
Example:
|
||||
|
||||
The applications to run in the net-tools Docker container are selected based
|
||||
on the base name of the sample directory, for echo_client the echo_server
|
||||
application is started from the Docker container, and with echo_server
|
||||
echo_client is started in the Docker container. With mqtt_publisher mosquitto
|
||||
MQTT server is run in the Docker container.
|
||||
cd samples/net/gptp
|
||||
$ZEPHYR_BASE/scripts/net/run-sample-tests.sh
|
||||
|
||||
2. By giving the test directories as parameters to the runner script.
|
||||
Example:
|
||||
|
||||
cd $ZEPHYR_BASE
|
||||
./scripts/net/run-sample-tests.sh samples/net/gptp \
|
||||
samples/net/sockets/echo_server
|
||||
|
||||
User can see what samples are supported like this:
|
||||
|
||||
$ZEPHYR_BASE/scripts/net/run-sample-tests.sh --scan
|
||||
|
||||
The Docker container and a corresponding 'net-tools0' Docker network is started
|
||||
by the script, as well as Zephyr using native_posix. IP addresses are assigned
|
||||
to the Docker network, which is a Linux network bridge interface. The default
|
||||
IP addresses are:
|
||||
by the script, as well as Zephyr using native_posix board. IP addresses are
|
||||
assigned to the Docker network, which is a Linux network bridge interface.
|
||||
The default IP addresses are:
|
||||
|
||||
* Zephyr uses addresses 192.0.2.1 and 2001:db8::1
|
||||
* Docker net-tools image uses addresses 192.0.2.2 and 2001:db8::2
|
||||
* the Docker bridge interface uses addresses 192.0.2.254 and 2001:db8::254
|
||||
* The Docker bridge interface uses addresses 192.0.2.254 and 2001:db8::254
|
||||
|
||||
The default IP addresses are used by echo_client and mqtt_publisher, but
|
||||
with the echo_server the IP addresses are switched between Zephyr and Docker
|
||||
|
|
|
@ -9,8 +9,12 @@ zephyr_pid=0
|
|||
docker_pid=0
|
||||
configuration=""
|
||||
result=0
|
||||
sample=""
|
||||
dirs=""
|
||||
zephyr_overlay=""
|
||||
docker_test_script_name=docker-test.sh
|
||||
scan_dirs=0
|
||||
|
||||
RUNNING_FROM_MAIN_SCRIPT=1
|
||||
|
||||
check_dirs ()
|
||||
{
|
||||
|
@ -63,6 +67,15 @@ check_dirs ()
|
|||
return 0
|
||||
}
|
||||
|
||||
scan_dirs ()
|
||||
{
|
||||
echo
|
||||
echo "Following directories under $ZEPHYR_BASE can be used by this script:"
|
||||
find "$ZEPHYR_BASE" -type f -name $docker_test_script_name | \
|
||||
awk -F "$ZEPHYR_BASE/" '{ print $2 }' | \
|
||||
sed "s/\/$docker_test_script_name//"
|
||||
}
|
||||
|
||||
start_configuration ()
|
||||
{
|
||||
local bridge_interface=""
|
||||
|
@ -176,7 +189,7 @@ stop_zephyr ()
|
|||
local zephyrs="$zephyr_pid $(list_children "$zephyr_pid")"
|
||||
|
||||
echo "Stopping Zephyr PIDs $zephyrs"
|
||||
kill $zephyrs
|
||||
kill $zephyrs 2> /dev/null
|
||||
fi
|
||||
|
||||
zephyr_pid=0
|
||||
|
@ -222,7 +235,7 @@ stop_docker ()
|
|||
local dockers="$docker_pid $(list_children "$docker_pid")"
|
||||
|
||||
echo "Stopping Docker PIDs $dockers"
|
||||
kill $dockers
|
||||
kill $dockers 2> /dev/null
|
||||
fi
|
||||
|
||||
docker_pid=0
|
||||
|
@ -242,199 +255,18 @@ wait_docker ()
|
|||
return $result
|
||||
}
|
||||
|
||||
docker_exec ()
|
||||
run_test ()
|
||||
{
|
||||
local test="$(basename $(pwd))"
|
||||
local result=0
|
||||
local docker_result=0
|
||||
local overlay=""
|
||||
|
||||
if [ -n "$zephyr_overlay" ]; then
|
||||
overlay="-DOVERLAY_CONFIG=$zephyr_overlay"
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
echo_server)
|
||||
start_configuration || return $?
|
||||
start_zephyr "$overlay" || return $?
|
||||
|
||||
start_docker \
|
||||
"/net-tools/echo-client -i eth0 192.0.2.1" \
|
||||
"/net-tools/echo-client -i eth0 2001:db8::1" \
|
||||
"/net-tools/echo-client -i eth0 192.0.2.1 -t" \
|
||||
"/net-tools/echo-client -i eth0 2001:db8::1 -t"
|
||||
|
||||
wait_docker
|
||||
result=$?
|
||||
|
||||
stop_zephyr
|
||||
;;
|
||||
|
||||
echo_client)
|
||||
start_configuration "--ip=192.0.2.1 --ip6=2001:db8::1" || return $?
|
||||
start_docker "/net-tools/echo-server -i eth0" || return $?
|
||||
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=10"
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
stop_docker
|
||||
;;
|
||||
|
||||
http_client)
|
||||
# First the non-tls version
|
||||
start_configuration "--ip=192.0.2.2 --ip6=2001:db8::2" || return $?
|
||||
start_docker "/usr/local/bin/http-server.py" || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=5"
|
||||
wait_zephyr
|
||||
result=$?
|
||||
stop_docker
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
break;
|
||||
fi
|
||||
|
||||
# If everything is ok so far, do the TLS version
|
||||
if [ -n "$zephyr_overlay" ]; then
|
||||
overlay="${zephyr_overlay};overlay-tls.conf"
|
||||
else
|
||||
overlay="-DOVERLAY_CONFIG=overlay-tls.conf"
|
||||
fi
|
||||
|
||||
start_configuration "--ip=192.0.2.2 --ip6=2001:db8::2" || return $?
|
||||
start_docker "/usr/local/bin/https-server.py" || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=5"
|
||||
wait_zephyr
|
||||
result=$?
|
||||
stop_docker
|
||||
;;
|
||||
|
||||
coap_server)
|
||||
start_configuration || return $?
|
||||
start_zephyr
|
||||
start_docker "/net-tools/libcoap/examples/etsi_coaptest.sh \
|
||||
-i eth0 192.0.2.1" || return $?
|
||||
wait $docker_pid
|
||||
result=$?
|
||||
|
||||
stop_zephyr
|
||||
;;
|
||||
|
||||
dumb_http_server_mt)
|
||||
# First the non-tls version
|
||||
start_configuration || return $?
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SERVE_LARGE_FILE=y" || return $?
|
||||
start_docker "/usr/local/bin/http-get-file-test.sh 5" || return $?
|
||||
wait_docker
|
||||
docker_result=$?
|
||||
|
||||
# curl timeout is return code 28. If we get that, zephyr will never
|
||||
# return so we can just kill it here
|
||||
if [ $docker_result -eq 28 ]; then
|
||||
stop_zephyr
|
||||
result=1
|
||||
else
|
||||
sleep 1
|
||||
wait_zephyr
|
||||
result=$?
|
||||
fi
|
||||
|
||||
stop_docker
|
||||
|
||||
if [ $result -ne 0 ] || [ $docker_result -ne 0 ]; then
|
||||
break;
|
||||
fi
|
||||
;;
|
||||
|
||||
mqtt_publisher)
|
||||
start_configuration || return $?
|
||||
start_docker "/usr/local/sbin/mosquitto -v
|
||||
-c /usr/local/etc/mosquitto/mosquitto.conf" || \
|
||||
return $?
|
||||
|
||||
start_zephyr -DOVERLAY_CONFIG=overlay-sample.conf "$overlay"
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
# test TLS
|
||||
start_docker "/usr/local/sbin/mosquitto -v
|
||||
-c /usr/local/etc/mosquitto/mosquitto-tls.conf" || \
|
||||
return $?
|
||||
|
||||
start_zephyr -DOVERLAY_CONFIG="overlay-tls.conf overlay-sample.conf" \
|
||||
"$overlay"
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
# TLS and SOCKS5, mosquitto TLS is already running
|
||||
start_docker "/usr/sbin/danted" || return $?
|
||||
|
||||
start_zephyr \
|
||||
-DOVERLAY_CONFIG="overlay-tls.conf overlay-sample.conf " \
|
||||
"overlay-socks5.conf" \
|
||||
"$overlay" || return $?
|
||||
|
||||
wait_zephyr
|
||||
result=$?
|
||||
|
||||
stop_docker
|
||||
|
||||
return $result
|
||||
;;
|
||||
|
||||
gptp)
|
||||
start_configuration || return $?
|
||||
start_docker \
|
||||
"/usr/local/sbin/ptp4l -2 -f /etc/gptp.cfg -m -q -l 6 -S -i eth0" \
|
||||
|| return $?
|
||||
|
||||
# For native_posix gPTP run, the delay threshold needs to be huge
|
||||
start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_RUN_DURATION=10" \
|
||||
"-DCONFIG_NET_GPTP_NEIGHBOR_PROP_DELAY_THR=12000000"
|
||||
|
||||
wait_zephyr
|
||||
gptp_result=$?
|
||||
|
||||
if [ $gptp_result -eq 1 -o $gptp_result -eq 2 ]; then
|
||||
result=0
|
||||
else
|
||||
result=1
|
||||
fi
|
||||
|
||||
stop_docker
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "No sample test corresponding to directory '$1' found" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
run_test ()
|
||||
{
|
||||
local test="$(basename $(pwd))"
|
||||
local result=0
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
source "$1"
|
||||
result=$?
|
||||
else
|
||||
docker_exec "$test"
|
||||
result=$?
|
||||
fi
|
||||
source "$1"
|
||||
result=$?
|
||||
|
||||
if [ $result -eq 0 ]; then
|
||||
echo "Sample '$test' successful"
|
||||
|
@ -451,7 +283,7 @@ usage ()
|
|||
|
||||
cat <<EOF
|
||||
|
||||
$BASENAME [-Z <zephyr base directory>] [-N <net-tools base directory>] [<test script>]
|
||||
$BASENAME [-Z <zephyr base directory>] [-N <net-tools base directory>] [<list of test directories>]
|
||||
|
||||
This script runs Zephyr sample tests using Docker container and
|
||||
network implemented by the 'net-tools' subproject.
|
||||
|
@ -468,8 +300,10 @@ network implemented by the 'net-tools' subproject.
|
|||
keep Docker container and network after test
|
||||
--overlay <config files>
|
||||
additional configuration/overlay files for the Zephyr build process
|
||||
<test script>
|
||||
sample script to run instead of test based on current directory
|
||||
--scan
|
||||
find out the directories that can be used for this testing
|
||||
<list of test directories>
|
||||
run the tests in these directories instead of current directory
|
||||
|
||||
The automatically detected directories are:
|
||||
EOF
|
||||
|
@ -532,17 +366,16 @@ do
|
|||
fi
|
||||
;;
|
||||
|
||||
--scan)
|
||||
scan_dirs=1
|
||||
;;
|
||||
-*)
|
||||
echo "Argument '$1' not recognised" >&2
|
||||
usage
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
if [ -n "$sample" ]; then
|
||||
echo "Sample already specified" >&2
|
||||
return 1
|
||||
fi
|
||||
sample="$1"
|
||||
dirs="$dirs $1"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -551,14 +384,51 @@ done
|
|||
|
||||
check_dirs || exit $?
|
||||
|
||||
if [ $scan_dirs -eq 1 ]; then
|
||||
scan_dirs
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$configuration" -o "$configuration" = "start_only" -o \
|
||||
"$configuration" = "keep" ]; then
|
||||
if [ "$configuration" = start_only ]; then
|
||||
start_configuration
|
||||
result=$?
|
||||
else
|
||||
run_test "$sample"
|
||||
result=$?
|
||||
result=0
|
||||
found=0
|
||||
|
||||
if [ -z "$dirs" ]; then
|
||||
dirs="."
|
||||
fi
|
||||
|
||||
for d in $dirs; do
|
||||
if [ ! -d "$d" ]; then
|
||||
echo "No such directory $d, skipping it"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ ! -f "$d/$docker_test_script_name" ]; then
|
||||
echo "No such file $d/$docker_test_script_name, skipping directory"
|
||||
continue
|
||||
fi
|
||||
|
||||
found=$(expr $found + 1)
|
||||
|
||||
CURR_DIR=`pwd`
|
||||
cd "$d"
|
||||
run_test "./$docker_test_script_name"
|
||||
test_result=$?
|
||||
cd "$CURR_DIR"
|
||||
|
||||
if [ $test_result -ne 0 ]; then
|
||||
result=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
2
west.yml
2
west.yml
|
@ -99,7 +99,7 @@ manifest:
|
|||
revision: f28a637db12c4b12fb2b18bddc6b2a0deaa95251
|
||||
path: modules/lib/mcumgr
|
||||
- name: net-tools
|
||||
revision: c72fbf3300264a8a4bb48be314ca93765c863a19
|
||||
revision: dcfa04f4aaf30ae7c2dbf34a05a569ca1c04b2ce
|
||||
path: tools/net-tools
|
||||
- name: hal_nxp
|
||||
revision: 56915d2942a3af7205b3c4991a8b87e915de7f59
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue