Start refactoring targets to use those coming from unity. so far we are refactoring to pull project-specific config

This commit is contained in:
Mark VanderVoord
2026-05-15 23:31:56 -04:00
parent 9900e4c5f5
commit 7d99f0f51d
5 changed files with 166 additions and 22 deletions
+34
View File
@@ -0,0 +1,34 @@
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
:project:
:build_root: './system/build/'
:colour: true
:paths:
:source:
- './system/generated/'
:include:
- './system/generated/'
- '../examples/test/'
- '../src/'
- '../vendor/unity/src/'
- '../vendor/c_exception/lib/'
- './system/test_compilation/'
- './'
:build: './system/build/'
:test_compilation: './system/test_compilation/'
:extension:
:object: '.o'
:executable: '.exe'
:defines:
:common:
- CMOCK
- UNITY_SUPPORT_64
+18 -1
View File
@@ -32,7 +32,24 @@ module RakefileHelpers
def load_configuration(config_file)
$cfg_file = config_file
$cfg = load_yaml('./targets/' + $cfg_file)
$colour_output = false unless $cfg['colour']
$proj = load_yaml('./project.yml')
# Apply project-level paths, overriding any hardcoded paths in the target file
$cfg['compiler']['source_path'] = $proj[:paths][:source].first
$cfg['compiler']['build_path'] = $proj[:project][:build_root]
$cfg['compiler']['object_files']['destination'] = $proj[:project][:build_root]
$cfg['linker']['object_files']['path'] = $proj[:project][:build_root]
$cfg['linker']['bin_files']['destination'] = $proj[:project][:build_root]
# Merge includes: keep Array items from target (e.g., IAR tool paths), use project.yml for strings
tool_includes = $cfg['compiler']['includes']['items'].select { |i| i.is_a?(Array) }
$cfg['compiler']['includes']['items'] = tool_includes + $proj[:paths][:include]
# Merge defines: target-specific first, then project common defines
$cfg['compiler']['defines']['items'] ||= []
$cfg['compiler']['defines']['items'] |= $proj[:defines][:common]
$colour_output = $proj[:project][:colour]
end
def configure_clean
@@ -75,7 +75,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after an expect and return'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -89,7 +89,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after an expect'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -103,7 +103,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after throw expectation'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -119,7 +119,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after a mock call'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -134,7 +134,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after throw'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -151,7 +151,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after ignore'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -166,7 +166,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after ignored mock'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -181,7 +181,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after callback setup'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -198,7 +198,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after mock with callback'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -214,7 +214,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after expect any args'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -231,7 +231,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after mock which expected any args'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -247,7 +247,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after ignored arg'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -265,7 +265,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after mock which ignored an arg'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -282,7 +282,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after mock which threw a CException'
:verify_error: 'FAIL: Expected 1 Was 2. CustomFail'
:verify_error: 'FAIL: Expected 1 Was 2:CustomFail'
:code: |
test()
{
@@ -299,7 +299,7 @@
- :pass: FALSE
:should: 'not contain mock details in failed assertion after mock which used a return thru ptr'
:verify_error: 'FAIL: Expected 3 Was 7. CustomFail'
:verify_error: 'FAIL: Expected 3 Was 7:CustomFail'
:code: |
test()
{