From edd13e94d06679236c066960c4a0b2cb6a6cc01d Mon Sep 17 00:00:00 2001 From: amai2012 Date: Thu, 7 Jan 2021 13:20:35 +0100 Subject: [PATCH 1/4] Add valgrind run for cppcheck / self-check --- .github/workflows/valgrind.yml | 58 ++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 3eb396c2fc8..5e992a22e26 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -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: @@ -34,17 +36,55 @@ jobs: - name: Build cppcheck run: | CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes - - - name: Build test - run: | - CXXFLAGS="-O1 -g" make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes - - - name: Run valgrind + + - 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 gui 9>memcheck_cppcheck.log + 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 From cd71bfbcd5411a93f95d062037535baca9f7e750 Mon Sep 17 00:00:00 2001 From: amai2012 Date: Thu, 7 Jan 2021 13:27:15 +0100 Subject: [PATCH 2/4] Adjust CPPFLAGS --- .github/workflows/valgrind.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 5e992a22e26..06ce0f6b6e7 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -35,7 +35,7 @@ jobs: - name: Build cppcheck run: | - CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes + CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes CPPFLAGS="-DCHECK_INTERNAL" - name: Run valgrind on cppcheck self-check run: | From e6bd6446b7827fe81a8ddd66fc8dcbeec9326847 Mon Sep 17 00:00:00 2001 From: amai2012 Date: Thu, 7 Jan 2021 14:01:20 +0100 Subject: [PATCH 3/4] VERIFY=1 And remove gui/ directory from scan --- .github/workflows/valgrind.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 06ce0f6b6e7..87360c475d5 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -33,13 +33,13 @@ jobs: sudo apt-get install libz3-dev libz3-4 libz3-4-dbgsym sudo apt-get install libc6-dbg-amd64-cross - - name: Build cppcheck + - name: Build cppcheck debug run: | - CXXFLAGS="-O1 -g" make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes CPPFLAGS="-DCHECK_INTERNAL" + 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 --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./cppcheck --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib gui 9>memcheck_cppcheck.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 cat memcheck_cppcheck.log - uses: actions/upload-artifact@v2 From c15a9959af23bfbc546cdea686b4da8bfcc144a8 Mon Sep 17 00:00:00 2001 From: amai2012 Date: Wed, 13 Jan 2021 13:10:44 +0100 Subject: [PATCH 4/4] Adjust cppcheck CLI arguments --- .github/workflows/valgrind.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 87360c475d5..d5706e16b67 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -39,7 +39,7 @@ jobs: - name: Run valgrind on cppcheck self-check run: | - 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 + 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 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive 9>memcheck_cppcheck.log cat memcheck_cppcheck.log - uses: actions/upload-artifact@v2