mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-07-31 00:07:49 +00:00
Add single instance of a valgrind test to verify memory handling in CMock.
This commit is contained in:
@@ -67,3 +67,51 @@ jobs:
|
||||
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||
run: |
|
||||
cd test && rake ci
|
||||
|
||||
# Job: Valgrind memory-leak check (Linux/gcc_64 only, latest Ruby)
|
||||
valgrind:
|
||||
name: "Valgrind Memory Check"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install --assume-yes --quiet gcc-multilib valgrind
|
||||
|
||||
- name: Checkout Latest Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.3'
|
||||
|
||||
- name: Install Ruby Dependencies
|
||||
run: |
|
||||
gem install bundler
|
||||
bundle install
|
||||
|
||||
# Build and run C unit tests, then re-run the executable under valgrind.
|
||||
# test:system clobbers the build directory, so check TestCMockC before that happens.
|
||||
- name: Build and Run C Unit Tests
|
||||
run: cd test && rake config[gcc_64_valgrind] test:c
|
||||
|
||||
- name: Valgrind Check - C Unit Tests
|
||||
run: |
|
||||
valgrind --leak-check=full --track-origins=yes --error-exitcode=1 \
|
||||
test/system/build/TestCMockC.exe
|
||||
|
||||
# Build and run system tests, then re-run each executable under valgrind.
|
||||
- name: Build and Run System Tests
|
||||
run: cd test && rake config[gcc_64_valgrind] test:system
|
||||
|
||||
- name: Valgrind Check - System Tests
|
||||
run: |
|
||||
failed=0
|
||||
for exe in test/system/build/test_*.exe; do
|
||||
echo "Checking: $exe"
|
||||
valgrind --leak-check=full --track-origins=yes --error-exitcode=1 "$exe" || failed=1
|
||||
done
|
||||
exit $failed
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
# gcc_64 with debug symbols enabled for meaningful valgrind output.
|
||||
# Used by the CI valgrind job to check for memory leaks and errors.
|
||||
|
||||
---
|
||||
:tools:
|
||||
:test_compiler:
|
||||
:name: compiler
|
||||
:executable: gcc
|
||||
:arguments:
|
||||
- "-c"
|
||||
- "-m64"
|
||||
- "-g"
|
||||
- "-Wall"
|
||||
- "-Wno-address"
|
||||
- "-std=c99"
|
||||
- "-pedantic"
|
||||
- '-I"${5}"'
|
||||
- "-D${6}"
|
||||
- "${1}"
|
||||
- "-o ${2}"
|
||||
:test_linker:
|
||||
:name: linker
|
||||
:executable: gcc
|
||||
:arguments:
|
||||
- "${1}"
|
||||
- "-lm"
|
||||
- "-m64"
|
||||
- "-o ${2}"
|
||||
:extension:
|
||||
:object: ".o"
|
||||
:executable: ".exe"
|
||||
:defines:
|
||||
:test:
|
||||
- UNITY_EXCLUDE_STDINT_H
|
||||
- UNITY_EXCLUDE_LIMITS_H
|
||||
- UNITY_INCLUDE_DOUBLE
|
||||
- UNITY_SUPPORT_TEST_CASES
|
||||
- UNITY_SUPPORT_64
|
||||
- UNITY_INT_WIDTH=32
|
||||
- UNITY_LONG_WIDTH=64
|
||||
- UNITY_POINTER_WIDTH=64
|
||||
Reference in New Issue
Block a user