mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
Merge pull request #530 from ThrowTheSwitch/refactor/inherit_targets
Refactor/inherit targets
This commit is contained in:
@@ -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
|
||||
@@ -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'
|
||||
|
||||
@@ -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,97 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 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-26 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-26 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.
|
||||
@@ -0,0 +1,33 @@
|
||||
# =========================================================================
|
||||
# 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
|
||||
|
||||
+17
-16
@@ -14,7 +14,7 @@ require './rakefile_helper'
|
||||
|
||||
include RakefileHelpers
|
||||
|
||||
DEFAULT_CONFIG_FILE = 'gcc.yml'
|
||||
DEFAULT_CONFIG_FILE = 'gcc_64.yml'
|
||||
CMOCK_TEST_ROOT = File.expand_path(File.dirname(__FILE__))
|
||||
|
||||
SYSTEM_TEST_SUPPORT_DIRS = [
|
||||
@@ -30,18 +30,15 @@ end
|
||||
|
||||
task :prep_system_tests => SYSTEM_TEST_SUPPORT_DIRS
|
||||
|
||||
configure_clean
|
||||
configure_toolchain(DEFAULT_CONFIG_FILE)
|
||||
|
||||
task :default => [:test]
|
||||
task :ci => [:no_color, :default, 'test:examples', 'style:check']
|
||||
task :ci => [:no_color, :default, 'test:examples', 'style:check', 'test:summary']
|
||||
task :cruise => :ci
|
||||
|
||||
desc "Load configuration"
|
||||
task :config, :config_file do |t, args|
|
||||
args = {:config_file => DEFAULT_CONFIG_FILE} if args[:config_file].nil?
|
||||
args = {:config_file => args[:config_file] + '.yml'} unless args[:config_file] =~ /\.yml$/i
|
||||
configure_toolchain(args[:config_file])
|
||||
task :config, [:config_file, :cmock_overlay] do |t, args|
|
||||
configure_toolchain(args[:config_file], args[:cmock_overlay])
|
||||
end
|
||||
|
||||
# Still support testing everything with just 'test' but switch default to ceedling-like test:all
|
||||
@@ -52,9 +49,8 @@ namespace :test do
|
||||
task :all => [:clobber, :prep_system_tests, 'test:units', 'test:c', 'test:system']
|
||||
|
||||
desc "Run Unit Tests"
|
||||
Rake::TestTask.new('units') do |t|
|
||||
t.pattern = 'unit/*_test.rb'
|
||||
t.verbose = true
|
||||
task :units => [:prep_system_tests] do
|
||||
run_ruby_unit_tests
|
||||
end
|
||||
|
||||
#individual unit tests
|
||||
@@ -67,7 +63,7 @@ namespace :test do
|
||||
|
||||
desc "Run C Unit Tests"
|
||||
task :c => [:prep_system_tests] do
|
||||
unless ($cfg['unsupported'].include? "C")
|
||||
unless (unsupported_tests.include? "C")
|
||||
build_and_test_c_files
|
||||
end
|
||||
end
|
||||
@@ -75,9 +71,9 @@ namespace :test do
|
||||
desc "Run System Tests"
|
||||
task :system => [:clobber, :prep_system_tests] do
|
||||
#get a list of all system tests, removing unsupported tests for this compiler
|
||||
sys_unsupported = $cfg['unsupported'].map {|a| 'system/test_interactions/'+a+'.yml'}
|
||||
sys_unsupported = unsupported_tests.map {|a| 'system/test_interactions/'+a+'.yml'}
|
||||
sys_tests_to_run = FileList['system/test_interactions/*.yml'] - sys_unsupported
|
||||
compile_unsupported = $cfg['unsupported'].map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'}
|
||||
compile_unsupported = unsupported_tests.map {|a| SYSTEST_COMPILE_MOCKABLES_PATH+a+'.h'}
|
||||
compile_tests_to_run = FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'] - compile_unsupported
|
||||
unless (sys_unsupported.empty? and compile_unsupported.empty?)
|
||||
report "\nIgnoring these system tests..."
|
||||
@@ -109,6 +105,11 @@ namespace :test do
|
||||
task :profile => [:clobber, :prep_system_tests] do
|
||||
run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'])
|
||||
end
|
||||
|
||||
desc "Generate test summary"
|
||||
task :summary do
|
||||
report_summary
|
||||
end
|
||||
end
|
||||
|
||||
task :no_color do
|
||||
@@ -123,7 +124,7 @@ namespace :style do
|
||||
report "--------------------\n"
|
||||
report "VERIFYING RUBY STYLE\n"
|
||||
report "--------------------\n"
|
||||
report execute("rubocop ../lib ../examples ../config ../scripts --config ../vendor/unity/test/.rubocop.yml", true)
|
||||
execute("rubocop ../lib ../examples ../config ../scripts --config ../vendor/unity/test/.rubocop.yml", true)
|
||||
report "Styling Ruby:PASS"
|
||||
end
|
||||
|
||||
@@ -134,13 +135,13 @@ namespace :style do
|
||||
|
||||
desc "Attempt to Autocorrect style"
|
||||
task :auto => ['style:clean'] do
|
||||
report execute("rubocop ../lib ../examples ../config ../scripts --auto-correct --config ../vendor/unity/test/.rubocop.yml", true)
|
||||
execute("rubocop ../lib ../examples ../config ../scripts --autocorrect --config ../vendor/unity/test/.rubocop.yml", true)
|
||||
report "Autocorrected What We Could."
|
||||
end
|
||||
|
||||
desc "Update style todo list"
|
||||
task :todo => ['style:clean'] do
|
||||
report execute("rubocop ../lib ../examples ../config ../scripts --auto-gen-config --config ../vendor/unity/test/.rubocop.yml", true)
|
||||
execute("rubocop ../lib ../examples ../config ../scripts --auto-gen-config --config ../vendor/unity/test/.rubocop.yml", true)
|
||||
report "Updated Style TODO List."
|
||||
end
|
||||
|
||||
|
||||
+251
-139
@@ -29,26 +29,63 @@ module RakefileHelpers
|
||||
end
|
||||
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('./targets/' + $cfg_file)
|
||||
$colour_output = false unless $cfg['colour']
|
||||
$proj = load_yaml('./project.yml')
|
||||
|
||||
unity_target = "../vendor/unity/test/targets/#{$cfg_file}"
|
||||
cmock_targets_dir = './targets'
|
||||
|
||||
if File.exist?(unity_target)
|
||||
# Load Unity base target, then CMock overlay (unsupported list, extra defines)
|
||||
puts "Loading Unity target: #{unity_target}"
|
||||
$unity_cfg = load_yaml(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("#{cmock_targets_dir}/#{cmock_file}")
|
||||
else
|
||||
puts "No CMock overlay found for #{$cfg_file}"
|
||||
$cmock_cfg = {}
|
||||
end
|
||||
else
|
||||
# CMock-only target (no Unity equivalent); it uses Unity format directly
|
||||
puts "Loading CMock-only target: #{cmock_targets_dir}/#{$cfg_file}"
|
||||
$unity_cfg = load_yaml("#{cmock_targets_dir}/#{$cfg_file}")
|
||||
$cmock_cfg = {}
|
||||
end
|
||||
|
||||
$colour_output = $proj[:project][:colour]
|
||||
end
|
||||
|
||||
def configure_clean
|
||||
CLEAN.include(SYSTEST_GENERATED_FILES_PATH + '*.*')
|
||||
CLEAN.include(SYSTEST_BUILD_FILES_PATH + '*.*')
|
||||
CLEAN.include($proj[:project][:build_root] + '*.*')
|
||||
end
|
||||
|
||||
def configure_toolchain(config_file)
|
||||
load_configuration(config_file)
|
||||
def configure_toolchain(config_file = DEFAULT_CONFIG_FILE, cmock_overlay = nil)
|
||||
config_file = 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 get_local_include_dirs
|
||||
include_dirs = $cfg['compiler']['includes']['items'].dup
|
||||
include_dirs.delete_if {|dir| dir.is_a?(Array)}
|
||||
return include_dirs
|
||||
$proj[:paths][:include].reject { |dir| dir.is_a?(Array) }
|
||||
end
|
||||
|
||||
def extract_headers(filename)
|
||||
@@ -56,100 +93,123 @@ module RakefileHelpers
|
||||
lines = File.readlines(filename)
|
||||
lines.each do |line|
|
||||
m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/)
|
||||
if not m.nil?
|
||||
includes << m[1]
|
||||
end
|
||||
includes << m[1] unless m.nil?
|
||||
end
|
||||
includes << File.basename(filename,".c").slice(5,256) + "_unity_helper.h"
|
||||
includes << File.basename(filename, ".c").slice(5, 256) + "_unity_helper.h"
|
||||
return includes
|
||||
end
|
||||
|
||||
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
|
||||
return src_file if File.exist?(src_file)
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
def tackit(strings)
|
||||
case strings
|
||||
when Array
|
||||
"\"#{strings.join}\""
|
||||
when /^-/
|
||||
strings
|
||||
when /\s/
|
||||
"\"#{strings}\""
|
||||
else
|
||||
strings
|
||||
end
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
# Toolchain-specific include paths: Array items in Unity's :paths: :test:
|
||||
# (e.g., IAR compiler include directories encoded as path-concatenation arrays)
|
||||
def toolchain_include_paths
|
||||
($unity_cfg[:paths][:test] || []).select { |p| p.is_a?(Array) }
|
||||
end
|
||||
|
||||
# Returns the unsupported test list, regardless of whether it came from
|
||||
# a CMock overlay or a CMock-only target file.
|
||||
def unsupported_tests
|
||||
$cmock_cfg[:unsupported] || $unity_cfg[:unsupported] || []
|
||||
end
|
||||
|
||||
# Resolve Unity's argument template tokens and produce a flat argument string.
|
||||
# COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE → -I per toolchain path (Arrays from :paths: :test:)
|
||||
# COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR → -I per project include path
|
||||
# COLLECTION_DEFINES_TEST_AND_VENDOR → -D per define
|
||||
# ${1} → input file(s)
|
||||
# ${2} → output file
|
||||
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
|
||||
return nil
|
||||
result.join(' ')
|
||||
end
|
||||
|
||||
def squash(prefix, items)
|
||||
result = ''
|
||||
items.each { |item| result += " #{prefix}#{tackit(item)}" }
|
||||
return result
|
||||
end
|
||||
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
|
||||
|
||||
def build_compiler_fields
|
||||
command = tackit($cfg['compiler']['path'])
|
||||
if $cfg['compiler']['defines']['items'].nil?
|
||||
defines = ''
|
||||
else
|
||||
defines = 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)
|
||||
return {:command => command, :defines => defines, :options => options, :includes => includes}
|
||||
end
|
||||
|
||||
def compile(file, defines=[])
|
||||
compiler = build_compiler_fields
|
||||
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{defines.inject(''){|all, a| ' -D'+a+all }}#{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)
|
||||
return obj_file
|
||||
end
|
||||
|
||||
def build_linker_fields
|
||||
command = tackit($cfg['linker']['path'])
|
||||
if $cfg['linker']['options'].nil?
|
||||
options = ''
|
||||
else
|
||||
options = squash('', $cfg['linker']['options'])
|
||||
end
|
||||
if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?)
|
||||
includes = ''
|
||||
else
|
||||
includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
|
||||
end
|
||||
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||
return {:command => command, :options => options, :includes => includes}
|
||||
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[:options]}#{linker[:includes]} " +
|
||||
(obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).uniq.join +
|
||||
$cfg['linker']['bin_files']['prefix'] + ' ' +
|
||||
$cfg['linker']['bin_files']['destination'] +
|
||||
exe_name + $cfg['linker']['bin_files']['extension']
|
||||
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?
|
||||
if $cfg['simulator']['path'].nil?
|
||||
command = ''
|
||||
return nil unless $unity_cfg[:tools][:test_fixture]
|
||||
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
|
||||
command = (tackit($cfg['simulator']['path']) + ' ')
|
||||
pre = ''
|
||||
post = raw_args.map { |a| a.is_a?(Array) ? a.join : a }.join(' ')
|
||||
end
|
||||
if $cfg['simulator']['pre_support'].nil?
|
||||
pre_support = ''
|
||||
else
|
||||
pre_support = squash('', $cfg['simulator']['pre_support'])
|
||||
end
|
||||
if $cfg['simulator']['post_support'].nil?
|
||||
post_support = ''
|
||||
else
|
||||
post_support = squash('', $cfg['simulator']['post_support'])
|
||||
end
|
||||
return {:command => command, :pre_support => pre_support, :post_support => post_support}
|
||||
{ command: "#{executable} ", pre_support: pre, post_support: post }
|
||||
end
|
||||
|
||||
def execute(command_string, verbose=true, raise_on_failure=true)
|
||||
#report command_string
|
||||
output = `#{command_string}`.chomp
|
||||
report(output) if (verbose && !output.nil? && (output.length > 0))
|
||||
if ($?.exitstatus != 0) and (raise_on_failure)
|
||||
@@ -158,19 +218,6 @@ module RakefileHelpers
|
||||
return output
|
||||
end
|
||||
|
||||
def tackit(strings)
|
||||
case(strings)
|
||||
when Array
|
||||
"\"#{strings.join}\""
|
||||
when /^-/
|
||||
strings
|
||||
when /\s/
|
||||
"\"#{strings}\""
|
||||
else
|
||||
strings
|
||||
end
|
||||
end
|
||||
|
||||
def run_astyle(style_what)
|
||||
report "Styling C Code..."
|
||||
command = "AStyle " \
|
||||
@@ -183,14 +230,70 @@ module RakefileHelpers
|
||||
report "Styling C:PASS"
|
||||
end
|
||||
|
||||
def save_test_results(test_base, output)
|
||||
build_root = $proj[:project][:build_root]
|
||||
test_results = build_root + test_base
|
||||
test_results += output.match(/OK\s*$/m) ? '.testpass' : '.testfail'
|
||||
File.open(test_results, 'w') { |f| f.print output }
|
||||
end
|
||||
|
||||
def collect_test_output(output)
|
||||
total_tests = 0
|
||||
total_failures = 0
|
||||
total_ignored = 0
|
||||
detail_lines = []
|
||||
|
||||
output.each_line do |line|
|
||||
stripped = line.chomp
|
||||
if stripped =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/
|
||||
total_tests += Regexp.last_match(1).to_i
|
||||
total_failures += Regexp.last_match(2).to_i
|
||||
total_ignored += Regexp.last_match(3).to_i
|
||||
elsif stripped =~ /^[^:]+:[^:]+:\w+(?:\([^)]*\))?:(?:PASS|FAIL|IGNORE)/
|
||||
detail_lines << stripped
|
||||
end
|
||||
end
|
||||
|
||||
synthesized = detail_lines.join("\n")
|
||||
synthesized += "\n" unless detail_lines.empty?
|
||||
synthesized += "#{total_tests} Tests #{total_failures} Failures #{total_ignored} Ignored\n"
|
||||
synthesized += total_failures > 0 ? "FAILED\n" : "OK\n"
|
||||
synthesized
|
||||
end
|
||||
|
||||
def run_ruby_unit_tests
|
||||
report "\n"
|
||||
report "--------------------\n"
|
||||
report "RUBY UNIT TEST SUITE\n"
|
||||
report "--------------------\n"
|
||||
total_runs = total_failures = total_errors = total_skips = 0
|
||||
Dir['unit/*_test.rb'].sort.each do |tst|
|
||||
report "\nRunning #{tst.to_s}"
|
||||
output = execute("ruby -I. #{tst}", true, false)
|
||||
output.each_line do |line|
|
||||
if line =~ /(\d+) runs, \d+ assertions, (\d+) failures, (\d+) errors, (\d+) skips/
|
||||
total_runs += Regexp.last_match(1).to_i
|
||||
total_failures += Regexp.last_match(2).to_i
|
||||
total_errors += Regexp.last_match(3).to_i
|
||||
total_skips += Regexp.last_match(4).to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
failures = total_failures + total_errors
|
||||
result = "#{total_runs} Tests #{failures} Failures #{total_skips} Ignored\n"
|
||||
result += failures > 0 ? "FAILED\n" : "OK\n"
|
||||
save_test_results('ruby_unit_tests', result)
|
||||
raise "Ruby unit tests failed." if failures > 0
|
||||
end
|
||||
|
||||
def report_summary
|
||||
summary = UnityTestSummary.new
|
||||
summary.root = File.expand_path(File.dirname(__FILE__)) + '/'
|
||||
results_glob = "#{$cfg['compiler']['build_path']}*.test*"
|
||||
results_glob = "#{$proj[:project][:build_root]}*.test*"
|
||||
results_glob.gsub!(/\\/, '/')
|
||||
results = Dir[results_glob]
|
||||
summary.targets = results
|
||||
summary.run
|
||||
report summary.run
|
||||
fail_out "FAIL: There were failures" if (summary.failures > 0)
|
||||
end
|
||||
|
||||
@@ -201,7 +304,6 @@ module RakefileHelpers
|
||||
test_files = FileList.new(SYSTEST_GENERATED_FILES_PATH + 'test*.c')
|
||||
|
||||
load_configuration($cfg_file)
|
||||
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
||||
|
||||
include_dirs = get_local_include_dirs
|
||||
|
||||
@@ -215,25 +317,23 @@ module RakefileHelpers
|
||||
|
||||
report "Executing system tests in #{File.basename(test)}..."
|
||||
|
||||
# Detect dependencies and build required required modules
|
||||
# Detect dependencies and build required modules
|
||||
extract_headers(test).each do |header|
|
||||
|
||||
# Generate any needed mocks
|
||||
if header =~ /^mock_(.*)\.h/i
|
||||
if header =~ /^mock_(.*)\.[hH]$/i
|
||||
module_name = $1
|
||||
cmock = CMock.new(SYSTEST_GENERATED_FILES_PATH + cmock_config)
|
||||
cmock.setup_mocks("#{$cfg['compiler']['source_path']}#{module_name}.h")
|
||||
cmock.setup_mocks("#{$proj[:paths][:source].first}#{module_name}.h")
|
||||
end
|
||||
# Compile corresponding source file if it exists
|
||||
src_file = find_source_file(header, include_dirs)
|
||||
if !src_file.nil?
|
||||
obj_list << compile(src_file)
|
||||
end
|
||||
obj_list << compile(src_file) unless src_file.nil?
|
||||
end
|
||||
|
||||
# Generate and build the test suite runner
|
||||
runner_name = test_base + '_runner.c'
|
||||
runner_path = $cfg['compiler']['source_path'] + runner_name
|
||||
runner_path = $proj[:paths][:source].first + runner_name
|
||||
UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path)
|
||||
obj_list << compile(runner_path)
|
||||
|
||||
@@ -244,15 +344,17 @@ module RakefileHelpers
|
||||
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']
|
||||
if simulator.nil?
|
||||
cmd_str = executable
|
||||
else
|
||||
cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
||||
end
|
||||
simulator = build_simulator_fields
|
||||
ext = $unity_cfg[:extension][:executable]
|
||||
build_root = $proj[:project][:build_root]
|
||||
executable = build_root + test_base + ext
|
||||
cmd_str = if simulator.nil?
|
||||
executable
|
||||
else
|
||||
"#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
||||
end
|
||||
output = execute(cmd_str, false, false)
|
||||
test_results = $cfg['compiler']['build_path'] + test_base + RESULT_EXTENSION
|
||||
test_results = build_root + test_base + RESULT_EXTENSION
|
||||
File.open(test_results, 'w') { |f| f.print output }
|
||||
end
|
||||
|
||||
@@ -267,10 +369,8 @@ module RakefileHelpers
|
||||
|
||||
test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION)
|
||||
result_file = test_file.ext(RESULT_EXTENSION)
|
||||
test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file).reject {|line| line.size < 10 } # we're rejecting lines that are too short to be realistic, which handles line ending problems
|
||||
test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file).reject {|line| line.size < 10 }
|
||||
tests.each_with_index do |test, index|
|
||||
# compare test's intended pass/fail state with pass/fail state in actual results;
|
||||
# if they don't match, the system test has failed
|
||||
this_failed = case(test[:pass])
|
||||
when :ignore
|
||||
(test_results[index] =~ /:IGNORE/).nil?
|
||||
@@ -284,7 +384,6 @@ module RakefileHelpers
|
||||
test_results[index] =~ /test#{index+1}:(.+)/
|
||||
failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:#{$1}"
|
||||
end
|
||||
# some tests have additional requirements to check for (checking the actual output message)
|
||||
if (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/)
|
||||
total_failures += 1
|
||||
failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}' but was '#{test_results[index]}'"
|
||||
@@ -301,13 +400,15 @@ module RakefileHelpers
|
||||
|
||||
if (failure_messages.size > 0)
|
||||
report 'System test failures:'
|
||||
failure_messages.each do |failure|
|
||||
report failure
|
||||
end
|
||||
failure_messages.each { |failure| report failure }
|
||||
end
|
||||
|
||||
report ''
|
||||
|
||||
result = failure_messages.join("\n")
|
||||
result += "\n" unless failure_messages.empty?
|
||||
result += "#{total_tests} Tests #{total_failures} Failures 0 Ignored\n"
|
||||
result += total_failures > 0 ? "FAILED\n" : "OK\n"
|
||||
save_test_results('system_interactions', result)
|
||||
return total_failures
|
||||
end
|
||||
|
||||
@@ -332,27 +433,27 @@ module RakefileHelpers
|
||||
|
||||
def run_system_test_compilations(mockables)
|
||||
load '../lib/cmock.rb'
|
||||
|
||||
load_configuration($cfg_file)
|
||||
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
||||
|
||||
report "\n"
|
||||
report "------------------------------------\n"
|
||||
report "SYSTEM TEST MOCK COMPILATION SUMMARY\n"
|
||||
report "------------------------------------\n"
|
||||
pass_count = 0
|
||||
mockables.each do |header|
|
||||
mock_filename = 'mock_' + File.basename(header).ext('.c')
|
||||
CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header)
|
||||
report "Compiling #{mock_filename}..."
|
||||
compile(SYSTEST_GENERATED_FILES_PATH + mock_filename)
|
||||
pass_count += 1
|
||||
end
|
||||
report "#{pass_count} Tests 0 Failures 0 Ignored\nOK\n"
|
||||
save_test_results('system_compilations', "#{pass_count} Tests 0 Failures 0 Ignored\nOK\n")
|
||||
end
|
||||
|
||||
def run_system_test_profiles(mockables)
|
||||
load '../lib/cmock.rb'
|
||||
|
||||
load_configuration($cfg_file)
|
||||
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
||||
|
||||
report "\n"
|
||||
report "--------------------------\n"
|
||||
@@ -375,25 +476,24 @@ module RakefileHelpers
|
||||
report "----------------\n"
|
||||
report "UNIT TEST C CODE\n"
|
||||
report "----------------\n"
|
||||
errors = false
|
||||
ext = $unity_cfg[:extension][:executable]
|
||||
build_root = $proj[:project][:build_root]
|
||||
combined_output = ''
|
||||
FileList.new("c/*.yml").each do |yaml_file|
|
||||
test = load_yaml(yaml_file)
|
||||
report "\nTesting #{yaml_file.sub('.yml','')}"
|
||||
report "(#{test[:options].join(', ')})"
|
||||
test[:files].each { |f| compile(f, test[:options]) }
|
||||
obj_files = test[:files].map { |f| f.gsub!(/.*\//,'').gsub!(C_EXTENSION, $cfg['compiler']['object_files']['extension']) }
|
||||
obj_files = test[:files].map { |f| f.gsub!(/.*\//,'').gsub!(C_EXTENSION, $unity_cfg[:extension][:object]) }
|
||||
link_it('TestCMockC', obj_files)
|
||||
if $cfg['simulator'].nil?
|
||||
execute($cfg['linker']['bin_files']['destination'] + 'TestCMockC' + $cfg['linker']['bin_files']['extension'])
|
||||
else
|
||||
execute(tackit($cfg['simulator']['path'].join) + ' ' +
|
||||
$cfg['simulator']['pre_support'].map{|o| tackit(o)}.join(' ') + ' ' +
|
||||
$cfg['linker']['bin_files']['destination'] +
|
||||
'TestCMockC' +
|
||||
$cfg['linker']['bin_files']['extension'] + ' ' +
|
||||
$cfg['simulator']['post_support'].map{|o| tackit(o)}.join(' ') )
|
||||
end
|
||||
simulator = build_simulator_fields
|
||||
executable = build_root + 'TestCMockC' + ext
|
||||
cmd = simulator.nil? ? executable : "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
||||
combined_output += execute(cmd, true, false) + "\n"
|
||||
end
|
||||
result = collect_test_output(combined_output)
|
||||
save_test_results('c_unit_tests', result)
|
||||
raise "C unit tests failed." if result =~ /FAILED/
|
||||
end
|
||||
|
||||
def run_examples(verbose=false, raise_on_failure=true)
|
||||
@@ -401,12 +501,25 @@ module RakefileHelpers
|
||||
report "-----------------\n"
|
||||
report "VALIDATE EXAMPLES\n"
|
||||
report "-----------------\n"
|
||||
[ "cd #{File.join("..","examples","make_example")} && make clean && make setup && make test",
|
||||
"cd #{File.join("..","examples","temp_sensor")} && rake ci"
|
||||
total_tests = 0
|
||||
total_failures = 0
|
||||
total_ignored = 0
|
||||
[ "cd #{File.join("..", "examples", "make_example")} && make clean && make setup && make test",
|
||||
"cd #{File.join("..", "examples", "temp_sensor")} && rake ci"
|
||||
].each do |cmd|
|
||||
report "Testing '#{cmd}'"
|
||||
execute(cmd, verbose, raise_on_failure)
|
||||
execute(cmd, verbose, false).each_line do |line|
|
||||
if line =~ /(\d+) TOTAL TESTS (\d+) TOTAL FAILURES (\d+) IGNORED/
|
||||
total_tests += Regexp.last_match(1).to_i
|
||||
total_failures += Regexp.last_match(2).to_i
|
||||
total_ignored += Regexp.last_match(3).to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
result = "#{total_tests} Tests #{total_failures} Failures #{total_ignored} Ignored\n"
|
||||
result += total_failures > 0 ? "FAILED\n" : "OK\n"
|
||||
save_test_results('examples', result)
|
||||
raise "Examples failed." if total_failures > 0 && raise_on_failure
|
||||
end
|
||||
|
||||
def fail_out(msg)
|
||||
@@ -414,4 +527,3 @@ module RakefileHelpers
|
||||
exit(-1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class SystemTestGenerator
|
||||
|
||||
require 'cmock.rb'
|
||||
cmock = CMock.new(GENERATED_PATH + namix + 'cmock' + YAML_EXTENSION)
|
||||
cmock.setup_skeletons("#{$cfg['compiler']['source_path']}#{name}.h")
|
||||
cmock.setup_skeletons("#{$proj[:paths][:source].first}#{name}.h")
|
||||
end
|
||||
|
||||
def write_header_file(filename, upcase_name, include_list=[])
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
typedef unsigned short U16;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
/* CMock should handle UTF-8 characters in comments. The world is an awesomely diverse place! */
|
||||
/* my µC Rocks! Open Source, not ©! My language has no Ümlauts! ǺƜǝƧǾɱɛ! */ /**! Illegal: åäö */
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
# CMock overlay for vendor/unity/test/targets/clang_strict.yml
|
||||
# Only contains additions not present in the Unity base target.
|
||||
:unsupported:
|
||||
- out_of_memory
|
||||
- callingconv
|
||||
@@ -1,97 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
---
|
||||
compiler:
|
||||
path: clang
|
||||
source_path: &systest_generated_path './system/generated/'
|
||||
unit_tests_path: &unit_tests_path '../examples/test/'
|
||||
mocks_path: &systest_mocks_path './system/generated/'
|
||||
build_path: &systest_build_path './system/build/'
|
||||
options:
|
||||
- '-c'
|
||||
- '-Wall'
|
||||
- '-Wextra'
|
||||
- '-Werror'
|
||||
#- '-Wcast-qual'
|
||||
- '-Wconversion'
|
||||
- '-Wtautological-compare'
|
||||
#- '-Wtautological-pointer-compare'
|
||||
- '-Wdisabled-optimization'
|
||||
- '-Wformat=2'
|
||||
- '-Winit-self'
|
||||
- '-Winline'
|
||||
- '-Winvalid-pch'
|
||||
- '-Wmissing-declarations'
|
||||
- '-Wmissing-include-dirs'
|
||||
- '-Wmissing-prototypes'
|
||||
- '-Wnonnull'
|
||||
- '-Wpacked'
|
||||
- '-Wpointer-arith'
|
||||
- '-Wredundant-decls'
|
||||
- '-Wswitch-default'
|
||||
- '-Wstrict-aliasing=2'
|
||||
- '-Wstrict-overflow=5'
|
||||
- '-Wuninitialized'
|
||||
- '-Wunused'
|
||||
- '-Wunreachable-code'
|
||||
- '-Wreturn-type'
|
||||
- '-Wshadow'
|
||||
- '-Wundef'
|
||||
- '-Wwrite-strings'
|
||||
- '-Wbad-function-cast'
|
||||
- '-Wno-missing-prototypes' #we've been lazy about things like setUp and tearDown
|
||||
- '-Wno-invalid-token-paste'
|
||||
- '-fms-extensions'
|
||||
- '-fno-omit-frame-pointer'
|
||||
#- '-ffloat-store'
|
||||
- '-fno-common'
|
||||
- '-fstrict-aliasing'
|
||||
- '-std=gnu99'
|
||||
- '-pedantic'
|
||||
- '-O0'
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- '../src/'
|
||||
- '../vendor/unity/src/'
|
||||
- '../vendor/c_exception/lib/'
|
||||
- './system/test_compilation/'
|
||||
- './'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- CMOCK
|
||||
- 'UNITY_SUPPORT_64'
|
||||
- 'UNITY_POINTER_WIDTH=64'
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.o'
|
||||
destination: *systest_build_path
|
||||
|
||||
linker:
|
||||
path: gcc
|
||||
options:
|
||||
- -lm
|
||||
includes:
|
||||
prefix: '-I'
|
||||
object_files:
|
||||
path: *systest_build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.exe'
|
||||
destination: *systest_build_path
|
||||
|
||||
unsupported:
|
||||
- out_of_memory
|
||||
- callingconv
|
||||
|
||||
colour: true
|
||||
@@ -1,65 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
---
|
||||
compiler:
|
||||
path: gcc
|
||||
source_path: &systest_generated_path './system/generated/'
|
||||
unit_tests_path: &unit_tests_path '../examples/test/'
|
||||
mocks_path: &systest_mocks_path './system/generated/'
|
||||
build_path: &systest_build_path './system/build/'
|
||||
options:
|
||||
- '-c'
|
||||
- '-Wall'
|
||||
- '-Wextra'
|
||||
- '-Wunused-parameter'
|
||||
- '-Wno-address'
|
||||
- '-Wno-invalid-token-paste'
|
||||
- '-std=c99'
|
||||
- '-pedantic'
|
||||
- '-O0'
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- '../src/'
|
||||
- '../vendor/unity/src/'
|
||||
- '../vendor/c_exception/lib/'
|
||||
- './system/test_compilation/'
|
||||
- './'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- CMOCK
|
||||
- 'UNITY_SUPPORT_64'
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.o'
|
||||
destination: *systest_build_path
|
||||
|
||||
linker:
|
||||
path: gcc
|
||||
options:
|
||||
- -lm
|
||||
includes:
|
||||
prefix: '-I'
|
||||
object_files:
|
||||
path: *systest_build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.exe'
|
||||
destination: *systest_build_path
|
||||
|
||||
unsupported:
|
||||
- out_of_memory
|
||||
- unity_64bit_support
|
||||
- callingconv
|
||||
|
||||
colour: true
|
||||
@@ -0,0 +1,14 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
# CMock overlay for vendor/unity/test/targets/gcc_32.yml
|
||||
# Only contains additions not present in the Unity base target.
|
||||
---
|
||||
:unsupported:
|
||||
- out_of_memory
|
||||
- unity_64bit_support
|
||||
- callingconv
|
||||
+3
-56
@@ -5,61 +5,8 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
---
|
||||
compiler:
|
||||
path: gcc
|
||||
source_path: &systest_generated_path './system/generated/'
|
||||
unit_tests_path: &unit_tests_path '../examples/test/'
|
||||
mocks_path: &systest_mocks_path './system/generated/'
|
||||
build_path: &systest_build_path './system/build/'
|
||||
options:
|
||||
- '-c'
|
||||
- '-m64'
|
||||
- '-Wall'
|
||||
- '-Wunused-parameter'
|
||||
- '-Wno-address'
|
||||
- '-Wno-invalid-token-paste'
|
||||
- '-std=c99'
|
||||
- '-pedantic'
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- '../src/'
|
||||
- '../vendor/unity/src/'
|
||||
- '../vendor/c_exception/lib/'
|
||||
- './system/test_compilation/'
|
||||
- './'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- CMOCK
|
||||
- 'UNITY_SUPPORT_64'
|
||||
- 'UNITY_POINTER_WIDTH=64'
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.o'
|
||||
destination: *systest_build_path
|
||||
|
||||
linker:
|
||||
path: gcc
|
||||
options:
|
||||
- -lm
|
||||
- '-m64'
|
||||
includes:
|
||||
prefix: '-I'
|
||||
object_files:
|
||||
path: *systest_build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.exe'
|
||||
destination: *systest_build_path
|
||||
|
||||
unsupported:
|
||||
# CMock overlay for vendor/unity/test/targets/gcc_64.yml
|
||||
# Only contains additions not present in the Unity base target.
|
||||
:unsupported:
|
||||
- out_of_memory
|
||||
- callingconv
|
||||
|
||||
colour: true
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
---
|
||||
compiler:
|
||||
path: gcc
|
||||
source_path: &systest_generated_path './system/generated/'
|
||||
unit_tests_path: &unit_tests_path '../examples/test/'
|
||||
mocks_path: &systest_mocks_path './system/generated/'
|
||||
build_path: &systest_build_path './system/build/'
|
||||
options:
|
||||
- '-c'
|
||||
- '-Wall'
|
||||
- '-Wextra'
|
||||
- '-Wunused-parameter'
|
||||
- '-Wno-address'
|
||||
- '-Wno-invalid-token-paste'
|
||||
- '-std=c99'
|
||||
- '-pedantic'
|
||||
- '-O0'
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- '../src/'
|
||||
- '../vendor/unity/src/'
|
||||
- '../vendor/c_exception/lib/'
|
||||
- './system/test_compilation/'
|
||||
- './'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- CMOCK
|
||||
- 'CMOCK_MEM_STATIC'
|
||||
- 'CMOCK_MEM_SIZE=1024'
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.o'
|
||||
destination: *systest_build_path
|
||||
|
||||
linker:
|
||||
path: gcc
|
||||
options:
|
||||
- -lm
|
||||
includes:
|
||||
prefix: '-I'
|
||||
object_files:
|
||||
path: *systest_build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.exe'
|
||||
destination: *systest_build_path
|
||||
|
||||
unsupported:
|
||||
- all_plugins_but_other_limits
|
||||
- all_plugins_coexist
|
||||
- array_and_pointer_handling
|
||||
- const_primitives_handling
|
||||
- enforce_strict_ordering
|
||||
- expect_and_return_custom_types
|
||||
- expect_and_return_treat_as
|
||||
- expect_and_throw
|
||||
- expect_any_args
|
||||
- fancy_pointer_handling
|
||||
- function_pointer_handling
|
||||
- newer_standards_stuff1
|
||||
- nonstandard_pased_stuff_1
|
||||
- nonstandard_pased_stuff_2
|
||||
- parsing_challenges
|
||||
- return_thru_ptr_and_expect_any_args
|
||||
- return_thru_ptr_ignore_arg
|
||||
- struct_union_enum_expect_and_return
|
||||
- struct_union_enum_expect_and_return_with_plugins
|
||||
- stubs_with_callbacks
|
||||
- unity_64bit_support
|
||||
- unity_ignores
|
||||
- callingconv
|
||||
- C
|
||||
|
||||
colour: true
|
||||
@@ -0,0 +1,16 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
# CMock overlay for vendor/unity/test/targets/iar_arm_v4.yml
|
||||
# Only contains additions not present in the Unity base target.
|
||||
|
||||
:unsupported:
|
||||
- out_of_memory
|
||||
- nonstandard_parsed_stuff_1
|
||||
- const
|
||||
- callingconv
|
||||
- unity_64bit_support
|
||||
@@ -1,117 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0\'
|
||||
compiler:
|
||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||
source_path: &systest_generated_path './system/generated/'
|
||||
unit_tests_path: &unit_tests_path '../examples/test/'
|
||||
mocks_path: &systest_mocks_path './system/generated/'
|
||||
build_path: &systest_build_path './system/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
|
||||
#We are supressing some warnings here because we test CMock against some questionable code to make sure it still works
|
||||
- --diag_suppress Pa050
|
||||
- --diag_suppress Pe191
|
||||
- --diag_suppress=Pe494
|
||||
- --diag_suppress=Pe083
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- [*tools_root, 'arm\inc\']
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- '../src/'
|
||||
- '../vendor/unity/src/'
|
||||
- '../vendor/c_exception/lib/'
|
||||
- './system/test_compilation/'
|
||||
- './'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- CMOCK
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.r79'
|
||||
destination: *systest_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 iar\iar_v4\Resource\at91SAM7X256_FLASH.xcl'
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- 'vendor/unity/src/'
|
||||
- [*tools_root, 'arm\config\']
|
||||
- [*tools_root, 'arm\lib\']
|
||||
object_files:
|
||||
path: *systest_build_path
|
||||
extension: '.r79'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.d79'
|
||||
destination: *systest_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']
|
||||
- --macro
|
||||
- 'iar\iar_v4\Resource\SAM7_SIM.mac'
|
||||
- --backend
|
||||
- -B
|
||||
- -p
|
||||
- [*tools_root, 'arm\config\ioat91sam7X256.ddf']
|
||||
- -d
|
||||
- sim
|
||||
|
||||
unsupported:
|
||||
- out_of_memory
|
||||
- nonstandard_parsed_stuff_1
|
||||
- const
|
||||
- callingconv
|
||||
- unity_64bit_support
|
||||
|
||||
colour: true
|
||||
@@ -1,102 +0,0 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 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: &systest_generated_path './system/generated/'
|
||||
unit_tests_path: &unit_tests_path '../examples/test/'
|
||||
mocks_path: &systest_mocks_path './system/generated/'
|
||||
build_path: &systest_build_path './system/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
|
||||
- -e
|
||||
- -On
|
||||
#We are supressing some warnings here because we test CMock against some questionable code to make sure it still works
|
||||
- --diag_suppress=Pa050
|
||||
- --diag_suppress=Pe191
|
||||
- --diag_suppress=Pe494
|
||||
- --diag_suppress=Pe083
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- [*tools_root, 'arm\inc\']
|
||||
- *systest_generated_path
|
||||
- *unit_tests_path
|
||||
- *systest_mocks_path
|
||||
- '../src/'
|
||||
- '../vendor/unity/src/'
|
||||
- '../vendor/c_exception/lib/'
|
||||
- './system/test_compilation/'
|
||||
- './'
|
||||
- '.\iar\iar_v5\incIAR\'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
- CMOCK
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.r79'
|
||||
destination: *systest_build_path
|
||||
|
||||
linker:
|
||||
path: [*tools_root, 'arm\bin\ilinkarm.exe']
|
||||
options:
|
||||
- --redirect _Printf=_PrintfLarge
|
||||
- --redirect _Scanf=_ScanfSmall
|
||||
- --semihosting
|
||||
- --entry __iar_program_start
|
||||
- --config iar\iar_v5\Resource\at91SAM7X256_RAM.icf
|
||||
object_files:
|
||||
path: *systest_build_path
|
||||
extension: '.o'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.out'
|
||||
destination: *systest_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']
|
||||
- --macro
|
||||
- 'iar\iar_v5\Resource\SAM7_SIM.mac'
|
||||
- --backend
|
||||
- -B
|
||||
- -p
|
||||
- [*tools_root, 'arm\config\debugger\Atmel\ioat91sam7X256.ddf']
|
||||
- -d
|
||||
- sim
|
||||
|
||||
unsupported:
|
||||
- out_of_memory
|
||||
- nonstandard_parsed_stuff_1
|
||||
- const
|
||||
- callingconv
|
||||
- unity_64bit_support
|
||||
|
||||
colour: true
|
||||
@@ -0,0 +1,37 @@
|
||||
# =========================================================================
|
||||
# CMock - Automatic Mock Generation for C
|
||||
# ThrowTheSwitch.org
|
||||
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
# SPDX-License-Identifier: MIT
|
||||
# =========================================================================
|
||||
|
||||
---
|
||||
:defines:
|
||||
:test:
|
||||
- CMOCK_MEM_STATIC
|
||||
- CMOCK_MEM_SIZE=1024
|
||||
:unsupported:
|
||||
- all_plugins_but_other_limits
|
||||
- all_plugins_coexist
|
||||
- array_and_pointer_handling
|
||||
- const_primitives_handling
|
||||
- enforce_strict_ordering
|
||||
- expect_and_return_custom_types
|
||||
- expect_and_return_treat_as
|
||||
- expect_and_throw
|
||||
- expect_any_args
|
||||
- fancy_pointer_handling
|
||||
- function_pointer_handling
|
||||
- newer_standards_stuff1
|
||||
- nonstandard_pased_stuff_1
|
||||
- nonstandard_pased_stuff_2
|
||||
- parsing_challenges
|
||||
- return_thru_ptr_and_expect_any_args
|
||||
- return_thru_ptr_ignore_arg
|
||||
- struct_union_enum_expect_and_return
|
||||
- struct_union_enum_expect_and_return_with_plugins
|
||||
- stubs_with_callbacks
|
||||
- unity_64bit_support
|
||||
- unity_ignores
|
||||
- callingconv
|
||||
- C
|
||||
Vendored
+1
-1
Submodule vendor/unity updated: 5e3a3db2f1...c7b0faabdc
Reference in New Issue
Block a user