mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-23 14:00:33 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 469fe271f5 | |||
| a99deea71a | |||
| be420840b3 | |||
| d83c7017e0 | |||
| 5c6f42ae45 | |||
| f7c3f73b21 | |||
| f7689b8cc3 | |||
| feda84f23b | |||
| 7d99f0f51d | |||
| 9900e4c5f5 | |||
| ecd7e7154c | |||
| abcd75ffbc | |||
| f368744ca5 | |||
| 94dcd39765 | |||
| 75c3f3c7b3 | |||
| 2671ad7046 | |||
| bf9a13a8d4 | |||
| bb0b0e06f5 | |||
| 2bb9086214 | |||
| ad9ce635c3 | |||
| 6f2a234dca | |||
| 338279285b | |||
| 16ec975a87 | |||
| 0cefcf05f9 | |||
| c9154a19dd | |||
| 3ba7de2cb7 | |||
| bd41b3f939 | |||
| b1d0e36aa3 | |||
| d20dca34ab | |||
| f60fe4b808 | |||
| 076df6dd5c | |||
| 204117cb59 | |||
| 8ce70396d1 | |||
| 4eb6c1cada | |||
| 2bcc723e10 |
@@ -0,0 +1,13 @@
|
||||
github: ThrowTheSwitch
|
||||
#patreon: # Replace with a single Patreon username
|
||||
#open_collective: # Replace with a single Open Collective username
|
||||
#ko_fi: # Replace with a single Ko-fi username
|
||||
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
#liberapay: # Replace with a single Liberapay username
|
||||
#issuehunt: # Replace with a single IssueHunt username
|
||||
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
#polar: # Replace with a single Polar username
|
||||
#buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
#thanks_dev: # Replace with a single thanks.dev username
|
||||
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
[submodule "vendor/unity"]
|
||||
path = vendor/unity
|
||||
url = https://github.com/throwtheswitch/unity.git
|
||||
branch = master
|
||||
[submodule "vendor/c_exception"]
|
||||
path = vendor/c_exception
|
||||
url = https://github.com/throwtheswitch/cexception.git
|
||||
branch = master
|
||||
[submodule "vendor/unity"]
|
||||
path = vendor/unity
|
||||
url = https://github.com/throwtheswitch/unity.git
|
||||
branch = master
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
|
||||
+27
-6
@@ -1,13 +1,13 @@
|
||||
CMock: A Summary
|
||||
================
|
||||
|
||||
*[ThrowTheSwitch.org](http://throwtheswitch.org)*
|
||||
*[ThrowTheSwitch.org](http://throwtheswitch.org)*
|
||||
|
||||
*This documentation is released under a Creative Commons 3.0 Attribution Share-Alike License*
|
||||
|
||||
- [Known Issues](docs/CMockKnownIssues.md)
|
||||
- [Change Log](docs/CMockChangeLog.md)
|
||||
- [How Does CMock Validate Arguments](docs/CMock_ArgumentValidation.md)
|
||||
- [Known Issues](CMockKnownIssues.md)
|
||||
- [Change Log](CMockChangeLog.md)
|
||||
- [How Does CMock Validate Arguments](CMock_ArgumentValidation.md)
|
||||
|
||||
What Exactly Are We Talking About Here?
|
||||
---------------------------------------
|
||||
@@ -138,7 +138,7 @@ that resembles a pointer or array, it breaks the argument into TWO arguments.
|
||||
The first is the original pointer. The second specify the number of elements
|
||||
it is to verify of that array. If you specify 1, it'll check one object. If 2,
|
||||
it'll assume your pointer is pointing at the first of two elements in an array.
|
||||
If you specify zero elements and `UNITY_COMPARE_PTRS_ON_ZERO_ARRAY` is defined,
|
||||
If you specify zero elements and `UNITY_COMPARE_PTRS_ON_ZERO_ARRAY` is defined,
|
||||
then this assertion can also be used to directly compare the pointers to verify
|
||||
that they are pointing to the same memory address.
|
||||
|
||||
@@ -420,6 +420,27 @@ from the defaults. We've tried to specify what the defaults are below.
|
||||
|
||||
* default: *nil*
|
||||
|
||||
* `:create_error_stubs`:
|
||||
New users of CMock sometimes struggle with the concept that CMock is
|
||||
generating differently named interface functions for a mock depending
|
||||
on whether a function to be mocked has a return value or not (see
|
||||
description of the plugins `:Expect`, `:ExpectAnyArgs`, `:Array`, `:Ignore`,
|
||||
`:IgnoreStateless` above). They are looking e.g. for a function `func_Expect()`
|
||||
while CMock generated the function `func_ExpectAndReturn()` instead.
|
||||
This has proven to be a significant hurdle, because it is not easy to
|
||||
spot the slightly different named function within the generated mock.
|
||||
Therefore CMock (v2.6.0 and newer) is generating *both* functions
|
||||
per default, although one of them has only a "stub" functionality:
|
||||
on call it will always fail the test emitting a helpful error message
|
||||
pointing towards the correct function.
|
||||
|
||||
Experienced CMock users on the other hand might prefer the original
|
||||
behavior, where no additional error stubs are generated - e.g. to
|
||||
ensure code completion offers only "real" functionality of the mock.
|
||||
In this case, the option `:create_error_stubs` can be set to false.
|
||||
|
||||
* default: true
|
||||
|
||||
* `:enforce_strict_ordering`:
|
||||
CMock always enforces the order that you call a particular function,
|
||||
so if you expect GrabNabber(int size) to be called three times, it
|
||||
@@ -637,7 +658,7 @@ from the defaults. We've tried to specify what the defaults are below.
|
||||
for the test code to also see the newly generated header ,and not
|
||||
the old header with inline functions, the build system has to add
|
||||
the mock folder to the include paths.
|
||||
|
||||
|
||||
Furthermore, we need to keep the order of include paths in mind. We
|
||||
have to set the mock folder before the other includes to avoid the
|
||||
test code including the original header instead of the newly
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# =========================================================================
|
||||
# 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: 'build/'
|
||||
:colour: true
|
||||
|
||||
:paths:
|
||||
:source:
|
||||
- 'src/'
|
||||
:include:
|
||||
- 'src/'
|
||||
- '../../src/'
|
||||
- '../../vendor/unity/src/'
|
||||
- '../../vendor/unity/examples/example_3/helper/'
|
||||
- 'build/mocks/'
|
||||
- 'test/'
|
||||
:test: 'test/'
|
||||
:build: 'build/'
|
||||
:mocks: 'build/mocks/'
|
||||
|
||||
:extension:
|
||||
:object: '.o'
|
||||
:executable: '.exe'
|
||||
|
||||
:defines:
|
||||
:common:
|
||||
- __monitor
|
||||
- UNITY_SUPPORT_64
|
||||
|
||||
:cmock:
|
||||
# Core configuration
|
||||
:plugins: []
|
||||
:verbosity: 2
|
||||
:when_no_prototypes: :warn
|
||||
|
||||
# File configuration
|
||||
:mock_path: 'build/mocks'
|
||||
:skeleton_path: ''
|
||||
:mock_prefix: 'Mock'
|
||||
:mock_suffix: ''
|
||||
|
||||
# Parser configuration
|
||||
:strippables:
|
||||
- '(?:__attribute__\s*\([ (]*.*?[ )]*\)+)'
|
||||
:attributes:
|
||||
- __ramfunc
|
||||
- __irq
|
||||
- __fiq
|
||||
- register
|
||||
- extern
|
||||
:c_calling_conventions:
|
||||
- __stdcall
|
||||
- __cdecl
|
||||
- __fastcall
|
||||
:treat_externs: :exclude
|
||||
:treat_inlines: :exclude
|
||||
|
||||
# Type handling configuration
|
||||
:memcmp_if_unknown: true
|
||||
:when_ptr: :compare_data
|
||||
|
||||
# Mock generation configuration
|
||||
:weak: ''
|
||||
:enforce_strict_ordering: false
|
||||
:fail_on_unexpected_calls: true
|
||||
:callback_include_count: true
|
||||
:callback_after_arg_check: false
|
||||
:includes:
|
||||
- Types.h
|
||||
:exclude_setjmp_h: false
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
@@ -20,7 +20,7 @@ REQUIRED_DIRS.each do |v|
|
||||
end
|
||||
|
||||
# Load default configuration, for now
|
||||
DEFAULT_CONFIG_FILE = 'gcc.yml'.freeze
|
||||
DEFAULT_CONFIG_FILE = 'gcc_64.yml'.freeze
|
||||
configure_toolchain(DEFAULT_CONFIG_FILE)
|
||||
|
||||
task :unit do
|
||||
@@ -39,8 +39,8 @@ task :ci => [:default]
|
||||
task :cruise => [:default]
|
||||
|
||||
desc 'Load configuration'
|
||||
task :config, :config_file do |_t, args|
|
||||
configure_toolchain(args[:config_file])
|
||||
task :config, [:config_file, :cmock_overlay] do |_t, args|
|
||||
configure_toolchain(args[:config_file], args[:cmock_overlay])
|
||||
end
|
||||
|
||||
desc 'Return error on Failures'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
@@ -22,32 +22,67 @@ module RakefileHelpers
|
||||
YAML.load(yaml_string)
|
||||
end
|
||||
|
||||
def load_configuration(config_file)
|
||||
def find_cmock_target(targets_dir, config_file)
|
||||
return config_file if File.exist?("#{targets_dir}/#{config_file}")
|
||||
|
||||
basename = File.basename(config_file, '.yml')
|
||||
while basename.include?('_')
|
||||
basename = basename.rpartition('_').first
|
||||
candidate = "#{basename}.yml"
|
||||
return candidate if File.exist?("#{targets_dir}/#{candidate}")
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
def load_configuration(config_file, cmock_overlay = nil)
|
||||
$cfg_file = config_file
|
||||
$cfg = load_yaml(File.read("./targets/#{$cfg_file}"))
|
||||
$colour_output = false unless $cfg['colour']
|
||||
$proj = load_yaml(File.read('./project.yml'))
|
||||
|
||||
unity_target = "../../vendor/unity/test/targets/#{$cfg_file}"
|
||||
cmock_targets_dir = '../../test/targets'
|
||||
|
||||
if File.exist?(unity_target)
|
||||
puts "Loading Unity target: #{unity_target}"
|
||||
$unity_cfg = load_yaml(File.read(unity_target))
|
||||
|
||||
cmock_file = cmock_overlay || find_cmock_target(cmock_targets_dir, $cfg_file)
|
||||
if cmock_file
|
||||
puts "Loading CMock overlay: #{cmock_targets_dir}/#{cmock_file}"
|
||||
$cmock_cfg = load_yaml(File.read("#{cmock_targets_dir}/#{cmock_file}"))
|
||||
else
|
||||
puts "No CMock overlay found for #{$cfg_file}"
|
||||
$cmock_cfg = {}
|
||||
end
|
||||
else
|
||||
puts "Loading CMock-only target: #{cmock_targets_dir}/#{$cfg_file}"
|
||||
$unity_cfg = load_yaml(File.read("#{cmock_targets_dir}/#{$cfg_file}"))
|
||||
$cmock_cfg = {}
|
||||
end
|
||||
|
||||
$colour_output = $proj[:project][:colour]
|
||||
end
|
||||
|
||||
def configure_clean
|
||||
CLEAN.include("#{$cfg['compiler']['build_path']}*.*") unless $cfg['compiler']['build_path'].nil?
|
||||
CLEAN.include("#{$proj[:project][:build_root]}*.*")
|
||||
end
|
||||
|
||||
def configure_toolchain(config_file = DEFAULT_CONFIG_FILE)
|
||||
config_file += '.yml' unless config_file =~ /\.yml$/
|
||||
load_configuration(config_file)
|
||||
def configure_toolchain(config_file = DEFAULT_CONFIG_FILE, cmock_overlay = nil)
|
||||
config_file ||= DEFAULT_CONFIG_FILE
|
||||
config_file += '.yml' unless config_file =~ /\.yml$/i
|
||||
cmock_overlay += '.yml' if cmock_overlay && cmock_overlay !~ /\.yml$/i
|
||||
load_configuration(config_file, cmock_overlay)
|
||||
configure_clean
|
||||
end
|
||||
|
||||
def unit_test_files
|
||||
path = $cfg['compiler']['unit_tests_path'] + "Test*#{C_EXTENSION}"
|
||||
path = $proj[:paths][:test] + "Test*#{C_EXTENSION}"
|
||||
path.tr!('\\', '/')
|
||||
FileList.new(path)
|
||||
end
|
||||
|
||||
def local_include_dirs
|
||||
include_dirs = $cfg['compiler']['includes']['items'].dup
|
||||
include_dirs.delete_if { |dir| dir.is_a?(Array) }
|
||||
include_dirs
|
||||
$proj[:paths][:include].reject { |dir| dir.is_a?(Array) }
|
||||
end
|
||||
|
||||
def extract_headers(filename)
|
||||
@@ -55,9 +90,7 @@ module RakefileHelpers
|
||||
lines = File.readlines(filename)
|
||||
lines.each do |line|
|
||||
m = line.match(/^\s*#include\s+"\s*(.+\.[hH])\s*"/)
|
||||
unless m.nil?
|
||||
includes << m[1]
|
||||
end
|
||||
includes << m[1] unless m.nil?
|
||||
end
|
||||
includes
|
||||
end
|
||||
@@ -65,9 +98,7 @@ module RakefileHelpers
|
||||
def find_source_file(header, paths)
|
||||
paths.each do |dir|
|
||||
src_file = dir + header.ext(C_EXTENSION)
|
||||
if File.exist?(src_file)
|
||||
return src_file
|
||||
end
|
||||
return src_file if File.exist?(src_file)
|
||||
end
|
||||
nil
|
||||
end
|
||||
@@ -85,79 +116,85 @@ module RakefileHelpers
|
||||
end
|
||||
end
|
||||
|
||||
def squash(prefix, items)
|
||||
result = ''
|
||||
items.each { |item| result += " #{prefix}#{tackit(item)}" }
|
||||
result
|
||||
# All defines: project common + Unity target + CMock overlay + any extras
|
||||
def all_defines(extra = [])
|
||||
(($proj[:defines][:common] || []) +
|
||||
($unity_cfg[:defines][:test] || []) +
|
||||
(($cmock_cfg[:defines] || {})[:test] || []) +
|
||||
extra).uniq
|
||||
end
|
||||
|
||||
def build_compiler_fields
|
||||
command = tackit($cfg['compiler']['path'])
|
||||
defines = if $cfg['compiler']['defines']['items'].nil?
|
||||
''
|
||||
else
|
||||
squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'])
|
||||
end
|
||||
options = squash('', $cfg['compiler']['options'])
|
||||
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
||||
includes = includes.gsub(/\\ /, ' ').gsub(/\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||
{ :command => command, :defines => defines, :options => options, :includes => includes }
|
||||
# Toolchain-specific include paths: Array items in Unity's :paths: :test:
|
||||
def toolchain_include_paths
|
||||
if $unity_cfg[:paths] && $unity_cfg[:paths][:test]
|
||||
$unity_cfg[:paths][:test]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def compile(file, _defines = [])
|
||||
compiler = build_compiler_fields
|
||||
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " \
|
||||
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}"
|
||||
obj_file = "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
|
||||
execute(cmd_str + obj_file)
|
||||
obj_file
|
||||
# Resolve Unity's argument template tokens into a flat argument string.
|
||||
def build_argument_list(raw_args, toolchain_paths, project_paths, defines, input, output)
|
||||
result = []
|
||||
raw_args.each do |arg|
|
||||
if arg.is_a?(Array)
|
||||
result << arg.join
|
||||
elsif arg.include?('COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE')
|
||||
toolchain_paths.each { |p| result << "-I\"#{p.is_a?(Array) ? p.join : p}\"" }
|
||||
elsif arg.include?('COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR')
|
||||
project_paths.each { |p| result << "-I\"#{p}\"" }
|
||||
elsif arg.include?('COLLECTION_DEFINES_TEST_AND_VENDOR')
|
||||
defines.each { |d| result << "-D#{d}" }
|
||||
else
|
||||
result << arg.gsub('${1}', input.to_s).gsub('${2}', output.to_s)
|
||||
end
|
||||
end
|
||||
result.join(' ')
|
||||
end
|
||||
|
||||
def build_linker_fields
|
||||
command = tackit($cfg['linker']['path'])
|
||||
options = if $cfg['linker']['options'].nil?
|
||||
''
|
||||
else
|
||||
squash('', $cfg['linker']['options'])
|
||||
end
|
||||
includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?
|
||||
''
|
||||
else
|
||||
squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
|
||||
end
|
||||
includes = includes.gsub(/\\ /, ' ').gsub(/\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||
{ :command => command, :options => options, :includes => includes }
|
||||
def compile(file, extra_defines = [])
|
||||
tool = $unity_cfg[:tools][:test_compiler]
|
||||
ext = $unity_cfg[:extension][:object]
|
||||
build_root = $proj[:project][:build_root]
|
||||
obj_file = build_root + File.basename(file, C_EXTENSION) + ext
|
||||
|
||||
cmd_str = "#{tackit(tool[:executable])} #{
|
||||
build_argument_list(tool[:arguments],
|
||||
toolchain_include_paths,
|
||||
$proj[:paths][:include],
|
||||
all_defines(extra_defines),
|
||||
file, obj_file)}"
|
||||
execute(cmd_str)
|
||||
File.basename(obj_file)
|
||||
end
|
||||
|
||||
def link_it(exe_name, obj_list)
|
||||
linker = build_linker_fields
|
||||
cmd_str = "#{linker[:command]}#{linker[:includes]} " \
|
||||
"#{(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join}" \
|
||||
"#{$cfg['linker']['bin_files']['prefix']} " \
|
||||
"#{$cfg['linker']['bin_files']['destination']}" \
|
||||
"#{exe_name}#{$cfg['linker']['bin_files']['extension']} #{linker[:options]}"
|
||||
tool = $unity_cfg[:tools][:test_linker]
|
||||
ext = $unity_cfg[:extension][:executable]
|
||||
build_root = $proj[:project][:build_root]
|
||||
|
||||
input_files = obj_list.uniq.map { |obj| build_root + obj }.join(' ')
|
||||
output_file = build_root + exe_name + ext
|
||||
|
||||
cmd_str = "#{tackit(tool[:executable])} #{build_argument_list(tool[:arguments], [], [], [], input_files, output_file)}"
|
||||
execute(cmd_str)
|
||||
end
|
||||
|
||||
def build_simulator_fields
|
||||
return nil if $cfg['simulator'].nil?
|
||||
return nil unless $unity_cfg[:tools][:test_fixture]
|
||||
|
||||
command = if $cfg['simulator']['path'].nil?
|
||||
''
|
||||
else
|
||||
"#{tackit($cfg['simulator']['path'])} "
|
||||
end
|
||||
pre_support = if $cfg['simulator']['pre_support'].nil?
|
||||
''
|
||||
else
|
||||
squash('', $cfg['simulator']['pre_support'])
|
||||
end
|
||||
post_support = if $cfg['simulator']['post_support'].nil?
|
||||
''
|
||||
else
|
||||
squash('', $cfg['simulator']['post_support'])
|
||||
end
|
||||
{ :command => command, :pre_support => pre_support, :post_support => post_support }
|
||||
tool = $unity_cfg[:tools][:test_fixture]
|
||||
executable = tackit(tool[:executable])
|
||||
raw_args = tool[:arguments] || []
|
||||
idx = raw_args.index('${1}')
|
||||
if idx
|
||||
pre = raw_args[0...idx].map { |a| a.is_a?(Array) ? a.join : a }.join(' ')
|
||||
post = raw_args[(idx + 1)..].map { |a| a.is_a?(Array) ? a.join : a }.join(' ')
|
||||
else
|
||||
pre = ''
|
||||
post = raw_args.map { |a| a.is_a?(Array) ? a.join : a }.join(' ')
|
||||
end
|
||||
{ command: "#{executable} ", pre_support: pre, post_support: post }
|
||||
end
|
||||
|
||||
def execute(command_string, verbose = true, ok_to_fail = false)
|
||||
@@ -174,7 +211,7 @@ module RakefileHelpers
|
||||
def report_summary
|
||||
summary = UnityTestSummary.new
|
||||
summary.root = HERE
|
||||
results_glob = "#{$cfg['compiler']['build_path']}*.test*"
|
||||
results_glob = "#{$proj[:project][:build_root]}*.test*"
|
||||
results_glob.tr!('\\', '/')
|
||||
results = Dir[results_glob]
|
||||
summary.targets = results
|
||||
@@ -185,71 +222,56 @@ module RakefileHelpers
|
||||
def run_tests(test_files)
|
||||
report 'Running system tests...'
|
||||
|
||||
# Tack on TEST define for compiling unit tests
|
||||
load_configuration($cfg_file)
|
||||
test_defines = ['TEST']
|
||||
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
||||
$cfg['compiler']['defines']['items'] << 'TEST'
|
||||
|
||||
include_dirs = local_include_dirs
|
||||
|
||||
# Build and execute each unit test
|
||||
test_files.each do |test|
|
||||
# Detect dependencies and build required required modules
|
||||
header_list = (extract_headers(test) + ['cmock.h'] + [$cfg[:cmock][:unity_helper_path]]).compact.uniq
|
||||
# Detect dependencies and build required modules
|
||||
header_list = (extract_headers(test) + ['cmock.h'] + [($proj[:cmock] || {})[:unity_helper_path]]).compact.uniq
|
||||
header_list.each do |header|
|
||||
# create mocks if needed
|
||||
next unless header =~ /Mock/
|
||||
|
||||
require '../../lib/cmock'
|
||||
@cmock ||= CMock.new(".//targets//#{$cfg_file}")
|
||||
@cmock.setup_mocks([$cfg['compiler']['source_path'] + header.gsub('Mock', '')])
|
||||
@cmock ||= CMock.new($proj[:cmock])
|
||||
@cmock.setup_mocks([$proj[:paths][:source].first + header.gsub('Mock', '')])
|
||||
end
|
||||
|
||||
# compile all mocks
|
||||
# compile all mocks and dependencies
|
||||
obj_list = []
|
||||
header_list.each do |header|
|
||||
# compile source file header if it exists
|
||||
src_file = find_source_file(header, include_dirs)
|
||||
unless src_file.nil?
|
||||
obj_list << compile(src_file, test_defines)
|
||||
end
|
||||
obj_list << compile(src_file, ['TEST']) unless src_file.nil?
|
||||
end
|
||||
|
||||
# Build the test runner (generate if configured to do so)
|
||||
test_base = File.basename(test, C_EXTENSION)
|
||||
# Build the test runner
|
||||
test_base = File.basename(test, C_EXTENSION)
|
||||
runner_name = "#{test_base}_Runner.c"
|
||||
if $cfg['compiler']['runner_path'].nil?
|
||||
runner_path = "#{$cfg['compiler']['build_path']}#{runner_name}"
|
||||
test_gen = UnityTestRunnerGenerator.new(".//targets//#{$cfg_file}")
|
||||
test_gen.run(test, runner_path)
|
||||
else
|
||||
runner_path = $cfg['compiler']['runner_path'] + runner_name
|
||||
end
|
||||
runner_path = "#{$proj[:project][:build_root]}#{runner_name}"
|
||||
UnityTestRunnerGenerator.new({}).run(test, runner_path)
|
||||
|
||||
obj_list << compile(runner_path, test_defines)
|
||||
obj_list << compile(runner_path, ['TEST'])
|
||||
|
||||
# Build the test module
|
||||
obj_list << compile(test, test_defines)
|
||||
obj_list << compile(test, ['TEST'])
|
||||
|
||||
# Link the test executable
|
||||
link_it(test_base, obj_list)
|
||||
|
||||
# Execute unit test and generate results file
|
||||
simulator = build_simulator_fields
|
||||
executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
|
||||
simulator = build_simulator_fields
|
||||
build_root = $proj[:project][:build_root]
|
||||
executable = build_root + test_base + $unity_cfg[:extension][:executable]
|
||||
cmd_str = if simulator.nil?
|
||||
executable
|
||||
else
|
||||
"#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
||||
end
|
||||
output = execute(cmd_str, true)
|
||||
test_results = $cfg['compiler']['build_path'] + test_base
|
||||
test_results += if output.match(/OK$/m).nil?
|
||||
'.testfail'
|
||||
else
|
||||
'.testpass'
|
||||
end
|
||||
test_results = build_root + test_base
|
||||
test_results += output.match(/OK$/m).nil? ? '.testfail' : '.testpass'
|
||||
File.open(test_results, 'w') { |f| f.print output }
|
||||
end
|
||||
end
|
||||
@@ -258,23 +280,20 @@ module RakefileHelpers
|
||||
report 'Building application...'
|
||||
|
||||
obj_list = []
|
||||
load_configuration(".//targets//#{$cfg_file}")
|
||||
main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION
|
||||
load_configuration($cfg_file)
|
||||
main_path = $proj[:paths][:source].first + main + C_EXTENSION
|
||||
|
||||
# Detect dependencies and build required required modules
|
||||
# Detect dependencies and build required modules
|
||||
include_dirs = local_include_dirs
|
||||
extract_headers(main_path).each do |header|
|
||||
src_file = find_source_file(header, include_dirs)
|
||||
unless src_file.nil?
|
||||
obj_list << compile(src_file)
|
||||
end
|
||||
obj_list << compile(src_file) unless src_file.nil?
|
||||
end
|
||||
|
||||
# Build the main source file
|
||||
main_base = File.basename(main_path, C_EXTENSION)
|
||||
obj_list << compile(main_path)
|
||||
|
||||
# Create the executable
|
||||
link_it(main_base, obj_list)
|
||||
link_it(File.basename(main_path, C_EXTENSION), obj_list)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
compiler:
|
||||
path: gcc
|
||||
source_path: 'src/'
|
||||
unit_tests_path: &unit_tests_path 'test/'
|
||||
build_path: &build_path 'build/'
|
||||
options:
|
||||
- -c
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- 'src/'
|
||||
- '../../src/'
|
||||
- '../../vendor/unity/src/'
|
||||
- '../../vendor/unity/examples/example_3/helper/'
|
||||
- './build/mocks/'
|
||||
- *unit_tests_path
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- __monitor
|
||||
- UNITY_SUPPORT_64
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.o'
|
||||
destination: *build_path
|
||||
linker:
|
||||
path: gcc
|
||||
options:
|
||||
- -lm
|
||||
includes:
|
||||
prefix: '-I'
|
||||
object_files:
|
||||
path: *build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.exe'
|
||||
destination: *build_path
|
||||
:cmock:
|
||||
# Core conffiguration
|
||||
:plugins: [] # What plugins should be used by CMock?
|
||||
:verbosity: 2 # the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
|
||||
:when_no_prototypes: :warn # the options being :ignore, :warn, or :erro
|
||||
|
||||
# File configuration
|
||||
:mock_path: './build/mocks' # Subdirectory to store mocks when generated (default: mocks)
|
||||
:skeleton_path: '' # Subdirectory to store stubs when generated (default: '')
|
||||
:mock_prefix: 'Mock' # Prefix to append to filenames for mocks
|
||||
:mock_suffix: '' # Suffix to append to filenames for mocks
|
||||
|
||||
# Parser configuration
|
||||
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
|
||||
:attributes:
|
||||
- __ramfunc
|
||||
- __irq
|
||||
- __fiq
|
||||
- register
|
||||
- extern
|
||||
:c_calling_conventions:
|
||||
- __stdcall
|
||||
- __cdecl
|
||||
- __fastcall
|
||||
:treat_externs: :exclude # the options being :include or :exclud
|
||||
:treat_inlines: :exclude # the options being :include or :exclud
|
||||
|
||||
# Type handling configuration
|
||||
#:unity_helper_path: '' # specify a string of where to find a unity_helper.h file to discover custom type assertions
|
||||
#:treat_as: {} # optionally add additional types to map custom types
|
||||
#:treat_as_array: {} # hint to cmock that these types are pointers to something
|
||||
#:treat_as_void: [] # hint to cmock that these types are actually aliases of void
|
||||
:memcmp_if_unknown: true # allow cmock to use the memory comparison assertions for unknown types
|
||||
:when_ptr: :compare_data # hint to cmock how to handle pointers in general, the options being :compare_ptr, :compare_data, or :smart
|
||||
|
||||
# Mock generation configuration
|
||||
:weak: '' # Symbol to use to declare weak functions
|
||||
:enforce_strict_ordering: false # Do we want cmock to enforce ordering of all function calls?
|
||||
:fail_on_unexpected_calls: true # Do we want cmock to fail when it encounters a function call that wasn't expected?
|
||||
:callback_include_count: true # Do we want cmock to include the number of calls to this callback, when using callbacks?
|
||||
:callback_after_arg_check: false # Do we want cmock to enforce an argument check first when using a callback?
|
||||
:includes: # You can add additional includes here, or specify the location with the options below
|
||||
- Types.h
|
||||
#:includes_h_pre_orig_header: []
|
||||
#:includes_h_post_orig_header: []
|
||||
#:includes_c_pre_header: []
|
||||
#:includes_c_post_header: []
|
||||
#:array_size_type: [] # Specify a type or types that should be used for array lengths
|
||||
#:array_size_name: 'size|len' # Specify a name or names that CMock might automatically recognize as the length of an array
|
||||
:exclude_setjmp_h: false # Don't use setjmp when running CMock. Note that this might result in late reporting or out-of-order failures.
|
||||
|
||||
colour: true
|
||||
@@ -1,143 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
|
||||
compiler:
|
||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||
source_path: 'src\'
|
||||
unit_tests_path: &unit_tests_path 'test\'
|
||||
build_path: &build_path 'build\'
|
||||
options:
|
||||
- --dlib_config
|
||||
- [*tools_root, 'arm\lib\dl4tptinl8n.h']
|
||||
- -z3
|
||||
- --no_cse
|
||||
- --no_unroll
|
||||
- --no_inline
|
||||
- --no_code_motion
|
||||
- --no_tbaa
|
||||
- --no_clustering
|
||||
- --no_scheduling
|
||||
- --debug
|
||||
- --cpu_mode thumb
|
||||
- --endian little
|
||||
- --cpu ARM7TDMI
|
||||
- --stack_align 4
|
||||
- --interwork
|
||||
- -e
|
||||
- --silent
|
||||
- --warnings_are_errors
|
||||
- --fpu None
|
||||
- --diag_suppress Pa050
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- 'src/'
|
||||
- '../../src/'
|
||||
- '../../vendor/unity/src/'
|
||||
- '../../vendor/unity/examples/example_3/helper/'
|
||||
- './build/mocks/'
|
||||
- [*tools_root, 'arm\inc\']
|
||||
- *unit_tests_path
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.r79'
|
||||
destination: *build_path
|
||||
linker:
|
||||
path: [*tools_root, 'common\bin\xlink.exe']
|
||||
options:
|
||||
- -rt
|
||||
- [*tools_root, 'arm\lib\dl4tptinl8n.r79']
|
||||
- -D_L_EXTMEM_START=0
|
||||
- -D_L_EXTMEM_SIZE=0
|
||||
- -D_L_HEAP_SIZE=120
|
||||
- -D_L_STACK_SIZE=32
|
||||
- -e_small_write=_formatted_write
|
||||
- -s
|
||||
- __program_start
|
||||
- -f
|
||||
- [*tools_root, '\arm\config\lnkarm.xcl']
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- [*tools_root, 'arm\config\']
|
||||
- [*tools_root, 'arm\lib\']
|
||||
object_files:
|
||||
path: *build_path
|
||||
extension: '.r79'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.d79'
|
||||
destination: *build_path
|
||||
simulator:
|
||||
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||
pre_support:
|
||||
- --silent
|
||||
- [*tools_root, 'arm\bin\armproc.dll']
|
||||
- [*tools_root, 'arm\bin\armsim.dll']
|
||||
post_support:
|
||||
- --plugin
|
||||
- [*tools_root, 'arm\bin\armbat.dll']
|
||||
- --backend
|
||||
- -B
|
||||
- -p
|
||||
- [*tools_root, 'arm\config\ioat91sam7X256.ddf']
|
||||
- -d
|
||||
- sim
|
||||
:cmock:
|
||||
# Core conffiguration
|
||||
:plugins: [] # What plugins should be used by CMock?
|
||||
:verbosity: 2 # the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
|
||||
:when_no_prototypes: :warn # the options being :ignore, :warn, or :erro
|
||||
|
||||
# File configuration
|
||||
:mock_path: './build/mocks' # Subdirectory to store mocks when generated (default: mocks)
|
||||
:skeleton_path: './' # Subdirectory to store stubs when generated (default: '')
|
||||
:mock_prefix: 'Mock' # Prefix to append to filenames for mocks
|
||||
:mock_suffix: '' # Suffix to append to filenames for mocks
|
||||
|
||||
# Parser configuration
|
||||
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
|
||||
:attributes:
|
||||
- __ramfunc
|
||||
- __irq
|
||||
- __fiq
|
||||
- register
|
||||
- extern
|
||||
:c_calling_conventions:
|
||||
- __stdcall
|
||||
- __cdecl
|
||||
- __fastcall
|
||||
:treat_externs: :exclude # the options being :include or :exclud
|
||||
:treat_inlines: :exclude # the options being :include or :exclud
|
||||
|
||||
# Type handling configuration
|
||||
#:unity_helper_path: '' # specify a string of where to find a unity_helper.h file to discover custom type assertions
|
||||
#:treat_as: {} # optionally add additional types to map custom types
|
||||
#:treat_as_array: {} # hint to cmock that these types are pointers to something
|
||||
#:treat_as_void: [] # hint to cmock that these types are actually aliases of void
|
||||
:memcmp_if_unknown: true # allow cmock to use the memory comparison assertions for unknown types
|
||||
:when_ptr: :compare_data # hint to cmock how to handle pointers in general, the options being :compare_ptr, :compare_data, or :smart
|
||||
|
||||
# Mock generation configuration
|
||||
:weak: '' # Symbol to use to declare weak functions
|
||||
:enforce_strict_ordering: false # Do we want cmock to enforce ordering of all function calls?
|
||||
:fail_on_unexpected_calls: true # Do we want cmock to fail when it encounters a function call that wasn't expected?
|
||||
:callback_include_count: true # Do we want cmock to include the number of calls to this callback, when using callbacks?
|
||||
:callback_after_arg_check: false # Do we want cmock to enforce an argument check first when using a callback?
|
||||
:includes: # You can add additional includes here, or specify the location with the options below
|
||||
- Types.h
|
||||
#:includes_h_pre_orig_header: []
|
||||
#:includes_h_post_orig_header: []
|
||||
#:includes_c_pre_header: []
|
||||
#:includes_c_post_header: []
|
||||
#:array_size_type: [] # Specify a type or types that should be used for array lengths
|
||||
#:array_size_name: 'size|len' # Specify a name or names that CMock might automatically recognize as the length of an array
|
||||
:exclude_setjmp_h: false # Don't use setjmp when running CMock. Note that this might result in late reporting or out-of-order failures.
|
||||
@@ -1,132 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
|
||||
compiler:
|
||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||
source_path: 'src\'
|
||||
unit_tests_path: &unit_tests_path 'test\'
|
||||
build_path: &build_path 'build\'
|
||||
options:
|
||||
- --dlib_config
|
||||
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
|
||||
- --no_cse
|
||||
- --no_unroll
|
||||
- --no_inline
|
||||
- --no_code_motion
|
||||
- --no_tbaa
|
||||
- --no_clustering
|
||||
- --no_scheduling
|
||||
- --debug
|
||||
- --cpu_mode thumb
|
||||
- --endian=little
|
||||
- --cpu=ARM7TDMI
|
||||
- --interwork
|
||||
- --warnings_are_errors
|
||||
- --fpu=None
|
||||
- --diag_suppress=Pa050
|
||||
- --diag_suppress=Pe111
|
||||
- -e
|
||||
- -On
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- 'src/'
|
||||
- '../../src/'
|
||||
- '../../vendor/unity/src/'
|
||||
- '../../vendor/unity/examples/example_3/helper/'
|
||||
- './build/mocks/'
|
||||
- [*tools_root, 'arm\inc\']
|
||||
- *unit_tests_path
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.r79'
|
||||
destination: *build_path
|
||||
linker:
|
||||
path: [*tools_root, 'arm\bin\ilinkarm.exe']
|
||||
options:
|
||||
- --redirect _Printf=_PrintfLarge
|
||||
- --redirect _Scanf=_ScanfSmall
|
||||
- --semihosting
|
||||
- --entry __iar_program_start
|
||||
- --config
|
||||
- [*tools_root, 'arm\config\generic.icf']
|
||||
object_files:
|
||||
path: *build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.out'
|
||||
destination: *build_path
|
||||
simulator:
|
||||
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||
pre_support:
|
||||
- --silent
|
||||
- [*tools_root, 'arm\bin\armproc.dll']
|
||||
- [*tools_root, 'arm\bin\armsim.dll']
|
||||
post_support:
|
||||
- --plugin
|
||||
- [*tools_root, 'arm\bin\armbat.dll']
|
||||
- --backend
|
||||
- -B
|
||||
- -p
|
||||
- [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
|
||||
- -d
|
||||
- sim
|
||||
:cmock:
|
||||
# Core conffiguration
|
||||
:plugins: [] # What plugins should be used by CMock?
|
||||
:verbosity: 2 # the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
|
||||
:when_no_prototypes: :warn # the options being :ignore, :warn, or :erro
|
||||
|
||||
# File configuration
|
||||
:mock_path: './build/mocks' # Subdirectory to store mocks when generated (default: mocks)
|
||||
:skeleton_path: '' # Subdirectory to store stubs when generated (default: '')
|
||||
:mock_prefix: 'Mock' # Prefix to append to filenames for mocks
|
||||
:mock_suffix: '' # Suffix to append to filenames for mocks
|
||||
|
||||
# Parser configuration
|
||||
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
|
||||
:attributes:
|
||||
- __ramfunc
|
||||
- __irq
|
||||
- __fiq
|
||||
- register
|
||||
- extern
|
||||
:c_calling_conventions:
|
||||
- __stdcall
|
||||
- __cdecl
|
||||
- __fastcall
|
||||
:treat_externs: :exclude # the options being :include or :exclud
|
||||
:treat_inlines: :exclude # the options being :include or :exclud
|
||||
|
||||
# Type handling configuration
|
||||
#:unity_helper_path: '' # specify a string of where to find a unity_helper.h file to discover custom type assertions
|
||||
#:treat_as: {} # optionally add additional types to map custom types
|
||||
#:treat_as_array: {} # hint to cmock that these types are pointers to something
|
||||
#:treat_as_void: [] # hint to cmock that these types are actually aliases of void
|
||||
:memcmp_if_unknown: true # allow cmock to use the memory comparison assertions for unknown types
|
||||
:when_ptr: :compare_data # hint to cmock how to handle pointers in general, the options being :compare_ptr, :compare_data, or :smart
|
||||
|
||||
# Mock generation configuration
|
||||
:weak: '' # Symbol to use to declare weak functions
|
||||
:enforce_strict_ordering: false # Do we want cmock to enforce ordering of all function calls?
|
||||
:fail_on_unexpected_calls: true # Do we want cmock to fail when it encounters a function call that wasn't expected?
|
||||
:callback_include_count: true # Do we want cmock to include the number of calls to this callback, when using callbacks?
|
||||
:callback_after_arg_check: false # Do we want cmock to enforce an argument check first when using a callback?
|
||||
:includes: # You can add additional includes here, or specify the location with the options below
|
||||
- Types.h
|
||||
#:includes_h_pre_orig_header: []
|
||||
#:includes_h_post_orig_header: []
|
||||
#:includes_c_pre_header: []
|
||||
#:includes_c_post_header: []
|
||||
#:array_size_type: [] # Specify a type or types that should be used for array lengths
|
||||
#:array_size_name: 'size|len' # Specify a name or names that CMock might automatically recognize as the length of an array
|
||||
:exclude_setjmp_h: false # Don't use setjmp when running CMock. Note that this might result in late reporting or out-of-order failures.
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* =========================================================================
|
||||
CMock - Automatic Mock Generation for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
@@ -43,6 +43,7 @@ class CMockConfig
|
||||
:array_size_name => 'size|len',
|
||||
:skeleton => false,
|
||||
:exclude_setjmp_h => false,
|
||||
:create_error_stubs => true,
|
||||
|
||||
# Format to look for inline functions.
|
||||
# This is a combination of "static" and "inline" keywords ("static inline", "inline static", "inline", "static")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
@@ -13,6 +13,7 @@ class CMockGeneratorPluginArray
|
||||
@config = config
|
||||
@ptr_handling = @config.when_ptr
|
||||
@ordered = @config.enforce_strict_ordering
|
||||
@error_stubs = @config.create_error_stubs
|
||||
@utils = utils
|
||||
@unity_helper = @utils.helpers[:unity_helper]
|
||||
@priority = 8
|
||||
@@ -33,15 +34,17 @@ class CMockGeneratorPluginArray
|
||||
type = @utils.arg_type_with_const(m)
|
||||
m[:ptr?] ? "#{type} #{m[:name]}, int #{m[:name]}_Depth" : "#{type} #{m[:name]}"
|
||||
end.join(', ')
|
||||
lines = ''
|
||||
if function[:return][:void?]
|
||||
"#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call_i}, cmock_retval) TEST_FAIL_MESSAGE(\"#{function[:name]} requires _ExpectWithArray (not AndReturn)\");\n" \
|
||||
"#define #{function[:name]}_ExpectWithArray(#{args_call_i}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call_o})\n" \
|
||||
"void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n"
|
||||
lines << "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call_i}, cmock_retval) TEST_FAIL_MESSAGE(\"#{function[:name]} requires _ExpectWithArray (not AndReturn)\");\n" if @error_stubs
|
||||
lines << "#define #{function[:name]}_ExpectWithArray(#{args_call_i}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call_o})\n"
|
||||
lines << "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n"
|
||||
else
|
||||
"#define #{function[:name]}_ExpectWithArray(#{args_call_i}) TEST_FAIL_MESSAGE(\"#{function[:name]} requires _ExpectWithArrayAndReturn\");\n" \
|
||||
"#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call_i}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call_o}, cmock_retval)\n" \
|
||||
"void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n"
|
||||
lines << "#define #{function[:name]}_ExpectWithArray(#{args_call_i}) TEST_FAIL_MESSAGE(\"#{function[:name]} requires _ExpectWithArrayAndReturn\");\n" if @error_stubs
|
||||
lines << "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call_i}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call_o}, cmock_retval)\n"
|
||||
lines << "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n"
|
||||
end
|
||||
lines
|
||||
end
|
||||
|
||||
def mock_interfaces(function)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
@@ -43,7 +43,8 @@ class CMockGeneratorPluginCallback
|
||||
end
|
||||
|
||||
def mock_implementation(function)
|
||||
" if (Mock.#{function[:name]}_CallbackFunctionPointer != NULL)\n {\n" +
|
||||
" if (Mock.#{function[:name]}_CallbackFunctionPointer != NULL)\n {\n" \
|
||||
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n" +
|
||||
if function[:return][:void?]
|
||||
" #{generate_call(function)};\n }\n"
|
||||
else
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user