Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 51 additions & 11 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ name: valgrind
on: [push, pull_request]

jobs:
build:

test-cppcheck:

name: Run valgrind on cppcheck
runs-on: ubuntu-20.04

steps:
Expand All @@ -31,20 +33,58 @@ jobs:
sudo apt-get install libz3-dev libz3-4 libz3-4-dbgsym
sudo apt-get install libc6-dbg-amd64-cross

- name: Build cppcheck
run: |
CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes

- name: Build test
- name: Build cppcheck debug
run: |
CXXFLAGS="-O1 -g" make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes

- name: Run valgrind
CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes CPPFLAGS="-DCHECK_INTERNAL" VERIFY=1
- name: Run valgrind on cppcheck self-check
run: |
valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --suppressions=valgrind/testrunner.supp --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./testrunner TestGarbage TestOther TestSimplifyTemplate 9>memcheck.log
cat memcheck.log
valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./cppcheck --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib 9>memcheck_cppcheck.log
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are lacking -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive for the Cppcheck execution.

Copy link
Copy Markdown
Collaborator

@firewave firewave Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot another one. Still lacking --template=selfcheck - please rebase to get that and having the build actually fail on an error as #3023 was merged.

We should put the options for the self-check in an external file. Those parameters are (largely) used in multiple places right now and we will most likely have more usages added in the future. With a single place we would make sure all of them are actually in sync. Just having a variable somewhere in the actions would be enough as a start.

When I want to test it locally I always have to copy it out of the YAML file. So having it available from the command-line would be helpful as well.

cat memcheck_cppcheck.log

- uses: actions/upload-artifact@v2
with:
name: Logs
path: ./*.log


test-testrunner:

name: Run valgrind on testrunner
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Prepare
run: |
sudo apt-get update
sudo apt-get install debian-goodies ubuntu-dbgsym-keyring

- name: Add debug repos on ubuntu
run: |
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list
echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list

- name: Install missing software
run: |
sudo apt-get update
sudo apt-get install libxml2-utils
sudo apt-get install valgrind
sudo apt-get install libz3-dev libz3-4 libz3-4-dbgsym
sudo apt-get install libc6-dbg-amd64-cross

- name: Build test
run: |
CXXFLAGS="-O1 -g" make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes

- name: Run valgrind on testrunner
run: |
valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --suppressions=valgrind/testrunner.supp --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./testrunner TestGarbage TestOther TestSimplifyTemplate 9>memcheck_testrunner.log
cat memcheck_testrunner.log

- uses: actions/upload-artifact@v2
with:
name: Logs
path: ./*.log