From 1265456f931d12c4d584040918539f3d18b9abb7 Mon Sep 17 00:00:00 2001 From: Jerry Johns Date: Wed, 23 Jun 2021 15:09:41 -0700 Subject: [PATCH] Enable TSAN builds on CI (#7797) * Enable TSAN builds on CI for Functional Tests. This enables TSAN checking when running the functional tests in CI. This is currently only enabled on Linux since the various races there were fixed when #7478 landed. When Darwin races are fixed, tsan can be enabled for those too. * Fix-ups as per review feedback, including enabling it for Darwin * Increased timeout for tsan jobs since it takes some time! * Increased timeout for tsan jobs since it takes some time (real fix)! --- .github/workflows/tests.yaml | 58 ++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 08c5d30f3beaeb..5553cccdfbc611 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -28,6 +28,10 @@ jobs: name: Test Suites - Linux timeout-minutes: 60 + strategy: + matrix: + type: [debug, tsan] + if: github.actor != 'restyled-io[bot]' runs-on: ubuntu-latest @@ -54,25 +58,37 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: bootstrap-logs + name: bootstrap-logs-${{ matrix.type }} path: | .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build all clusters app timeout-minutes: 5 run: | - scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false + case ${{ matrix.type }} in + "debug") GN_ARGS='is_tsan=false';; + "tsan") GN_ARGS='is_tsan=true';; + *) ;; + esac + + scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false "$GN_ARGS" - name: Build chip-tool timeout-minutes: 5 run: | - scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ + case ${{ matrix.type }} in + "debug") GN_ARGS='is_tsan=false';; + "tsan") GN_ARGS='is_tsan=true';; + *) ;; + esac + + scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ "$GN_ARGS" - name: Copy objdir run: | # The idea is to not upload our objdir unless builds have # actually succeeded, because that just wastes space. rsync -a out/debug/standalone/ objdir-clone || true - name: Run Tests - timeout-minutes: 5 + timeout-minutes: 10 run: | ifconfig -a scripts/tests/test_suites.sh @@ -80,7 +96,7 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ failure() }} with: - name: crash-core-linux + name: crash-core-linux-${{ matrix.type }} path: /tmp/cores/ # Cores are big; don't hold on to them too long. retention-days: 5 @@ -88,7 +104,7 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ failure() }} with: - name: crash-objdir-linux + name: crash-objdir-linux-${{ matrix.type }} path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 @@ -96,6 +112,10 @@ jobs: name: Test Suites - Darwin timeout-minutes: 60 + strategy: + matrix: + type: [debug, tsan] + if: github.actor != 'restyled-io[bot]' runs-on: macos-latest @@ -127,32 +147,44 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: bootstrap-logs + name: bootstrap-logs-${{ matrix.type }} path: | .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Run Build Test Server timeout-minutes: 5 run: | - scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false + case ${{ matrix.type }} in + "debug") GN_ARGS='is_tsan=false';; + "tsan") GN_ARGS='is_tsan=true';; + *) ;; + esac + + scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false "$GN_ARGS" - name: Build chip-tool timeout-minutes: 5 run: | - scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ + case ${{ matrix.type }} in + "debug") GN_ARGS='is_tsan=false';; + "tsan") GN_ARGS='is_tsan=true';; + *) ;; + esac + + scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ "$GN_ARGS" - name: Copy objdir run: | # The idea is to not upload our objdir unless builds have # actually succeeded, because that just wastes space. rsync -a out/debug/standalone/ objdir-clone || true - name: Run Test Suites - timeout-minutes: 5 + timeout-minutes: 10 run: | scripts/tests/test_suites.sh - name: Uploading core files uses: actions/upload-artifact@v2 if: ${{ failure() }} with: - name: crash-core-darwin + name: crash-core-darwin-${{ matrix.type }} path: /cores/ # Cores are big; don't hold on to them too long. retention-days: 5 @@ -160,13 +192,13 @@ jobs: uses: actions/upload-artifact@v2 if: ${{ failure() }} with: - name: crash-log-darwin + name: crash-log-darwin-${{ matrix.type }} path: ~/Library/Logs/DiagnosticReports/ - name: Uploading objdir for debugging uses: actions/upload-artifact@v2 if: ${{ failure() }} with: - name: crash-objdir-darwin + name: crash-objdir-darwin-${{ matrix.type }} path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5