mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
infra bot: Add Memcheck bot (valgrind)
If the unit test is successful, valgrind memory check is executed based on the test. 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. (Asan is on hold because it is not well tested in the github action CI environment.)
This commit is contained in:
parent
15412907b8
commit
d7973e9330
2 changed files with 39 additions and 1 deletions
13
.github/workflows/actions.yml
vendored
13
.github/workflows/actions.yml
vendored
|
@ -63,7 +63,9 @@ jobs:
|
|||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build gcc-multilib g++-multilib libgtest-dev meson cmake cmake-data
|
||||
sudo apt-get install ninja-build gcc-multilib g++-multilib libgtest-dev meson cmake cmake-data libasan5 valgrind
|
||||
sudo apt-get install curl jq
|
||||
sudo apt-get install software-properties-common
|
||||
|
||||
- name: Install TurboJPEG library
|
||||
run: sudo apt-get install libturbojpeg0-dev libjpeg8-dev
|
||||
|
@ -86,3 +88,12 @@ jobs:
|
|||
with:
|
||||
name: UnitTestReport
|
||||
path: build/meson-logs/testlog.txt
|
||||
|
||||
- name: Run memcheck Script(valgrind)
|
||||
run: |
|
||||
export PATH=$PATH:~/.local/bin/
|
||||
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/memcheck_valgrind.sh"
|
||||
"${GITHUB_WORKSPACE}/.github/workflows/memcheck_valgrind.sh"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
27
.github/workflows/memcheck_valgrind.sh
vendored
Executable file
27
.github/workflows/memcheck_valgrind.sh
vendored
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Run Valgrind"
|
||||
echo "valgrind --leak-check=yes ./tvgUnitTests"
|
||||
cd ./build/test
|
||||
|
||||
valgrind --leak-check=yes ./tvgUnitTests > memcheck_valgrind.txt 2>&1
|
||||
|
||||
|
||||
PAYLOAD_MEMCHECK=`cat memcheck_valgrind.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 == *"definitely lost:"* || $PAYLOAD_MEMCHECK == *"Invalid read "* || $PAYLOAD_MEMCHECK == *"Invalid write "* ]]; then
|
||||
OUTPUT+=$'\n**MEMCHECK(VALGRIND) RESULT**:\n'
|
||||
OUTPUT+=$'\n`valgrind --leak-check=yes ./tvgUnitTests`\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"
|
Loading…
Add table
Reference in a new issue