diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml deleted file mode 100644 index b640a38f43f..00000000000 --- a/.github/workflows/CI-cygwin.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: CI-cygwin - -on: [push,pull_request] - -defaults: - run: - shell: cmd - -jobs: - build_cygwin: - strategy: - matrix: - os: [windows-2019] - arch: [x64, x86] - fail-fast: true - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - - name: Set up Cygwin - uses: egor-tensin/setup-cygwin@v3 - with: - platform: ${{ matrix.arch }} - - - name: Build cppcheck - run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 - - - name: Build test - run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 testrunner - - - name: Run test - run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 check - - - name: Extra test for misra - run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c - diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 55fdadd5270..7a9f9f2b105 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.10"] + image: ["gcc:4.6"] fail-fast: false # Prefer quick result runs-on: ubuntu-20.04 @@ -18,6 +18,11 @@ jobs: image: ${{ matrix.image }} steps: + - name: Install prerequisites for gcc:4.6 + if: matrix.image == 'gcc:4.6' + run: | + #echo "CXX=gcc-4.6" >> $GITHUB_ENV + - uses: actions/checkout@v2 - name: Install missing software on CentOS 7 diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml deleted file mode 100644 index 9caf53a767f..00000000000 --- a/.github/workflows/CI-unixish.yml +++ /dev/null @@ -1,187 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: CI-unixish - -on: [push, pull_request] - -jobs: - build: - - strategy: - matrix: - os: [ubuntu-18.04, ubuntu-20.04, macos-10.15] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Install missing software on ubuntu 18.04 - if: matrix.os == 'ubuntu-18.04' - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install z3 libz3-dev - cp externals/z3_version_old.h externals/z3_version.h - - - name: Install missing software on ubuntu 20.04 - if: matrix.os == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install z3 libz3-dev - - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - brew install coreutils z3 - cp externals/z3_version_old.h externals/z3_version.h - - - name: Install missing Python packages - run: | - python -m pip install pip --upgrade - python -m pip install pytest - - - name: Install Qt - if: contains(matrix.os, 'ubuntu') - uses: jurplel/install-qt-action@v2 - with: - modules: 'qtcharts' - - - name: Test CMake build - run: | - mkdir cmake.output - cd cmake.output - cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On .. - make -j$(nproc) check - cd .. - - - name: Build and test with Unsigned char - run: | - make clean - make -j$(nproc) CXXFLAGS=-funsigned-char testrunner - ./testrunner TestSymbolDatabase - - - name: Check syntax with NONNEG - run: | - ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG - - - name: Build cppcheck - run: | - make clean - make -j$(nproc) USE_Z3=yes HAVE_RULES=yes - - - name: Build test - run: | - make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes - - - name: Run test - run: | - make -j$(nproc) check USE_Z3=yes HAVE_RULES=yes - - # the script uses sed parameters not supported by MacOS - - name: Run extra tests - if: contains(matrix.os, 'ubuntu') - run: | - tools/generate_and_run_more_tests.sh - - - name: Run test/cli - run: | - cd test/cli - pytest test-*.py - cd ../../.. - ln -s cppcheck 'cpp check' - cd 'cpp check/test/cli' - pytest test-*.py - - # fails on macos since some includes (e.g. sys/epoll.h) are not available - - name: Run cfg tests - if: contains(matrix.os, 'ubuntu') - run: | - make -j$(nproc) checkcfg - - # it seems macos has no "wc" command - - name: Run showtimetop5 tests - if: contains(matrix.os, 'ubuntu') - run: | - ./tools/test_showtimetop5.sh - - - name: Run --dump test - run: | - ./cppcheck test/testpreprocessor.cpp --dump - xmllint --noout test/testpreprocessor.cpp.dump - - - name: Validate - run: | - make -j$(nproc) checkCWEEntries validateXML - - - name: Test addons - run: | - ./cppcheck --addon=threadsafety addons/test/threadsafety - ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety - ./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c - cd addons/test - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 && python3 ../misra.py -verify misra/misra-test.c.dump - ../../cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c - - - name: Build GUI on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - pushd gui - qmake HAVE_QCHART=yes - make -j$(nproc) - - - name: Run GUI tests on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - pushd gui/test/projectfile - qmake - make -j$(nproc) - ./test-projectfile - popd - pushd gui/test/cppchecklibrarydata - qmake - make -j$(nproc) - ./test-cppchecklibrarydata - - - name: Generate Qt help file on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - pushd gui/help - qhelpgenerator online-help.qhcp -o online-help.qhc - - # Run self check after "Build GUI" to include generated headers in analysis - - name: Self check - if: matrix.os == 'ubuntu-20.04' - run: | - # compile with verification and ast matchers - make clean - make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1 - # self check lib/cli - mkdir b1 - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib - # check gui with qt settings - mkdir b2 - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp - # self check test and tools - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools - - - name: Build triage on ubuntu - if: matrix.os == 'ubuntu-20.04' - run: | - pushd tools/triage - qmake - make -j$(nproc) - - - name: Build Fuzzer - if: matrix.os == 'ubuntu-20.04' - run: | - pushd oss-fuzz - make -j$(nproc) CXX=clang++ CXXFLAGS="-fsanitize=address" fuzz-client translate - diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml deleted file mode 100644 index fef067e66cc..00000000000 --- a/.github/workflows/CI-windows.yml +++ /dev/null @@ -1,151 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: CI-windows - -on: [push,pull_request] - -defaults: - run: - shell: cmd - -jobs: - - build: - strategy: - matrix: - os: [windows-2019] - arch: [x64, x86] - qt_ver: ['', 5.9.9, 5.15.2] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.10 - if: matrix.qt_ver == '' - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Setup msbuild.exe - if: matrix.qt_ver == '' - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Install PCRE - if: false - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel! - curl -fsSL https://ftp.pcre.org/pub/pcre/pcre-%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - cd pcre-%PCRE_VERSION% || exit /b !errorlevel! - cmake . -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPCRE_BUILD_PCRECPP=Off -DPCRE_BUILD_TESTS=Off -DPCRE_BUILD_PCREGREP=Off || exit /b !errorlevel! - nmake || exit /b !errorlevel! - copy pcre.h ..\externals || exit /b !errorlevel! - if "${{ matrix.arch }}" == "x86" ( - copy pcre.lib ..\externals\pcre.lib || exit /b !errorlevel! - ) else ( - copy pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! - ) - env: - # see https://www.pcre.org/original/changelog.txt - PCRE_VERSION: 8.44 - CL: /MP - - - name: Install Z3 library - run: | - curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-%Z3_VERSION%/z3-%Z3_VERSION%-${{ matrix.arch }}-win.zip -o z3-%Z3_VERSION%-win.zip || exit /b !errorlevel! - 7z x z3-%Z3_VERSION%-win.zip -oexternals -r -y || exit /b !errorlevel! - move externals\z3-%Z3_VERSION%-${{ matrix.arch }}-win externals\z3 || exit /b !errorlevel! - env: - # see https://github.com/Z3Prover/z3/releases: - Z3_VERSION: 4.8.10 - - # no 32-bit Qt available - - name: Install Qt ${{ matrix.qt_ver }} - if: matrix.qt_ver != '' && matrix.arch == 'x64' - uses: jurplel/install-qt-action@v2 - with: - version: ${{ matrix.qt_ver }} - modules: 'qtcharts' - - - name: Install missing Python packages - if: matrix.qt_ver == '' - run: | - python -m pip install pip --upgrade || exit /b !errorlevel! - python -m pip install pytest || exit /b !errorlevel! - python -m pip install pytest-custom_exit_code || exit /b !errorlevel! - - - name: Build GUI release - if: matrix.qt_ver != '' && matrix.arch == 'x64' - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel! - cd gui || exit /b !errorlevel! - qmake HAVE_QCHART=yes || exit /b !errorlevel! - nmake release || exit /b !errorlevel! - env: - CL: /MP - - - name: Deploy GUI - if: matrix.qt_ver != '' && matrix.arch == 'x64' - run: | - windeployqt Build\gui || exit /b !errorlevel! - del Build\gui\cppcheck-gui.ilk || exit /b !errorlevel! - del Build\gui\cppcheck-gui.pdb || exit /b !errorlevel! - - - name: Configure MSBuild - if: matrix.qt_ver == '' - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel! - set ARCH=${{ matrix.arch }} - if "${{ matrix.arch }}" == "x86" ( - set ARCH=Win32 - ) - rm -rf build - mkdir build - cd build - cmake -DBUILD_TESTS=On .. || exit /b !errorlevel! - - - name: Build CLI debug configuration using MSBuild - if: matrix.qt_ver == '' - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel! - set ARCH=${{ matrix.arch }} - if "${{ matrix.arch }}" == "x86" ( - set ARCH=Win32 - ) - cmake --build build --target check --config Debug || exit /b !errorlevel! - - - name: Build CLI release configuration using MSBuild - if: matrix.qt_ver == '' - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} || exit /b !errorlevel! - set ARCH=${{ matrix.arch }} - if "${{ matrix.arch }}" == "x86" ( - set ARCH=Win32 - ) - cmake --build build --target check --config Release || exit /b !errorlevel! - - - name: Run test/cli - if: matrix.qt_ver == '' - run: | - :: since FILESDIR is not set copy the binary to the root so the addons are found - copy .\build\bin\Release\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! - cd test/cli || exit /b !errorlevel! - :: python -m pytest --suppress-no-test-exit-code test-clang-import.py || exit /b !errorlevel! - python -m pytest test-helloworld.py || exit /b !errorlevel! - python -m pytest test-inline-suppress.py || exit /b !errorlevel! - python -m pytest test-more-projects.py || exit /b !errorlevel! - python -m pytest test-proj2.py || exit /b !errorlevel! - python -m pytest test-suppress-syntaxError.py || exit /b !errorlevel! - - - name: Test addons - if: matrix.qt_ver == '' - run: | - .\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c - cd addons\test - ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump - diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml deleted file mode 100644 index c1854a3481e..00000000000 --- a/.github/workflows/asan.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: address sanitizer - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-20.04 - - env: - ASAN_OPTIONS: detect_stack_use_after_return=1 - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libz3-4 libz3-dev - - - name: Build - run: make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1 - env: - CC: clang - CXX: clang++ - CXXFLAGS: "-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" - CPPFLAGS: "-DCHECK_INTERNAL" - - - name: Run tests - run: ./testrunner - -# Does not work -# - name: Self check -# run: | -# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib -# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp -# ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools - -# This takes too long time right now -# - name: Bughunting lib -# run: ./cppcheck -D__CPPCHECK__ --bug-hunting -j$(nproc) lib - diff --git a/.github/workflows/bughunting.yml b/.github/workflows/bughunting.yml deleted file mode 100644 index 8f88c2a6c43..00000000000 --- a/.github/workflows/bughunting.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: bughunting - -# TODO: enable this when -on: workflow_dispatch - -jobs: - build: - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install z3 libz3-dev - - - name: Build cppcheck - run: | - make -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes - env: - CXXFLAGS: "-O2 -march=native" - - # currently to slow to execute it in the CI - - name: Run CVE suite - run: | - python test/bug-hunting/cve.py - - - name: Run ITC suite - run: | - git clone https://github.com/regehr/itc-benchmarks.git ~/itc - python test/bug-hunting/itc.py - - - name: Run juliet - run: | - mkdir ~/juliet - curl https://samate.nist.gov/SARD/testsuites/juliet/Juliet_Test_Suite_v1.3_for_C_Cpp.zip -o ~/juliet/juliet.zip - cd ~/juliet && unzip -qq ~/juliet/juliet.zip - python test/bug-hunting/juliet.py diff --git a/.github/workflows/buildman.yml b/.github/workflows/buildman.yml deleted file mode 100644 index cf2b5c2afcc..00000000000 --- a/.github/workflows/buildman.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build manual - -on: [push, pull_request] - -jobs: - convert_via_pandoc: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - - run: | - mkdir output - - - uses: docker://pandoc/latex:2.9 - with: - args: --output=output/manual.html man/manual.md - - - uses: docker://pandoc/latex:2.9 - with: - args: --output=output/manual.pdf man/manual.md - - - uses: actions/upload-artifact@v2 - with: - name: output - path: output diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml deleted file mode 100644 index 3cbb5effcfc..00000000000 --- a/.github/workflows/clang-tidy.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: clang-tidy - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-20.04 - - container: - image: "ubuntu:21.10" - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software - run: | - apt-get update - apt-get install -y cmake g++ make - apt-get install -y z3 libz3-dev - apt-get install -y libpcre3-dev - apt-get install -y libffi7 # work around missing dependency for Qt install step - apt-get install -y software-properties-common - add-apt-repository universe - apt-get update - apt-get install -y clang-tidy-13 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - install-deps: 'nosudo' - version: '5.15.2' - modules: 'qtcharts' - - - name: Prepare CMake - run: | - mkdir cmake.output - cd cmake.output - cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On .. - cd .. - - - name: Clang-Tidy - run: | - # make sure the precompiled headers exist - make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx - make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx - make -C cmake.output autogen - cmake --build cmake.output --target run-clang-tidy 2> /dev/null diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 1734626ef15..00000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: "CodeQL" - -on: [push, pull_request] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-20.04 - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['cpp', 'python'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install libz3-dev libz3-4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - setup-python-dependencies: false - - - run: | - make -j$(nproc) USE_Z3=yes HAVE_RULES=yes cppcheck - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 120db3e9fd1..00000000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: Coverage - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install libz3-dev libz3-4 - sudo apt-get install lcov - sudo apt-get install libcppunit-dev - python -m pip install pip --upgrade - python -m pip install lcov_cobertura - - - name: Compile instrumented - run: | - make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes - - - name: Generate coverage report - run: | - rm -rf coverage_report - ./testrunner - test/cfg/runtests.sh - gcov lib/*.cpp -o lib/ - lcov --directory ./ --capture --output-file lcov_tmp.info -b ./ - lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info - genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp - - - uses: actions/upload-artifact@v2 - with: - name: Coverage results - path: coverage_report - - - uses: codecov/codecov-action@v1.2.1 - with: - # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - # file: ./coverage.xml # optional - flags: unittests # optional - name: ${{ github.repository }} # optional - fail_ci_if_error: true # optional (default = false): diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 8d5f8a19b64..00000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: format - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - - name: Cache uncrustify - uses: actions/cache@v2 - id: cache-uncrustify - with: - path: | - ~/uncrustify - key: ${{ runner.os }}-uncrustify - - - name: build uncrustify - if: steps.cache-uncrustify.outputs.cache-hit != 'true' - run: | - wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz - tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0 - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release .. - make -j$(nproc) -s - mkdir ~/uncrustify - cp uncrustify ~/uncrustify/ - - - name: Uncrustify check - run: | - ~/uncrustify/uncrustify -c .uncrustify.cfg -l CPP --check */*.cpp */*.h diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml deleted file mode 100644 index f63271f595b..00000000000 --- a/.github/workflows/release-windows.yml +++ /dev/null @@ -1,121 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: release-windows - -on: - push: - tags: - - '2.*' - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -defaults: - run: - shell: cmd - -jobs: - - build: - - runs-on: windows-2019 - - steps: - - uses: actions/checkout@v2 - - - name: Setup msbuild.exe - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Install PCRE - run: | - curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/8.45.zip -o pcre-8.45.zip - 7z x pcre-8.45.zip - cd pcre-8.45 - cmake . -G "Visual Studio 16 2019" -A x64 - msbuild -m PCRE.sln /p:Configuration=Release /p:Platform=x64 - dir - dir Release - dir x64 - dir x64\Release - copy pcre.h ..\externals - copy Release\pcre.lib ..\externals\pcre64.lib - - - name: Install Z3 library - run: | - curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-4.8.7/z3-4.8.7-x64-win.zip -o z3-4.8.7-win.zip - 7z x z3-4.8.7-win.zip -oexternals -r -y - move externals\z3-4.8.7-x64-win externals\z3 - - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: '5.15.2' - modules: 'qtcharts qthelp' - - - name: Create .qm - run: | - cd gui - lupdate gui.pro - lrelease gui.pro -removeidentical - - - name: Matchcompiler - run: python tools\matchcompiler.py --write-dir lib - - - name: Build x64 release GUI - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - cd gui - qmake HAVE_QCHART=yes - nmake release - env: - CL: /MP - - - name: Deploy app - run: | - windeployqt Build\gui - del Build\gui\cppcheck-gui.ilk - del Build\gui\cppcheck-gui.pdb - - - name: Build CLI x64 release configuration using MSBuild - run: msbuild -m cppcheck.sln /t:cli /p:Configuration=Release-PCRE /p:Platform=x64 - - - name: Collect files - run: | - move Build\gui win_installer\files - mkdir win_installer\files\addons - copy addons\*.* win_installer\files\addons - mkdir win_installer\files\cfg - copy cfg\*.cfg win_installer\files\cfg - mkdir win_installer\files\platforms - copy platforms\*.xml win_installer\files\platforms - copy bin\cppcheck.exe win_installer\files - copy bin\cppcheck-core.dll win_installer\files - copy externals\z3\bin\libz3.dll win_installer\files - mkdir win_installer\files\help - xcopy /s gui\help win_installer\files\help - del win_installer\files\translations\*.qm - move gui\*.qm win_installer\files\translations - - - - name: Build Installer - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - cd win_installer - REM Read ProductVersion - for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a - REM Remove double quotes - set PRODUCTVER=%PRODUCTVER:"=% - echo ProductVersion=%PRODUCTVER% - msbuild -m cppcheck.wixproj /p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} - - - uses: actions/upload-artifact@v2 - with: - name: installer - path: win_installer/Build/ - - - uses: actions/upload-artifact@v2 - with: - name: deploy - path: win_installer\files diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml deleted file mode 100644 index 9bb5dec874a..00000000000 --- a/.github/workflows/scriptcheck.yml +++ /dev/null @@ -1,107 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: scriptcheck - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10'] - fail-fast: false - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install tidy libxml2-utils - - - name: Install missing software on ubuntu (Python 2) - if: matrix.python-version == '2.7' - run: | - python -m pip install pip --upgrade - python -m pip install pytest - python -m pip install pygments - - - name: Install missing software on ubuntu (Python 3) - if: matrix.python-version != '2.7' - run: | - sudo apt-get install shellcheck - python -m pip install pip --upgrade - python -m pip install natsort - python -m pip install pexpect - python -m pip install pylint - python -m pip install unittest2 - python -m pip install pytest - python -m pip install pygments - python -m pip install requests - python -m pip install psutil - - - name: run Shellcheck - if: matrix.python-version == '3.10' - run: | - find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 - - - name: run pylint - if: matrix.python-version == '3.10' - run: | - pylint --rcfile=pylintrc_travis --jobs $(nproc) addons/*.py htmlreport/cppcheck-htmlreport htmlreport/*.py tools/*.py - - - name: check .json files - if: matrix.python-version == '3.10' - run: | - find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null - - - name: Validate - if: matrix.python-version == '3.10' - run: | - make -j$(nproc) validateCFG validatePlatforms validateRules - - - name: check python syntax - if: matrix.python-version != '2.7' - run: | - python -m py_compile addons/*.py - python -m py_compile htmlreport/cppcheck-htmlreport - python -m py_compile htmlreport/*.py - python -m py_compile tools/*.py - - - name: compile addons - run: | - python -m compileall ./addons - - - name: test matchcompiler - run: | - python tools/test_matchcompiler.py - - - name: build cppcheck - run: | - make -j$(nproc) -s - - - name: test addons - run: | - python -m pytest addons/test/test-*.py - env: - PYTHONPATH: ./addons - - - name: test htmlreport - run: | - htmlreport/test_htmlreport.py - cd htmlreport - ./check.sh - - - name: dmake - if: matrix.python-version == '3.10' - run: | - make -j$(nproc) run-dmake - git diff --exit-code - diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml deleted file mode 100644 index f50ef22c7b3..00000000000 --- a/.github/workflows/ubsan.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: undefined behaviour sanitizers - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-20.04 - - env: - UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 - - steps: - - uses: actions/checkout@v2 - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libz3-4 libz3-dev - - - name: Build - run: make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1 - env: - CC: clang - CXX: clang++ - CXXFLAGS: "-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" - CPPFLAGS: "-DCHECK_INTERNAL" - - - name: Run tests - run: ./testrunner - - - name: Self check - run: | - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp - ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings test/*.cpp tools - -# This takes too long time right now -# - name: Bughunting lib -# run: ./cppcheck -D__CPPCHECK__ --bug-hunting -j$(nproc) lib - diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml deleted file mode 100644 index 5f9bb5b978d..00000000000 --- a/.github/workflows/valgrind.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions -# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners -name: valgrind - -on: [push, pull_request] - -jobs: - build: - - 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 - # the key expired and the ubuntu-dbgsym-keyring package does not yet include the latest one - see https://bugs.launchpad.net/ubuntu/+source/ubuntu-keyring/+bug/1920640 - wget -O - http://ddebs.ubuntu.com/dbgsym-release-key.asc | sudo apt-key add - - - - 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 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 - 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 - - - uses: actions/upload-artifact@v2 - with: - name: Logs - path: ./*.log diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c4b6a19aa4f..00000000000 --- a/appveyor.yml +++ /dev/null @@ -1,72 +0,0 @@ -version: '{build}' - -clone_depth: 10 - -matrix: - fast_finish: true - -environment: - matrix: - - VisualStudioVersion: 12.0 - platform: x64 - configuration: Debug - vcvarsall_platform: x64 - PlatformToolset: v120 - MYQTDIR: C:\Qt\5.6\msvc2013_64 - - VisualStudioVersion: 12.0 - platform: x64 - configuration: Release - vcvarsall_platform: x64 - PlatformToolset: v120 -# FIXME: These are disabled for now. They were broken by ae8653612802b41b70424ec9a5eefe8a1178f6d1 -# - VisualStudioVersion: 14.0 -# platform: x64 -# configuration: Debug -# vcvarsall_platform: x64 -# PlatformToolset: v140 -# MYQTDIR: C:\Qt\5.11\msvc2015_64 -# That platform causes frequent errors on appveyor due to an unknown infrastructure failure -# - VisualStudioVersion: 14.0 -# platform: x64 -# configuration: Release -# vcvarsall_platform: x64 -# PlatformToolset: v140 - -install: - - curl -fsSL https://github.com/Z3Prover/z3/releases/download/z3-4.8.9/z3-4.8.9-%platform%-win.zip -o z3-4.8.9-win.zip - - 7z x z3-4.8.9-win.zip -oexternals -r -y - - move externals\z3-4.8.9-%platform%-win externals\z3 - -build_script: - - ECHO Building %configuration% %platform% with MSVC %VisualStudioVersion% using %PlatformToolset% PlatformToolset - - 'CALL "C:\Program Files (x86)\Microsoft Visual Studio %VisualStudioVersion%\VC\vcvarsall.bat" %vcvarsall_platform%' - # Visual studio project.. - - mkdir vsbuild - - cd vsbuild - - cmake -DBUILD_TESTS=ON -DCTEST_TIMEOUT=240 .. - - cmake --build . --target check --config %configuration% - - cd .. - # the following builds are Debug ones so do not perform them in Release jobs - - 'IF "%configuration%" == "Release" exit /b 0' - # use all available processes for nmake - - set CL=/MP - # cmake.. - - mkdir build - - cd build - - cmake -DBUILD_TESTS=ON -G"NMake Makefiles" .. - - nmake - - copy bin\cppcheck.exe .. - - cd .. - # build gui.. - - ECHO MYQTDIR=%MYQTDIR% - - 'IF defined MYQTDIR cd gui' - - 'IF defined MYQTDIR set QTDIR=%MYQTDIR%' - - 'IF defined MYQTDIR set PATH=%PATH%;%QTDIR%\bin' - - 'IF defined MYQTDIR %QTDIR%\bin\qmake' - - 'IF defined MYQTDIR nmake' - - 'IF defined MYQTDIR cd ..' - -test_script: - - build\bin\testrunner.exe -q - - IF EXIST bin\debug\testrunner.exe bin\debug\testrunner.exe -q - - IF EXIST bin\testrunner.exe bin\testrunner.exe -q