diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 915a81fd4..12b966eca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,14 +53,16 @@ jobs: clang-format-6.0 --version python3 -m pip install yapf - name: Check - run: script/make-pretty check + run: | + script/make-pretty check package: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Package - run: script/test package + run: | + script/test package scan-build: runs-on: ubuntu-18.04 @@ -73,7 +75,8 @@ jobs: sudo apt-get autoremove sudo apt-get --no-install-recommends install -y clang-tools - name: Run - run: script/check-scan-build + run: | + script/check-scan-build arm-gcc-4: runs-on: ubuntu-18.04 @@ -158,9 +161,12 @@ jobs: steps: - uses: actions/checkout@v2 - name: Bootstrap - run: sudo apt-get --no-install-recommends install -y gcc-5 g++-5 ninja-build + run: | + sudo apt-get --no-install-recommends install -y gcc-5 g++-5 ninja-build - name: Build - run: script/check-simulation-build + run: | + script/check-simulation-build + script/check-posix-build gcc-6: runs-on: ubuntu-18.04 @@ -170,9 +176,12 @@ jobs: steps: - uses: actions/checkout@v2 - name: Bootstrap - run: sudo apt-get --no-install-recommends install -y gcc-6 g++-6 ninja-build + run: | + sudo apt-get --no-install-recommends install -y gcc-6 g++-6 ninja-build - name: Build - run: script/check-simulation-build + run: | + script/check-simulation-build + script/check-posix-build gcc-7: runs-on: ubuntu-18.04 @@ -182,9 +191,12 @@ jobs: steps: - uses: actions/checkout@v2 - name: Bootstrap - run: sudo apt-get --no-install-recommends install -y gcc-7 g++-7 ninja-build + run: | + sudo apt-get --no-install-recommends install -y gcc-7 g++-7 ninja-build - name: Build - run: script/check-simulation-build + run: | + script/check-simulation-build + script/check-posix-build gcc-8: runs-on: ubuntu-18.04 @@ -194,9 +206,12 @@ jobs: steps: - uses: actions/checkout@v2 - name: Bootstrap - run: sudo apt-get --no-install-recommends install -y gcc-8 g++-8 ninja-build + run: | + sudo apt-get --no-install-recommends install -y gcc-8 g++-8 ninja-build - name: Build - run: script/check-simulation-build + run: | + script/check-simulation-build + script/check-posix-build gcc-9: runs-on: ubuntu-18.04 @@ -206,15 +221,36 @@ jobs: steps: - uses: actions/checkout@v2 - name: Bootstrap - run: sudo apt-get --no-install-recommends install -y gcc-9 g++-9 ninja-build + run: | + sudo apt-get --no-install-recommends install -y gcc-9 g++-9 ninja-build - name: Build - run: script/check-simulation-build + run: | + script/check-simulation-build + script/check-posix-build + + gn: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + run: | + sudo apt-get --no-install-recommends install -y ninja-build + cd /tmp + wget -O gn.zip https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest + unzip -o gn.zip + chmod a+x gn && mkdir -p bin && mv -f gn bin/ + - name: Build + run: | + export PATH=/tmp/bin:$PATH + script/check-gn-build macos: runs-on: macos-10.15 steps: - uses: actions/checkout@v2 - name: Bootstrap - run: brew install automake ninja + run: | + brew install automake ninja - name: Build - run: script/check-simulation-build + run: | + script/check-simulation-build diff --git a/.github/workflows/simulation.yml b/.github/workflows/simulation.yml index 40ffb49a8..a508d2793 100644 --- a/.github/workflows/simulation.yml +++ b/.github/workflows/simulation.yml @@ -40,6 +40,27 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" if: "github.ref != 'refs/heads/master'" + distcheck: + runs-on: ubuntu-18.04 + env: + CC: clang + CXX: clang++ + REFERENCE_DEVICE: 1 + VIRTUAL_TIME: 1 + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + run: | + sudo apt --no-install-recommends install -y llvm-runtime + python3 -m pip install -r tests/scripts/thread-cert/requirements.txt + - name: Run + run: | + export ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer` + export ASAN_OPTIONS=symbolize=1 + export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_SIMULATION_VIRTUAL_TIME=1 + ./bootstrap + make -f examples/Makefile-simulation distcheck + cli-ftd: runs-on: ubuntu-18.04 env: @@ -60,7 +81,8 @@ jobs: ./bootstrap make -f examples/Makefile-simulation - name: Run - run: make -f examples/Makefile-simulation check + run: | + make -f examples/Makefile-simulation check - name: Codecov uses: codecov/codecov-action@v1 @@ -85,7 +107,34 @@ jobs: ./bootstrap make -f examples/Makefile-simulation - name: Run - run: make -f examples/Makefile-simulation check + run: | + make -f examples/Makefile-simulation check + - name: Codecov + uses: codecov/codecov-action@v1 + + cli-time-sync: + runs-on: ubuntu-18.04 + env: + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 + COVERAGE: 1 + REFERENCE_DEVICE: 1 + TIME_SYNC: 1 + VIRTUAL_TIME: 1 + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + run: | + sudo apt --no-install-recommends install -y g++-multilib + python3 -m pip install -r tests/scripts/thread-cert/requirements.txt + - name: Build + run: | + ./bootstrap + make -f examples/Makefile-simulation + - name: Run + run: | + make -f examples/Makefile-simulation check - name: Codecov uses: codecov/codecov-action@v1 @@ -113,7 +162,8 @@ jobs: ./bootstrap make -f examples/Makefile-simulation - name: Run - run: make -f examples/Makefile-simulation check + run: | + make -f examples/Makefile-simulation check - name: Codecov uses: codecov/codecov-action@v1 @@ -138,7 +188,8 @@ jobs: make -f examples/Makefile-simulation make -f src/posix/Makefile-posix - name: Run - run: OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli) -v" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check + run: | + OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli) -v" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check - name: Codecov uses: codecov/codecov-action@v1 @@ -166,7 +217,27 @@ jobs: make -f examples/Makefile-simulation make -f src/posix/Makefile-posix - name: Run - run: OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check + run: | + OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check + - name: Codecov + uses: codecov/codecov-action@v1 + + posix-ncp-rcp-migrate: + runs-on: ubuntu-18.04 + env: + COVERAGE: 1 + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + run: | + sudo apt --no-install-recommends install -y expect + - name: Build + run: | + ./bootstrap + script/check-ncp-rcp-migrate build + - name: Run + run: | + script/check-ncp-rcp-migrate check - name: Codecov uses: codecov/codecov-action@v1 @@ -190,10 +261,10 @@ jobs: - name: Build run: | ./bootstrap - .travis/check-posix-pty build + script/check-posix-pty build - name: Run run: | - .travis/check-posix-pty check + script/check-posix-pty check - name: Codecov uses: codecov/codecov-action@v1 @@ -218,10 +289,10 @@ jobs: - name: Build run: | ./bootstrap - .travis/check-posix-pty build + script/check-posix-pty build - name: Run run: | - .travis/check-posix-pty check + script/check-posix-pty check - name: Codecov uses: codecov/codecov-action@v1 @@ -247,7 +318,8 @@ jobs: sudo make -j2 sudo make install - name: Build & Run - run: top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh + run: | + top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh - name: Codecov uses: codecov/codecov-action@v1 @@ -274,13 +346,18 @@ jobs: sudo make -j2 sudo make install - name: Build & Run - run: top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh + run: | + top_builddir=$(pwd)/build/toranj ./tests/toranj/start.sh - name: Codecov uses: codecov/codecov-action@v1 thread-1-2: runs-on: ubuntu-18.04 env: + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 + COVERAGE: 1 THREAD_VERSION: 1.2 VIRTUAL_TIME: 1 steps: diff --git a/.travis.yml b/.travis.yml index e9afcce9a..91b56c4a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,23 +40,8 @@ before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi -after_success: - - .travis/after_success.sh - -stages: - - lint - - test - jobs: include: - - env: BUILD_TARGET="posix-migrate" VERBOSE=1 COVERAGE=1 - os: linux - compiler: clang - script: .travis/script.sh - - env: BUILD_TARGET="posix-spi" VERBOSE=1 COVERAGE=1 - os: linux - compiler: gcc - script: .travis/script.sh - env: BUILD_TARGET="android-build" VERBOSE=1 os: linux dist: trusty @@ -67,22 +52,7 @@ jobs: dist: trusty python: "2.7" # The old Android build system only supports python2 script: .travis/script.sh - - env: BUILD_TARGET="gn-build" VERBOSE=1 - os: linux - script: .travis/script.sh - - env: BUILD_TARGET="simulation-distcheck" VERBOSE=1 VIRTUAL_TIME=1 - os: linux - compiler: clang - script: .travis/script.sh - - env: BUILD_TARGET="simulation-32-bit" VERBOSE=1 VIRTUAL_TIME=1 TIME_SYNC=1 - os: linux - compiler: gcc - script: .travis/script.sh - - env: BUILD_TARGET="simulation-ncp-spi" VERBOSE=1 - os: linux - compiler: gcc - script: .travis/script.sh - - stage: lint + - env: name: "Size Report" os: linux script: .travis/check-size diff --git a/examples/platforms/simulation/virtual_time/platform-sim.c b/examples/platforms/simulation/virtual_time/platform-sim.c index 8226fe6fc..b676b5a39 100644 --- a/examples/platforms/simulation/virtual_time/platform-sim.c +++ b/examples/platforms/simulation/virtual_time/platform-sim.c @@ -196,7 +196,7 @@ static void socket_init(void) sPortOffset *= WELLKNOWN_NODE_ID; } - sockaddr.sin_port = htons(9000 + sPortOffset + gNodeId); + sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset + gNodeId)); sockaddr.sin_addr.s_addr = INADDR_ANY; sSockFd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); diff --git a/.travis/check-gn-build b/script/check-gn-build similarity index 100% rename from .travis/check-gn-build rename to script/check-gn-build diff --git a/.travis/check-ncp-rcp-migrate b/script/check-ncp-rcp-migrate similarity index 98% rename from .travis/check-ncp-rcp-migrate rename to script/check-ncp-rcp-migrate index 4c0775b7b..06e8757ca 100755 --- a/.travis/check-ncp-rcp-migrate +++ b/script/check-ncp-rcp-migrate @@ -129,6 +129,9 @@ EOF main() { case "$1" in + build) + build + ;; check) check ;; diff --git a/script/check-posix-build b/script/check-posix-build new file mode 100755 index 000000000..3e96afa94 --- /dev/null +++ b/script/check-posix-build @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set -euxo pipefail + +main() +{ + "$(dirname "$0")"/check-posix-build-autotools +} + +main "$@" diff --git a/script/check-posix-build-autotools b/script/check-posix-build-autotools new file mode 100755 index 000000000..c32c86209 --- /dev/null +++ b/script/check-posix-build-autotools @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Copyright (c) 2020, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set -euxo pipefail + +readonly OT_BUILD_JOBS=$(getconf _NPROCESSORS_ONLN) + +reset_source() +{ + rm -rf build output tmp +} + +build() +{ + reset_source + make -f src/posix/Makefile-posix + + reset_source + make -f src/posix/Makefile-posix RCP_SP=1 +} + +main() +{ + ./bootstrap + + build +} + +main "$@" diff --git a/.travis/check-posix-pty b/script/check-posix-pty similarity index 100% rename from .travis/check-posix-pty rename to script/check-posix-pty