mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-10 20:29:58 +00:00
Further refine testing process for speed and coverage.
This commit is contained in:
+44
-14
@@ -11,9 +11,10 @@ on:
|
|||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Job: Unit test suite
|
# Job: Ruby unit tests across all supported Ruby versions and OSes.
|
||||||
unit-tests:
|
# These are fast (no C compilation) and verify the generator logic is Ruby-version-portable.
|
||||||
name: "Unit Tests"
|
ruby-tests:
|
||||||
|
name: "Ruby Tests (${{ matrix.os }}, Ruby ${{ matrix.ruby }})"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -30,6 +31,37 @@ jobs:
|
|||||||
ruby: '3.1'
|
ruby: '3.1'
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
ruby: '3.2'
|
ruby: '3.2'
|
||||||
|
steps:
|
||||||
|
- name: Checkout Latest Repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Setup Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: ${{ matrix.ruby }}
|
||||||
|
|
||||||
|
- name: Install Ruby Dependencies
|
||||||
|
run: |
|
||||||
|
gem install bundler
|
||||||
|
bundle install
|
||||||
|
|
||||||
|
- name: Run Ruby Unit Tests and Style Check
|
||||||
|
env:
|
||||||
|
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||||
|
run: |
|
||||||
|
cd test && rake test:unit style:check
|
||||||
|
|
||||||
|
# Job: C compilation and system tests — only needs to run on one Ruby version per OS,
|
||||||
|
# since the generated C code and runtime behavior don't vary with the Ruby version.
|
||||||
|
c-tests:
|
||||||
|
name: "C Tests (${{ matrix.os }})"
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
steps:
|
steps:
|
||||||
# Install Multilib (Linux only)
|
# Install Multilib (Linux only)
|
||||||
- name: Install Multilib
|
- name: Install Multilib
|
||||||
@@ -43,30 +75,26 @@ jobs:
|
|||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
||||||
# Checks out repository under $GITHUB_WORKSPACE
|
|
||||||
- name: Checkout Latest Repo
|
- name: Checkout Latest Repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
# Setup Ruby
|
|
||||||
- name: Setup Ruby
|
- name: Setup Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: '3.3'
|
||||||
|
|
||||||
# Install Ruby dependencies
|
|
||||||
- name: Install Ruby Dependencies
|
- name: Install Ruby Dependencies
|
||||||
run: |
|
run: |
|
||||||
gem install bundler
|
gem install bundler
|
||||||
bundle install
|
bundle install
|
||||||
|
|
||||||
# Run Tests
|
- name: Run C and System Tests
|
||||||
- name: Run All Unit Tests
|
|
||||||
env:
|
env:
|
||||||
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
NO_COLOR: ${{ matrix.os == 'windows-latest' && '1' || '' }}
|
||||||
run: |
|
run: |
|
||||||
cd test && rake ci
|
cd test && rake test:c test:system test:examples
|
||||||
|
|
||||||
# Job: Valgrind memory-leak check (Linux/gcc_64 only, latest Ruby)
|
# Job: Valgrind memory-leak check (Linux/gcc_64 only, latest Ruby)
|
||||||
valgrind:
|
valgrind:
|
||||||
@@ -114,9 +142,11 @@ jobs:
|
|||||||
echo "Checking: $exe"
|
echo "Checking: $exe"
|
||||||
# Use exit code 42 to distinguish valgrind errors from Unity test failures.
|
# Use exit code 42 to distinguish valgrind errors from Unity test failures.
|
||||||
# Some executables intentionally contain tests expected to fail (testing CMock's
|
# Some executables intentionally contain tests expected to fail (testing CMock's
|
||||||
# error-handling), so Unity exits non-zero. --error-exitcode=42 only fires when
|
# error-handling), so Unity exits non-zero. The `|| exit_code=$?` prevents bash's
|
||||||
# valgrind itself detects errors, letting Unity's exit code pass through otherwise.
|
# set -e from aborting the script on Unity's non-zero exit, while still capturing
|
||||||
valgrind --leak-check=full --track-origins=yes --error-exitcode=42 "$exe"
|
# valgrind's own error exit code (42) separately.
|
||||||
[ $? -eq 42 ] && failed=1
|
exit_code=0
|
||||||
|
valgrind --leak-check=full --track-origins=yes --error-exitcode=42 "$exe" || exit_code=$?
|
||||||
|
[ $exit_code -eq 42 ] && failed=1
|
||||||
done
|
done
|
||||||
exit $failed
|
exit $failed
|
||||||
|
|||||||
Reference in New Issue
Block a user