1# 2# Copyright (c) 2020, The OpenThread Authors. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. 9# 2. Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# 3. Neither the name of the copyright holder nor the 13# names of its contributors may be used to endorse or promote products 14# derived from this software without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26# POSSIBILITY OF SUCH DAMAGE. 27# 28 29name: Simulation 1.3 30 31on: [push, pull_request] 32 33jobs: 34 35 cancel-previous-runs: 36 runs-on: ubuntu-20.04 37 steps: 38 - uses: rokroskar/workflow-run-cleanup-action@master 39 env: 40 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 41 if: "github.ref != 'refs/heads/main'" 42 43 thread-1-3: 44 name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }} 45 runs-on: ubuntu-20.04 46 env: 47 CFLAGS: -${{ matrix.arch }} 48 CXXFLAGS: -${{ matrix.arch }} 49 LDFLAGS: -${{ matrix.arch }} 50 COVERAGE: 1 51 THREAD_VERSION: 1.3 52 VIRTUAL_TIME: 1 53 INTER_OP: 1 54 CC: ${{ matrix.compiler.c }} 55 CXX: ${{ matrix.compiler.cxx }} 56 strategy: 57 fail-fast: false 58 matrix: 59 compiler: [{c: "gcc", cxx: "g++", gcov: "gcc"}, { c: "clang-10", cxx: "clang++-10", gcov: "llvm"}] 60 arch: ["m32", "m64"] 61 steps: 62 - uses: actions/checkout@v2 63 with: 64 submodules: true 65 - name: Bootstrap 66 run: | 67 sudo dpkg --add-architecture i386 68 sudo apt-get update 69 sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov 70 sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386 71 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 72 - name: Build 73 run: | 74 ./script/test build 75 - name: Run 76 run: | 77 ulimit -c unlimited 78 ./script/test prepare_coredump_upload 79 ./script/test unit 80 ./script/test cert_suite tests/scripts/thread-cert/v1_2_* 81 - name: Check Crash 82 if: ${{ failure() }} 83 run: | 84 CRASHED=$(./script/test check_crash | tail -1) 85 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 86 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 87 - uses: actions/upload-artifact@v2 88 if: ${{ failure() }} 89 with: 90 name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps 91 path: "*.pcap" 92 - uses: actions/upload-artifact@v2 93 if: ${{ failure() && env.CRASHED == '1' }} 94 with: 95 name: core-packet-verification-thread-1-3 96 path: | 97 ./ot-core-dump/* 98 - name: Generate Coverage 99 run: | 100 ./script/test generate_coverage "${{ matrix.compiler.gcov }}" 101 - uses: actions/upload-artifact@v2 102 with: 103 name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }} 104 path: tmp/coverage.info 105 106 packet-verification-low-power: 107 runs-on: ubuntu-20.04 108 env: 109 REFERENCE_DEVICE: 1 110 VIRTUAL_TIME: 1 111 COVERAGE: 1 112 PACKET_VERIFICATION: 1 113 THREAD_VERSION: 1.3 114 MAC_FILTER: 1 115 INTER_OP: 1 116 INTER_OP_BBR: 0 117 steps: 118 - uses: actions/checkout@v2 119 with: 120 submodules: true 121 - name: Bootstrap 122 run: | 123 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 124 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel ninja-build lcov 125 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 126 - name: Build 127 run: | 128 ./script/test build 129 - name: Get Thread-Wireshark 130 run: | 131 ./script/test get_thread_wireshark 132 - name: Run 133 run: | 134 ulimit -c unlimited 135 ./script/test prepare_coredump_upload 136 for i in {1..10} 137 do 138 ./script/test cert_suite ./tests/scripts/thread-cert/v1_2_LowPower*.py 139 done 140 - name: Check Crash 141 if: ${{ failure() }} 142 run: | 143 CRASHED=$(./script/test check_crash | tail -1) 144 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 145 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 146 - uses: actions/upload-artifact@v2 147 if: ${{ failure() }} 148 with: 149 name: packet-verification-low-power-pcaps 150 path: | 151 *.pcap 152 *.json 153 - uses: actions/upload-artifact@v2 154 if: ${{ failure() && env.CRASHED == '1' }} 155 with: 156 name: core-packet-verification-low-power 157 path: | 158 ./ot-core-dump/* 159 - name: Generate Coverage 160 run: | 161 ./script/test generate_coverage gcc 162 - uses: actions/upload-artifact@v2 163 with: 164 name: cov-packet-verification-low-power 165 path: tmp/coverage.info 166 167 packet-verification-1-1-on-1-3: 168 runs-on: ubuntu-20.04 169 env: 170 REFERENCE_DEVICE: 1 171 VIRTUAL_TIME: 1 172 PACKET_VERIFICATION: 1 173 THREAD_VERSION: 1.3 174 MULTIPLY: 3 175 steps: 176 - uses: actions/checkout@v2 177 with: 178 submodules: true 179 - name: Bootstrap 180 run: | 181 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 182 sudo apt-get --no-install-recommends install -y g++-multilib python3-setuptools python3-wheel ninja-build lcov 183 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 184 - name: Build 185 run: | 186 ./script/test build 187 - name: Get Thread-Wireshark 188 run: | 189 ./script/test get_thread_wireshark 190 - name: Run 191 run: | 192 ./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py 193 - uses: actions/upload-artifact@v2 194 if: ${{ failure() }} 195 with: 196 name: packet-verification-1.1-on-1.3-pcaps 197 path: | 198 *.pcap 199 *.json 200 - name: Generate Coverage 201 run: | 202 ./script/test generate_coverage gcc 203 - uses: actions/upload-artifact@v2 204 with: 205 name: cov-packet-verification-1-1-on-1-3 206 path: tmp/coverage.info 207 208 expects: 209 runs-on: ubuntu-20.04 210 env: 211 COVERAGE: 1 212 THREAD_VERSION: 1.3 213 VIRTUAL_TIME: 0 214 steps: 215 - uses: actions/checkout@v2 216 with: 217 submodules: true 218 - name: Bootstrap 219 run: | 220 sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat 221 - name: Run RCP Mode 222 run: | 223 ulimit -c unlimited 224 ./script/test prepare_coredump_upload 225 OT_OPTIONS=-DOT_READLINE=OFF OT_NODE_TYPE=rcp ./script/test build expect 226 - name: Check Crash 227 if: ${{ failure() }} 228 run: | 229 CRASHED=$(./script/test check_crash | tail -1) 230 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 231 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 232 - uses: actions/upload-artifact@v2 233 if: ${{ failure() && env.CRASHED == '1' }} 234 with: 235 name: core-expect-1-3 236 path: | 237 ./ot-core-dump/* 238 - name: Generate Coverage 239 run: | 240 ./script/test generate_coverage gcc 241 - uses: actions/upload-artifact@v2 242 with: 243 name: cov-expects 244 path: tmp/coverage.info 245 246 thread-1-3-posix: 247 runs-on: ubuntu-20.04 248 env: 249 COVERAGE: 1 250 PYTHONUNBUFFERED: 1 251 READLINE: readline 252 THREAD_VERSION: 1.3 253 OT_NODE_TYPE: rcp 254 USE_MTD: 1 255 VIRTUAL_TIME: 1 256 INTER_OP: 1 257 steps: 258 - uses: actions/checkout@v2 259 with: 260 submodules: true 261 - name: Bootstrap 262 run: | 263 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 264 sudo apt-get --no-install-recommends install -y libreadline6-dev g++-multilib ninja-build python3-setuptools python3-wheel llvm lcov 265 python3 -m pip install -r tests/scripts/thread-cert/requirements.txt 266 - name: Build 267 run: | 268 ./script/test build 269 - name: Run 270 run: | 271 ulimit -c unlimited 272 ./script/test prepare_coredump_upload 273 ./script/test cert tests/scripts/thread-cert/v1_2_LowPower_5_3_01_SSEDAttachment.py 274 ./script/test cert tests/scripts/thread-cert/v1_2_LowPower_6_1_07_PreferringARouterOverAReed.py 275 ./script/test cert tests/scripts/thread-cert/v1_2_router_5_1_1.py 276 ./script/test cert tests/scripts/thread-cert/v1_2_test_csl_transmission.py 277 ./script/test cert tests/scripts/thread-cert/v1_2_test_enhanced_frame_pending.py 278 ./script/test cert tests/scripts/thread-cert/v1_2_test_parent_selection.py 279 - name: Check Crash 280 if: ${{ failure() }} 281 run: | 282 CRASHED=$(./script/test check_crash | tail -1) 283 [[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed." 284 echo "CRASHED=$CRASHED" >> $GITHUB_ENV 285 - uses: actions/upload-artifact@v2 286 if: ${{ failure() }} 287 with: 288 name: thread-1-3-posix-pcaps 289 path: "*.pcap" 290 - uses: actions/upload-artifact@v2 291 if: ${{ failure() && env.CRASHED == '1' }} 292 with: 293 name: core-thread-1-3-posix 294 path: | 295 ./ot-core-dump/* 296 - name: Generate Coverage 297 run: | 298 ./script/test generate_coverage gcc 299 - uses: actions/upload-artifact@v2 300 with: 301 name: cov-thread-1-3-posix 302 path: tmp/coverage.info 303 304 upload-coverage: 305 needs: 306 - thread-1-3 307 - packet-verification-low-power 308 - packet-verification-1-1-on-1-3 309 - expects 310 - thread-1-3-posix 311 runs-on: ubuntu-20.04 312 steps: 313 - uses: actions/checkout@v2 314 with: 315 submodules: true 316 - name: Bootstrap 317 run: | 318 sudo apt-get --no-install-recommends install -y lcov 319 - uses: actions/download-artifact@v2 320 with: 321 path: coverage/ 322 - name: Combine Coverage 323 run: | 324 script/test combine_coverage 325 - name: Upload Coverage 326 uses: codecov/codecov-action@v2 327 with: 328 files: final.info 329 fail_ci_if_error: true 330 331 delete-coverage-artifacts: 332 needs: upload-coverage 333 runs-on: ubuntu-20.04 334 steps: 335 - uses: geekyeggo/delete-artifact@1-glob-support 336 with: 337 name: cov-* 338 useGlob: true 339