Message ID | 170082812879.386590.6862078032421168979.stgit@ebuild |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev] ci: Add clang-analyze to GitHub actions. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/intel-ovs-compilation | success | test: success |
Hi Aaron, Guess the Robot does some magic checkout resulting in no parent branch. Can you let me know how the branch for the run gets created, so I can figure out how to change the script to find the base branch? Thanks, Eelco On 24 Nov 2023, at 14:00, 0-day Robot wrote: > From: robot@bytheb.org > > Test-Label: github-robot: Build and Test > Test-Status: fail > http://patchwork.ozlabs.org/api/patches/1868140/ > > _github build: failed_ > Build URL: https://github.com/ovsrobot/ovs/actions/runs/6980823251 > Build Logs: > -----------------------Summary of failed steps----------------------- > "clang-analyze" failed at step checkout default branch > ----------------------End summary of failed steps-------------------- > > -------------------------------BEGIN LOGS---------------------------- > #################################################################################### > #### [Begin job log] "clang-analyze" at step checkout default branch > #################################################################################### > * [new tag] v2.7.5 -> v2.7.5 > * [new tag] v2.7.6 -> v2.7.6 > * [new tag] v2.7.7 -> v2.7.7 > * [new tag] v2.8.0 -> v2.8.0 > * [new tag] v2.8.1 -> v2.8.1 > * [new tag] v2.8.2 -> v2.8.2 > * [new tag] v2.8.3 -> v2.8.3 > * [new tag] v2.8.4 -> v2.8.4 > * [new tag] v2.8.5 -> v2.8.5 > * [new tag] v2.9.0 -> v2.9.0 > * [new tag] v2.9.1 -> v2.9.1 > * [new tag] v2.9.2 -> v2.9.2 > * [new tag] v2.9.3 -> v2.9.3 > [command]/usr/bin/git rev-parse --verify --quiet 0000000000000000000000000000000000000000^{object} > [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin 0000000000000000000000000000000000000000 > ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 > The process '/usr/bin/git' failed with exit code 128 > Waiting 14 seconds before trying again > [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin 0000000000000000000000000000000000000000 > ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 > The process '/usr/bin/git' failed with exit code 128 > Waiting 12 seconds before trying again > [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin 0000000000000000000000000000000000000000 > ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 > ##[error]The process '/usr/bin/git' failed with exit code 128 > #################################################################################### > #### [End job log] "clang-analyze" at step checkout default branch > #################################################################################### > --------------------------------END LOGS-----------------------------
Eelco Chaudron <echaudro@redhat.com> writes: > Hi Aaron, > > Guess the Robot does some magic checkout resulting in no parent branch. This is actually a failure with the github build. Robot simply pushes to the series branch. > Can you let me know how the branch for the run gets created, so I can > figure out how to change the script to find the base branch? We rely on the github infra to do this checkout correctly. Seems it didn't. :-/ > Thanks, > > Eelco > > > On 24 Nov 2023, at 14:00, 0-day Robot wrote: > >> From: robot@bytheb.org >> >> Test-Label: github-robot: Build and Test >> Test-Status: fail >> http://patchwork.ozlabs.org/api/patches/1868140/ >> >> _github build: failed_ >> Build URL: https://github.com/ovsrobot/ovs/actions/runs/6980823251 >> Build Logs: >> -----------------------Summary of failed steps----------------------- >> "clang-analyze" failed at step checkout default branch >> ----------------------End summary of failed steps-------------------- >> >> -------------------------------BEGIN LOGS---------------------------- >> #################################################################################### >> #### [Begin job log] "clang-analyze" at step checkout default branch >> #################################################################################### >> * [new tag] v2.7.5 -> v2.7.5 >> * [new tag] v2.7.6 -> v2.7.6 >> * [new tag] v2.7.7 -> v2.7.7 >> * [new tag] v2.8.0 -> v2.8.0 >> * [new tag] v2.8.1 -> v2.8.1 >> * [new tag] v2.8.2 -> v2.8.2 >> * [new tag] v2.8.3 -> v2.8.3 >> * [new tag] v2.8.4 -> v2.8.4 >> * [new tag] v2.8.5 -> v2.8.5 >> * [new tag] v2.9.0 -> v2.9.0 >> * [new tag] v2.9.1 -> v2.9.1 >> * [new tag] v2.9.2 -> v2.9.2 >> * [new tag] v2.9.3 -> v2.9.3 >> [command]/usr/bin/git rev-parse --verify --quiet 0000000000000000000000000000000000000000^{object} >> [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune >> --progress --no-recurse-submodules origin >> 0000000000000000000000000000000000000000 >> ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 >> The process '/usr/bin/git' failed with exit code 128 >> Waiting 14 seconds before trying again >> [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune >> --progress --no-recurse-submodules origin >> 0000000000000000000000000000000000000000 >> ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 >> The process '/usr/bin/git' failed with exit code 128 >> Waiting 12 seconds before trying again >> [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune >> --progress --no-recurse-submodules origin >> 0000000000000000000000000000000000000000 >> ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 >> ##[error]The process '/usr/bin/git' failed with exit code 128 >> #################################################################################### >> #### [End job log] "clang-analyze" at step checkout default branch >> #################################################################################### >> --------------------------------END LOGS-----------------------------
> Op 27 nov 2023 om 18:23 heeft Aaron Conole <aconole@redhat.com> het volgende geschreven: > > Eelco Chaudron <echaudro@redhat.com> writes: > >> Hi Aaron, >> >> Guess the Robot does some magic checkout resulting in no parent branch. > > This is actually a failure with the github build. Robot simply pushes > to the series branch. > >> Can you let me know how the branch for the run gets created, so I can >> figure out how to change the script to find the base branch? > It was my code :( I was testing with a forced push branch and than a ref exists. Will sent a v2 after dinner. > We rely on the github infra to do this checkout correctly. Seems it > didn't. > > :-/ > >> Thanks, >> >> Eelco >> >> >>> On 24 Nov 2023, at 14:00, 0-day Robot wrote: >>> >>> From: robot@bytheb.org >>> >>> Test-Label: github-robot: Build and Test >>> Test-Status: fail >>> http://patchwork.ozlabs.org/api/patches/1868140/ >>> >>> _github build: failed_ >>> Build URL: https://github.com/ovsrobot/ovs/actions/runs/6980823251 >>> Build Logs: >>> -----------------------Summary of failed steps----------------------- >>> "clang-analyze" failed at step checkout default branch >>> ----------------------End summary of failed steps-------------------- >>> >>> -------------------------------BEGIN LOGS---------------------------- >>> #################################################################################### >>> #### [Begin job log] "clang-analyze" at step checkout default branch >>> #################################################################################### >>> * [new tag] v2.7.5 -> v2.7.5 >>> * [new tag] v2.7.6 -> v2.7.6 >>> * [new tag] v2.7.7 -> v2.7.7 >>> * [new tag] v2.8.0 -> v2.8.0 >>> * [new tag] v2.8.1 -> v2.8.1 >>> * [new tag] v2.8.2 -> v2.8.2 >>> * [new tag] v2.8.3 -> v2.8.3 >>> * [new tag] v2.8.4 -> v2.8.4 >>> * [new tag] v2.8.5 -> v2.8.5 >>> * [new tag] v2.9.0 -> v2.9.0 >>> * [new tag] v2.9.1 -> v2.9.1 >>> * [new tag] v2.9.2 -> v2.9.2 >>> * [new tag] v2.9.3 -> v2.9.3 >>> [command]/usr/bin/git rev-parse --verify --quiet 0000000000000000000000000000000000000000^{object} >>> [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune >>> --progress --no-recurse-submodules origin >>> 0000000000000000000000000000000000000000 >>> ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 >>> The process '/usr/bin/git' failed with exit code 128 >>> Waiting 14 seconds before trying again >>> [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune >>> --progress --no-recurse-submodules origin >>> 0000000000000000000000000000000000000000 >>> ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 >>> The process '/usr/bin/git' failed with exit code 128 >>> Waiting 12 seconds before trying again >>> [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune >>> --progress --no-recurse-submodules origin >>> 0000000000000000000000000000000000000000 >>> ##[error]fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000 >>> ##[error]The process '/usr/bin/git' failed with exit code 128 >>> #################################################################################### >>> #### [End job log] "clang-analyze" at step checkout default branch >>> #################################################################################### >>> --------------------------------END LOGS----------------------------- >
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index aa2ecc505..6b251835d 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -49,6 +49,30 @@ function build_ovs() make -j4 } +function clang_analyze() +{ + [ -d "./upstream-clang-analyzer-results" ] && cache_build=false \ + || cache_build=true + if [ "$cache_build" = true ]; then + # If this is a cache build, proceed to the upstream branch's directory. + cd upstream_ovs_main + fi; + + configure_ovs $OPTS + make clean + scan-build -o ./clang-analyzer-results -sarif --use-cc=clang make -j4 + + if [ "$cache_build" = true ]; then + # Move results, so it will be picked up by the cache. + mv ./clang-analyzer-results ../upstream-clang-analyzer-results + cd .. + else + # Only do the compare on the none cache builds. + sarif --check note diff ./upstream-clang-analyzer-results \ + ./clang-analyzer-results/ + fi; +} + if [ "$DEB_PACKAGE" ]; then ./boot.sh && ./configure --with-dpdk=$DPDK && make debian mk-build-deps --install --root-cmd sudo --remove debian/control @@ -116,6 +140,11 @@ fi OPTS="${EXTRA_OPTS} ${OPTS} $*" +if [ "$CLANG_ANALYZE" ]; then + clang_analyze + exit 0 +fi + if [ "$TESTSUITE" = 'test' ]; then # 'distcheck' will reconfigure with required options. # Now we only need to prepare the Makefile without sparse-wrapped CC. diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 09654205e..f1ed6f718 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -223,6 +223,86 @@ jobs: name: logs-linux-${{ join(matrix.*, '-') }} path: logs.tgz + build-clang-analyze: + needs: build-dpdk + env: + dependencies: | + automake bc clang-tools libbpf-dev libnuma-dev libpcap-dev \ + libunbound-dev libunwind-dev libssl-dev libtool llvm-dev \ + python3-unbound + CC: clang + DPDK: dpdk + CLANG_ANALYZE: true + name: clang-analyze + runs-on: ubuntu-22.04 + timeout-minutes: 30 + + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: checkout default branch + uses: actions/checkout@v3 + with: + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} + fetch-depth: 0 + path: upstream_ovs_main + + - name: update PATH + run: | + echo "$HOME/bin" >> $GITHUB_PATH + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: generate cache key + id: cache_key + run: | + echo "key=clang-analyze-$(git -C upstream_ovs_main rev-parse HEAD)" \ + >> $GITHUB_OUTPUT + + - name: check for analyzer result cache + id: clang_cache + uses: actions/cache@v3 + with: + path: upstream-clang-analyzer-results + key: ${{ steps.cache_key.outputs.key }} + + - name: set up python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: get cached dpdk-dir + uses: actions/cache/restore@v3 + with: + path: dpdk-dir + key: ${{ needs.build-dpdk.outputs.dpdk_key }} + + - name: update APT cache + run: sudo apt update || true + + - name: install common dependencies + run: sudo apt install -y ${{ env.dependencies }} + + - name: install sarif tools + run: sudo pip3 install --disable-pip-version-check sarif-tools + + - name: prepare + run: ./.ci/linux-prepare.sh + + - name: build upstream reference + if: steps.clang_cache.outputs.cache-hit != 'true' + run: ./.ci/linux-build.sh + + - name: build + run: ./.ci/linux-build.sh + + - name: save cache + uses: actions/cache/save@v3 + if: always() && steps.clang_cache.outputs.cache-hit != 'true' + with: + path: upstream-clang-analyzer-results + key: ${{ steps.cache_key.outputs.key }} + build-osx: env: CC: clang
This patch detects new static analyze issues, and report them. It does this by reporting on the delta for this branch, compared to the previous branch. For example the error might look like this: error level: +0 -0 no changes warning level: +2 +0 New issue "deadcode.DeadStores Value stored to 'remote' is never read" (1 occurrence) file:///home/runner/work/ovs/ovs/vswitchd/ovs-vswitchd.c:86 New issue "unix.Malloc Potential leak of memory pointed to by 'remote'" (1 occurrence) file:///home/runner/work/ovs/ovs/vswitchd/ovs-vswitchd.c:95 note level: +0 -0 no changes all levels: +2 +0 Signed-off-by: Eelco Chaudron <echaudro@redhat.com> --- .ci/linux-build.sh | 29 ++++++++++++ .github/workflows/build-and-test.yml | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+)