Skip to content

config.h: removed check of non-builtin define for USE_UNIX_BACKTRACE_SUPPORT / hardened print_stacktrace() #20269

config.h: removed check of non-builtin define for USE_UNIX_BACKTRACE_SUPPORT / hardened print_stacktrace()

config.h: removed check of non-builtin define for USE_UNIX_BACKTRACE_SUPPORT / hardened print_stacktrace() #20269

Workflow file for this run

# 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:
branches:
- 'main'
- 'releases/**'
- '2.*'
tags:
- '2.*'
pull_request:
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os: [macos-13, macos-15]
include:
- xdist_n: auto
# FIXME: test_color_tty fails with xdist
- os: macos-13
xdist_n: '1'
fail-fast: false # Prefer quick result
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install libxml2-utils
# packages for strict cfg checks
- name: Install missing software on ubuntu 22.04 (cfg)
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get install libcairo2-dev libcurl4-openssl-dev liblua5.3-dev libssl-dev libsqlite3-dev libcppunit-dev libsigc++-2.0-dev libgtk-3-dev libboost-all-dev libselinux-dev libwxgtk3.0-gtk3-dev xmlstarlet qtbase5-dev
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
# pcre was removed from runner images in November 2022
brew install coreutils pcre gnu-sed
- name: Install missing Python packages on ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
python3 -m pip install pip --upgrade
python3 -m pip install pytest
python3 -m pip install pytest-timeout
python3 -m pip install pytest-xdist
python3 -m pip install psutil
# we need to use -break-system-packages --user because the common approaches do not work.
# using pip works but it appears to install the packages into a different Python installation so they are not found later on.
# using python3 -m pip without the additional flags fails since the packages are being managed by a different tool (brew) and that lacks some of the packages.
# using pipx also does not work.
- name: Install missing Python packages on macos
if: contains(matrix.os, 'macos')
run: |
python3 -m pip install --break-system-packages --user pip --upgrade
python3 -m pip install --break-system-packages --user pytest
python3 -m pip install --break-system-packages --user pytest-timeout
python3 -m pip install --break-system-packages --user pytest-xdist
python3 -m pip install --break-system-packages --user psutil
- name: Test Signalhandler
run: |
cmake -S . -B build.cmake.signal -G "Unix Makefiles" -DBUILD_TESTS=On
cmake --build build.cmake.signal --target test-signalhandler -- -j$(nproc)
# TODO: how to run this without copying the file?
cp build.cmake.signal/bin/test-s* .
./test-signalhandler abort
python3 -m pytest -Werror --strict-markers -vv test/signal/test-signalhandler.py
rm test-signalhandler
# no unix backtrace support on MacOs
- name: Test Stacktrace
if: contains(matrix.os, 'ubuntu')
run: |
cmake -S . -B build.cmake.stack -G "Unix Makefiles" -DBUILD_TESTS=On
cmake --build build.cmake.stack --target test-stacktrace -- -j$(nproc)
# TODO: how to run this without copying the file?
cp build.cmake.stack/bin/test-s* .
python3 -m pytest -Werror --strict-markers -vv test/signal/test-stacktrace.py
rm test-stacktrace
# TODO: move to scriptcheck.yml so these are tested with all Python versions?
- name: Test addons
run: |
set -x
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety addons/test/threadsafety
./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety --std=c++03 addons/test/threadsafety
./cppcheck --error-exitcode=1 --inline-suppr --addon=misra addons/test/misra/crash*.c
./cppcheck --error-exitcode=1 --inline-suppr --addon=misra --enable=information addons/test/misra/config*.c
./cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c
pushd addons/test
# We'll force C89 standard to enable an additional verification for
# rules 5.4 and 5.5 which have standard-dependent options.
../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64
python3 ../misra.py -verify misra/misra-test.c.dump
# Test slight MISRA differences in C11 standard
../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test-c11.c --std=c11 --platform=unix64
python3 ../misra.py -verify misra/misra-test-c11.c.dump
# TODO: do we need to verify something here?
../../cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h
../../cppcheck --dump misra/misra-test.cpp
python3 ../misra.py -verify misra/misra-test.cpp.dump
python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump
python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump
python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
../../cppcheck --addon=misra --enable=style --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c
../../cppcheck --dump misc-test.cpp
python3 ../misc.py -verify misc-test.cpp.dump
../../cppcheck --dump naming_test.c
python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump
../../cppcheck --dump naming_test.cpp
python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump
# TODO: run with "-n auto" when misra_test.py can be run in parallel
- name: test addons (Python)
if: matrix.os != 'ubuntu-22.04'
run: |
python3 -m pytest -Werror --strict-markers -vv -n 1 addons/test
env:
PYTHONPATH: ./addons
# TODO: run with "-n auto" when misra_test.py can be run in parallel
# we cannot specify -Werror since xml/etree/ElementTree.py in Python 3.10 contains an unclosed file
- name: test addons (Python)
if: matrix.os == 'ubuntu-22.04'
run: |
python3 -m pytest --strict-markers -vv -n 1 addons/test
env:
PYTHONPATH: ./addons
- name: Build democlient
if: matrix.os == 'ubuntu-22.04'
run: |
warnings="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar"
g++ $warnings -c -Ilib -Iexternals/tinyxml2 democlient/democlient.cpp
- name: Show all ignored files
if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched
run: |
git ls-files --others --ignored --exclude-standard
- name: Check for changed and unversioned files
run: |
# TODO: how to do this with a single command?
git status --ignored=no
git status --ignored=no | grep -q 'working tree clean'