[travis] test parent selection rules (#4423)

This commit has five scenarios to test the four Mesh Impacting
Criteria and one Child Impacting Criterion (version).
This commit is contained in:
Rongli Sun
2020-02-25 14:34:53 -08:00
committed by Jonathan Hui
parent 835d9e2505
commit b339a8946b
8 changed files with 448 additions and 46 deletions
+37 -16
View File
@@ -37,19 +37,35 @@ readonly SYSTEM_TRIPLET="$(third_party/nlbuild-autotools/repo/third_party/autoco
export top_builddir="build/${SYSTEM_TRIPLET}"
do_build() {
if [[ -n "${RADIO_DEVICE}" && "${VIRTUAL_TIME}" = 1 ]]; then
VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix
else
make -f examples/Makefile-posix
./bootstrap
if [ "${VIRTUAL_TIME}" = 1 ]; then
OPTIONS="VIRTUAL_TIME_UART=1"
fi
make -f examples/Makefile-posix ${OPTIONS}
if [[ -n "${RADIO_DEVICE}" ]]; then
make -f src/posix/Makefile-posix
fi
# Extra 1.1 build for 1.2 env
if [ "${THREAD_VERSION}" = "1.2" ]; then
./bootstrap
OPTIONS="TargetTuple=${SYSTEM_TRIPLET}-1.1 THREAD_VERSION=1.1 ${OPTIONS}"
make -f examples/Makefile-posix ${OPTIONS}
if [[ -n "${RADIO_DEVICE}" ]]; then
make -f src/posix/Makefile-posix
fi
fi
}
do_clean() {
rm -rfv "build/${SYSTEM_TRIPLET}" "build/posix/${SYSTEM_TRIPLET}"
# Extra 1.1 clean for 1.2 env
if [ "${THREAD_VERSION}" = "1.2" ]; then
rm -rfv "build/${SYSTEM_TRIPLET}-1.1" "build/posix/${SYSTEM_TRIPLET}-1.1"
fi
}
do_cert() {
@@ -57,13 +73,6 @@ do_cert() {
PYTHONUNBUFFERED=1 "$1"
}
do_v1_2() {
ls tests/scripts/thread-cert/v1_2_*.py | while read test_case; do
[[ ! -d tmp ]] || rm -rvf tmp
PYTHONUNBUFFERED=1 "${test_case}"
done
}
print_usage() {
echo "USAGE: [ENVIRONMENTS] $0 COMMANDS
@@ -71,6 +80,7 @@ ENVIRONMENTS:
NODE_TYPE 'sim' for CLI, 'ncp-sim' for NCP. The default is 'sim'.
NODE_MODE 'transceiver' for transceiver mode, otherwise for standalone mode. The default is standalone mode.
VIRTUAL_TIME 1 for virtual time, otherwise real time. The default is 1
THREAD_VERSION 1.1 for Thread 1.1 stack, 1.2 for Thread 1.2 stack. The default is 1.1.
COMMANDS:
clean Clean built files to prepare for new build.
@@ -94,7 +104,11 @@ EXAMPLES:
# Test CLI with real time
VIRTUAL_TIME=0 $0 clean build cert tests/scripts/thread-cert/Cert_5_1_01_RouterAttach.py
VIRTUAL_TIME=0 $0 cert tests/scripts/thread-cert/Cert_5_1_02_ChildAddressTimeout.py
"
# Test Thread 1.2 with real time
THREAD_VERSION=1.2 VIRTUAL_TIME=0 $0 clean build cert tests/scripts/thread-cert/v1_2_router_5_1_1.py
THREAD_VERSION=1.2 VIRTUAL_TIME=0 $0 clean build cert tests/scripts/thread-cert/v1_2_test_parent_selection.py
"
exit $1
}
@@ -104,11 +118,21 @@ main()
export NODE_TYPE="${NODE_TYPE:-sim}"
export VERBOSE="${VERBOSE:-1}"
export VIRTUAL_TIME="${VIRTUAL_TIME:-1}"
export THREAD_VERSION="${THREAD_VERSION:-1.1}"
if [ "${THREAD_VERSION}" = "1.2" ]; then
export top_builddir_1_1="build/${SYSTEM_TRIPLET}-1.1"
fi
if [[ "${NODE_MODE}" = 'transceiver' ]] ; then
export RADIO_DEVICE="build/${SYSTEM_TRIPLET}/examples/apps/ncp/ot-rcp"
export OT_CLI_PATH="build/posix/${SYSTEM_TRIPLET}/src/posix/ot-cli"
export OT_NCP_PATH="build/posix/${SYSTEM_TRIPLET}/src/posix/ot-ncp"
if [ "${THREAD_VERSION}" = "1.2" ]; then
export RADIO_DEVICE_1_1="build/${SYSTEM_TRIPLET}-1.1/examples/apps/ncp/ot-rcp"
export OT_CLI_PATH_1_1="build/posix/${SYSTEM_TRIPLET}-1.1/src/posix/ot-cli"
export OT_NCP_PATH_1_1="build/posix/${SYSTEM_TRIPLET}-1.1/src/posix/ot-ncp"
fi
fi
if [[ -z "$1" ]]; then
@@ -118,6 +142,7 @@ main()
[[ -n "${RADIO_DEVICE}" ]] && echo "Using transceiver mode" || echo "Using standalone mode"
[[ "${NODE_TYPE}" = "ncp-sim" ]] && echo "Using NCP node" || echo "Using CLI node"
[[ "${VIRTUAL_TIME}" = 1 ]] && echo "Using virtual time" || echo "Using real time"
[[ "${THREAD_VERSION}" = "1.2" ]] && echo "Using Thread 1.2 stack" || echo "Using Thread 1.1 stack"
while [[ -n "$1" ]]; do
case "$1" in
@@ -131,10 +156,6 @@ main()
shift
do_cert "$1"
;;
v1.2)
do_v1_2
break
;;
help)
print_usage
;;