|
| 1 | +# SPDX-License-Identifier: Apache-2.0 |
| 2 | +# Experimental, for the experiment/272-dump-ir branch only, not for main: runs the check of the |
| 3 | +# --dump-ir file names that #272 adds with three analyzers built on one runner, as the CI builds |
| 4 | +# them. main and #272 before the fix write two inputs with the same file name to one file: the |
| 5 | +# check must fail with them. With the fixed head of #272 it must pass. Each runs it 20 times, as |
| 6 | +# two inputs that load at once do not always write the shared file together. |
| 7 | +name: Check the dump-ir file names |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [experiment/272-dump-ir] |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: dump-ir-names |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +env: |
| 21 | + MAIN_SHA: 6ae059ba258382c4573c809603cdbb6023958a48 |
| 22 | + BEFORE_SHA: f46066ee3ee91a99b89873ef87775c8fc27ccc78 |
| 23 | + FIXED_SHA: fc214b53bca25ee3a81691adbb88afa93d8451f2 |
| 24 | + M: /work/scripts/scripts/bench/dump-ir-names |
| 25 | + |
| 26 | +defaults: |
| 27 | + run: |
| 28 | + shell: bash |
| 29 | + |
| 30 | +jobs: |
| 31 | + check: |
| 32 | + name: The check with main, #272 before the fix and #272 fixed |
| 33 | + runs-on: ubuntu-24.04 |
| 34 | + timeout-minutes: 60 |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + # The three commits are needed next to the branch's. |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + # As ci.yml does on Linux, without ccache: every build here is a cold one. |
| 42 | + - name: Install dependencies |
| 43 | + run: | |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get install -y build-essential cmake python3 \ |
| 46 | + ninja-build lld libz3-dev pkg-config |
| 47 | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - |
| 48 | + UBUNTU_CODENAME=$(lsb_release -cs) |
| 49 | + sudo apt-add-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-20 main" |
| 50 | + sudo apt-get update |
| 51 | + sudo apt-get install -y llvm-20 llvm-20-dev clang-20 libclang-20-dev |
| 52 | +
|
| 53 | + - name: Lay out the three source trees |
| 54 | + run: | |
| 55 | + sudo mkdir -p /work |
| 56 | + sudo chown "$(id -u):$(id -g)" /work |
| 57 | + mkdir -p /work/out |
| 58 | + git worktree add --detach /work/scripts HEAD |
| 59 | + git worktree add --detach /work/main "$MAIN_SHA" |
| 60 | + git worktree add --detach /work/before "$BEFORE_SHA" |
| 61 | + git worktree add --detach /work/fixed "$FIXED_SHA" |
| 62 | + # The fixed head is #272 before the fix and the commits of the fix, nothing else. |
| 63 | + test "$(git merge-base "$BEFORE_SHA" "$FIXED_SHA")" = "$BEFORE_SHA" |
| 64 | + { |
| 65 | + echo "main $MAIN_SHA" |
| 66 | + echo "before $BEFORE_SHA" |
| 67 | + echo "fixed $FIXED_SHA" |
| 68 | + git diff --stat "$BEFORE_SHA" "$FIXED_SHA" |
| 69 | + echo "scripts $(git rev-parse HEAD)" |
| 70 | + lscpu | grep -E '^ *(Model name|CPU\(s\)):' |
| 71 | + uname -r |
| 72 | + c++ --version | head -1 |
| 73 | + } | tee /work/out/machine.txt |
| 74 | +
|
| 75 | + - name: Build main |
| 76 | + run: bash "$M/build.sh" main |
| 77 | + |
| 78 | + - name: Build 272 before the fix |
| 79 | + run: bash "$M/build.sh" before |
| 80 | + |
| 81 | + - name: Build 272 fixed |
| 82 | + run: bash "$M/build.sh" fixed |
| 83 | + |
| 84 | + - name: The check with main's analyzer (must fail) |
| 85 | + if: ${{ !cancelled() }} |
| 86 | + timeout-minutes: 10 |
| 87 | + run: | |
| 88 | + python3 -u "$M/with_analyzer.py" /work/main/build/stack_usage_analyzer fail 20 \ |
| 89 | + 2>&1 | tee /work/out/check-main.log |
| 90 | +
|
| 91 | + - name: The check with the analyzer of 272 before the fix (must fail) |
| 92 | + if: ${{ !cancelled() }} |
| 93 | + timeout-minutes: 10 |
| 94 | + run: | |
| 95 | + python3 -u "$M/with_analyzer.py" /work/before/build/stack_usage_analyzer fail 20 \ |
| 96 | + 2>&1 | tee /work/out/check-before.log |
| 97 | +
|
| 98 | + - name: The check with the analyzer of 272 fixed (must pass) |
| 99 | + if: ${{ !cancelled() }} |
| 100 | + timeout-minutes: 10 |
| 101 | + run: | |
| 102 | + python3 -u "$M/with_analyzer.py" /work/fixed/build/stack_usage_analyzer pass 20 \ |
| 103 | + 2>&1 | tee /work/out/check-fixed.log |
| 104 | +
|
| 105 | + - name: Summary |
| 106 | + if: always() |
| 107 | + run: | |
| 108 | + { |
| 109 | + echo '### The check of the dump-ir file names' |
| 110 | + echo '```' |
| 111 | + cat /work/out/machine.txt 2>/dev/null || true |
| 112 | + grep -hE '^with |^as expected' /work/out/check-main.log /work/out/check-before.log /work/out/check-fixed.log 2>/dev/null || true |
| 113 | + echo '```' |
| 114 | + } >> "$GITHUB_STEP_SUMMARY" |
| 115 | +
|
| 116 | + - name: Keep the results |
| 117 | + if: always() |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: dump-ir-names |
| 121 | + path: /work/out |
| 122 | + retention-days: 90 |
0 commit comments