Skip to content

Commit

Permalink
[script] Bugfix: enable 'test' script to properly build and test for …
Browse files Browse the repository at this point in the history
…a custom OT node pointed to from OT_DIR. This is required for OpenThread CI.
  • Loading branch information
EskoDijk committed Sep 24, 2024
1 parent abd86ba commit 0de3e3b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ jobs:
run: |
docker build -t otns-env -f etc/docker/environment/Dockerfile .
docker run -t -v$PWD:/otns otns-env -c "./script/pack-web"
if ! git diff --quiet; then
echo "script/pack-web was not properly executed:"
git diff
exit 1
fi
git diff --quiet
- name: Build custom OT node
# Note: OT_CMAKE_NINJA_TARGET excludes tests because test_platform.cpp is missing otPlatAssertFail()
run: |
./script/install-deps
./script/setup-dev
cd ot-rfsim
OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build
4 changes: 4 additions & 0 deletions ot-rfsim/script/build
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@

set -euxo pipefail

# shellcheck source=../script/utils.sh
. "$(dirname "$0")"/../../script/utils.sh

OTRFSIM_SRCDIR="$(pwd)"
OT_DIR=${OT_DIR:-../openthread}
OT_DIR=$(realpathf "${OT_DIR}")
OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET-}
readonly OTRFSIM_SRCDIR
readonly OT_DIR
Expand Down
2 changes: 1 addition & 1 deletion ot-rfsim/script/build_br
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ main()
local options=()
options+=("${OTBR_OPTIONS[@]}" "$@")

OT_DIR="../openthread" OTNS_NODE_TYPE="br" OT_CMAKE_NINJA_TARGET="ot-cli-ftd" ./script/build "${options[@]}"
OTNS_NODE_TYPE="br" OT_CMAKE_NINJA_TARGET="ot-cli-ftd" ./script/build "${options[@]}"

cp ./build/br/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_br
}
Expand Down
2 changes: 1 addition & 1 deletion ot-rfsim/script/build_latest
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ main()
local options=()
options+=("${OT_OPTIONS[@]}" "$@")

OT_DIR="../openthread" OTNS_NODE_TYPE="latest" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}"
OTNS_NODE_TYPE="latest" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}"

cp ./build/latest/bin/ot-cli-ftd ./ot-versions/
cp ./build/latest/bin/ot-cli-mtd ./ot-versions/
Expand Down
7 changes: 6 additions & 1 deletion script/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ fi
SCRIPTDIR=$(realpathf "$(dirname "$0")")
export readonly SCRIPTDIR

OTNSDIR=$(realpathf "$SCRIPTDIR"/..)
OTNSDIR=$(realpathf "${SCRIPTDIR}"/..)
export readonly OTNSDIR

OT_DIR=${OT_DIR:-./openthread}
OT_DIR=$(realpathf "${OT_DIR}")
export readonly OT_DIR

GOPATH=$(go env GOPATH)
export readonly GOPATH
export PATH=$PATH:"$GOPATH"/bin
Expand Down Expand Up @@ -117,6 +121,7 @@ build_openthread_br()
)
}

# Note: any environment var OT_DIR is not used for legacy node version (1.1, 1.2, 1.3) builds.
build_openthread_versions()
{
get_openthread_versions
Expand Down
4 changes: 2 additions & 2 deletions script/test
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ py_examples()
install_deps
activate_python_venv
install_otns
build_openthread_br
build_openthread
build_openthread_br

check_py_example "$OTNSDIR"/pylibs/examples/simple.py
check_py_example "$OTNSDIR"/pylibs/examples/form_partition.py
Expand All @@ -151,8 +151,8 @@ stress_tests()
install_deps
activate_python_venv
install_otns
build_openthread_br
build_openthread
build_openthread_br

python3 "$OTNSDIR"/pylibs/stress_tests/run_stress_suite.py "$@"
}
Expand Down

0 comments on commit 0de3e3b

Please sign in to comment.