diff --git a/script/test b/script/test index b9a5ee442..69a657201 100755 --- a/script/test +++ b/script/test @@ -51,6 +51,7 @@ readonly INTER_OP_BBR="${INTER_OP_BBR:-1}" readonly OT_COREDUMP_DIR="${PWD}/ot-core-dump" readonly FULL_LOGS=${FULL_LOGS:-0} readonly TREL=${TREL:-0} +readonly LOCAL_OTBR_DIR=${LOCAL_OTBR_DIR:-""} build_simulation() { @@ -296,7 +297,12 @@ do_build_otbr_docker() otdir=$(pwd) ( - ./script/git-tool clone https://github.com/openthread/ot-br-posix.git --depth 1 "${otbrdir}" + if [[ -z ${LOCAL_OTBR_DIR} ]]; then + ./script/git-tool clone https://github.com/openthread/ot-br-posix.git --depth 1 "${otbrdir}" + else + cp -r "${LOCAL_OTBR_DIR}"/* "${otbrdir}" + rm -rf "${otbrdir}"/build + fi cd "${otbrdir}" rm -rf third_party/openthread/repo cp -r "${otdir}" third_party/openthread/repo diff --git a/tests/scripts/thread-cert/border_router/README.md b/tests/scripts/thread-cert/border_router/README.md new file mode 100644 index 000000000..32cd7df47 --- /dev/null +++ b/tests/scripts/thread-cert/border_router/README.md @@ -0,0 +1,25 @@ +# OpenThread Border Router Tests + +## Run Border Router (BR) tests locally + +BR tests run in isolated Docker network and containers, so a new OTBR Docker image needs to be created before running these tests: + +```shell +# Use root privilege when necessary. + +# Download OpenThread's branch of wireshark. Run this for the first time. +./script/test get_thread_wireshark + +# Clear current OpenThread directory (remember to add new source files). +git clean -xfd + +# Rebuild the OTBR Docker image if OTBR source code is updated. +LOCAL_OTBR_DIR=$HOME/ot-br-posix ./script/test build_otbr_docker + +# Build simulated OpenThread firmware. +VIRTUAL_TIME=0 ./script/test build + +# Run the BR tests locally. +TEST_CASE=./tests/scripts/thread-cert/border_router/test_advertising_proxy.py +VERBOSE=1 PACKET_VERIFICATION=1 VIRTUAL_TIME=0 ./script/test cert_suite ${TEST_CASE} +```