mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
infra bot: Add Memcheck bot (AddressSanitizer)
If a leak occurs in the test result, the bot notifies the PR as a comment. This notify may not be directly related to the created current PR.
This commit is contained in:
parent
d91d3ef6fa
commit
e0c3fafb18
2 changed files with 50 additions and 1 deletions
15
.github/workflows/actions.yml
vendored
15
.github/workflows/actions.yml
vendored
|
@ -67,7 +67,7 @@ jobs:
|
|||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build gcc-multilib g++-multilib libgtest-dev cmake cmake-data valgrind
|
||||
sudo apt-get install ninja-build gcc-multilib g++-multilib libgtest-dev cmake cmake-data libasan5 valgrind
|
||||
sudo apt-get install curl jq
|
||||
sudo apt-get install software-properties-common
|
||||
sudo apt-get install python3-pip
|
||||
|
@ -102,3 +102,16 @@ jobs:
|
|||
"${GITHUB_WORKSPACE}/.github/workflows/memcheck_valgrind.sh"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build & Run memcheck Script(ASAN)
|
||||
run: |
|
||||
sudo rm -rf ./build
|
||||
meson . build -Db_sanitize="address,undefined" -Dloaders="all" -Dsavers="tvg" -Dtests="true" -Dbindings="capi"
|
||||
cd build
|
||||
sudo ninja -C . install
|
||||
export PATH=$PATH:~/.local/bin/
|
||||
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/memcheck_asan.sh"
|
||||
"${GITHUB_WORKSPACE}/.github/workflows/memcheck_asan.sh"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
36
.github/workflows/memcheck_asan.sh
vendored
Executable file
36
.github/workflows/memcheck_asan.sh
vendored
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "$GITHUB_TOKEN" ]]; then
|
||||
echo "The GITHUB_TOKEN is required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
|
||||
echo "Run Address Sanitizer"
|
||||
echo "meson -Db_sanitize=\"address,undefined\" -Dloaders=\"all\" -Dsavers=\"tvg\" -Dtests=\"true\" -Dbindings=\"capi\" . build"
|
||||
pwd
|
||||
cd ${GITHUB_WORKSPACE}/build/test
|
||||
./tvgUnitTests > memcheck_asan.txt 2>&1
|
||||
|
||||
|
||||
PAYLOAD_MEMCHECK=`cat memcheck_asan.txt`
|
||||
COMMENTS_URL=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.comments_url)
|
||||
|
||||
echo $COMMENTS_URL
|
||||
echo "MEMCHECK errors:"
|
||||
echo $PAYLOAD_MEMCHECK
|
||||
|
||||
if [[ $PAYLOAD_MEMCHECK == *"runtime error:"* || $PAYLOAD_MEMCHECK == *"ERROR: AddressSanitizer:"* ]]; then
|
||||
OUTPUT+=$'\n**MEMCHECK(ASAN) RESULT**:\n'
|
||||
|
||||
OUTPUT+=$'\n`meson -Db_sanitize="address,undefined" -Dloaders="all" -Dsavers="tvg" -Dtests="true" -Dbindings="capi" . build`\n'
|
||||
OUTPUT+=$'\n```\n'
|
||||
OUTPUT+="$PAYLOAD_MEMCHECK"
|
||||
OUTPUT+=$'\n```\n'
|
||||
fi
|
||||
|
||||
PAYLOAD=$(echo '{}' | jq --arg body "$OUTPUT" '.body = $body')
|
||||
|
||||
curl -s -S -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/vnd.github.VERSION.text+json" --data "$PAYLOAD" "$COMMENTS_URL"
|
||||
fi
|
||||
|
Loading…
Add table
Reference in a new issue