11 Commits

Author SHA1 Message Date
Mark VanderVoord dd00b96f0d Fix broken tests for supporting exclude_setjmp. Verify cexception won't be run when this is enabled. 2021-01-29 10:47:52 -05:00
Mark VanderVoord aa5113e012 Update apt-get in the hopes that this makes multilib happy. 2021-01-29 10:12:40 -05:00
Mark VanderVoord 325b6b333a Revert "Revert "CMock can now compile without setjmp.h present on the platform""
This reverts commit 3eccb8e3d4.
2021-01-29 10:06:08 -05:00
Mark VanderVoord 73fd65928c Merge pull request #345 from ThrowTheSwitch/revert-329-master
Revert "CMock can now compile without setjmp.h present on the platform"
2021-01-28 08:15:45 -05:00
Mark VanderVoord 3eccb8e3d4 Revert "CMock can now compile without setjmp.h present on the platform" 2021-01-28 08:15:10 -05:00
Mark VanderVoord 1f939c9005 Merge pull request #329 from jmrubillon/master
CMock can now compile without setjmp.h present on the platform
2021-01-28 08:04:40 -05:00
Jean Rubillon 9e1c6c068d Fix missed has_setjmp_h convert to exclude_setjmp_h 2021-01-28 12:57:02 +00:00
Jean Rubillon 4ae268dbbe Changed has_setjmp_h option to exclude_setjmp_h 2021-01-27 18:56:02 +00:00
Mark VanderVoord d847e6777c Merge pull request #344 from ThrowTheSwitch/test/switch_to_actions
Switch to github actions
2021-01-16 22:22:34 -05:00
Jean Rubillon 21d181380f Signal that cexception needs setjmp to be supported. 2020-09-08 21:11:54 +01:00
Jean Rubillon 72b356b97d Added option to remove setjmp.h from generated mock files as not supported on all embedded systems 2020-09-08 20:50:48 +01:00
9 changed files with 35 additions and 4 deletions
+1
View File
@@ -19,6 +19,7 @@ jobs:
# Install Multilib
- name: Install Multilib
run: |
sudo apt-get update --assume-yes
sudo apt-get install --assume-yes --quiet gcc-multilib
# Checks out repository under $GITHUB_WORKSPACE
+7
View File
@@ -477,6 +477,13 @@ from the defaults. We've tried to specify what the defaults are below.
* default: `['(?:__attribute__\s*\(+.*?\)+)']`
* `:exclude_setjmp_h`:
Some embedded systems don't have <setjmp.h> available. Setting this to true
removes references to this header file and the ability to use cexception.
* default: false
* `:subdir`:
This is a relative subdirectory for your mocks. Set this to e.g. "sys" in
order to create a mock for `sys/types.h` in `(:mock_path)/sys/`.
+1
View File
@@ -41,6 +41,7 @@ class CMockConfig
:array_size_type => [],
:array_size_name => 'size|len',
:skeleton => false,
:exclude_setjmp_h => false,
# Format to look for inline functions.
# This is a combination of "static" and "inline" keywords ("static inline", "inline static", "inline", "static")
+7 -2
View File
@@ -19,6 +19,7 @@ class CMockGenerator
@ordered = @config.enforce_strict_ordering
@framework = @config.framework.to_s
@fail_on_unexpected_calls = @config.fail_on_unexpected_calls
@exclude_setjmp_h = @config.exclude_setjmp_h
@subdir = @config.subdir
@folder = nil
@@ -182,7 +183,9 @@ class CMockGenerator
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" unless functions.empty?
file << "#include <string.h>\n"
file << "#include <stdlib.h>\n"
file << "#include <setjmp.h>\n"
unless @exclude_setjmp_h
file << "#include <setjmp.h>\n"
end
file << "#include \"cmock.h\"\n"
@includes_c_pre_header.each { |inc| file << "#include #{inc}\n" }
file << "#include \"#{header_file}\"\n"
@@ -218,7 +221,9 @@ class CMockGenerator
end
def create_extern_declarations(file)
file << "extern jmp_buf AbortFrame;\n"
unless @exclude_setjmp_h
file << "extern jmp_buf AbortFrame;\n"
end
if @ordered
file << "extern int GlobalExpectCount;\n"
file << "extern int GlobalVerifyOrder;\n"
+1
View File
@@ -12,6 +12,7 @@ class CMockGeneratorPluginCexception
@config = config
@utils = utils
@priority = 7
raise 'Error: cexception is not supported without setjmp support' if @config.exclude_setjmp_h
end
def include_files
+1 -1
View File
@@ -11,7 +11,7 @@
#define CMOCK_VERSION_MAJOR 2
#define CMOCK_VERSION_MINOR 5
#define CMOCK_VERSION_BUILD 2
#define CMOCK_VERSION_BUILD 3
#define CMOCK_VERSION ((CMOCK_VERSION_MAJOR << 16) | (CMOCK_VERSION_MINOR << 8) | CMOCK_VERSION_BUILD)
/* should be big enough to index full range of CMOCK_MEM_MAX */
+3
View File
@@ -55,6 +55,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
@config.expect :subdir, nil
@config.expect :fail_on_unexpected_calls, true
@config.expect :treat_inlines, :exclude
@config.expect :exclude_setjmp_h, false
@cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
@cmock_generator.module_name = @module_name
@cmock_generator.module_ext = '.h'
@@ -75,6 +76,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
@config.expect :subdir, nil
@config.expect :fail_on_unexpected_calls, true
@config.expect :treat_inlines, :exclude
@config.expect :exclude_setjmp_h, false
@cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
@cmock_generator_strict.module_name = @module_name
@cmock_generator_strict.module_ext = '.h'
@@ -145,6 +147,7 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
@config.expect :subdir, nil
@config.expect :fail_on_unexpected_calls, true
@config.expect :treat_inlines, :exclude
@config.expect :exclude_setjmp_h, false
@cmock_generator2 = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
@cmock_generator2.module_name = "Pout-Pout Fish"
@cmock_generator2.module_ext = '.h'
@@ -11,6 +11,9 @@ describe CMockGeneratorPluginCexception, "Verify CMockGeneratorPluginCexception
before do
create_mocks :config, :utils
@config.expect :exclude_setjmp_h, false
@cmock_generator_plugin_cexception = CMockGeneratorPluginCexception.new(@config, @utils)
end
@@ -93,4 +96,13 @@ describe CMockGeneratorPluginCexception, "Verify CMockGeneratorPluginCexception
assert_equal(expected, returned)
end
it "should throw an exception if we try to use this plugin when setjmp disabled" do
@config.expect :exclude_setjmp_h, true
assert_raises RuntimeError do
@cmock_generator_plugin_cexception = CMockGeneratorPluginCexception.new(@config, @utils)
end
end
end
+2 -1
View File
@@ -18,7 +18,8 @@ describe CMockPluginManager, "Verify CMockPluginManager Module" do
:respond_to => true,
:when_ptr => :compare_data,
:enforce_strict_ordering => false,
:ignore => :args_and_calls
:ignore => :args_and_calls,
:exclude_setjmp_h => false
)
def @config.plugins