mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 03:54:25 +00:00

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.)
27 lines
899 B
Bash
Executable file
27 lines
899 B
Bash
Executable file
#!/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"
|