Skip to content

Commit 49435d9

Browse files
authored
Merge pull request #425 from ThrowTheSwitch/cmock_2_6_rc
CMock 2.6 Release Candidate
2 parents 9192a95 + f767b67 commit 49435d9

File tree

212 files changed

+3018
-633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+3018
-633
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ jobs:
1515
unit-tests:
1616
name: "Unit Tests"
1717
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
ruby: ['3.0', '3.1', '3.2', '3.3']
1821
steps:
19-
- uses: ruby/setup-ruby@v1
20-
with:
21-
ruby-version: '3.0' # Not needed with a .ruby-version file
22-
bundler-cache: true # runs 'bundle install' and caches
23-
2422
# Install Multilib
2523
- name: Install Multilib
2624
run: |
27-
sudo apt-get update --assume-yes
25+
sudo apt-get update -qq
2826
sudo apt-get install --assume-yes --quiet gcc-multilib
2927
3028
# Checks out repository under $GITHUB_WORKSPACE
@@ -33,12 +31,19 @@ jobs:
3331
with:
3432
submodules: recursive
3533

34+
# Setup Ruby Testing Tools to do tests on multiple ruby version
35+
- name: Setup Ruby Testing Tools
36+
uses: ruby/setup-ruby@v1
37+
with:
38+
ruby-version: ${{ matrix.ruby }}
39+
3640
# Install Ruby Testing Tools
3741
- name: Setup Ruby Testing Tools
3842
run: |
39-
sudo gem install bundler
4043
sudo gem install rspec
41-
sudo gem install rubocop -v 0.57.2
44+
sudo gem install rubocop -v 1.57.2
45+
sudo gem install bundler
46+
bundle update
4247
bundle install
4348
4449
# Run Tests

Gemfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
source "http://rubygems.org/"
2-
3-
gem "bundler"
4-
gem "rake"
5-
gem "minitest"
6-
gem "require_all"
7-
gem "constructor"
8-
gem "diy"

LICENSE.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy
46
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
CMock ![CI](https://github.com/ThrowTheSwitch/CMock/workflows/CI/badge.svg)
22
=====
3+
34
CMock is a mock and stub generator and runtime for unit testing C. It's been designed
45
to work smoothly with Unity Test, another of the embedded-software testing tools
56
developed by ThrowTheSwitch.org. CMock automagically parses your C headers and creates
@@ -8,30 +9,45 @@ useful and usable mock interfaces for unit testing. Give it a try!
89
If you don't care to manage unit testing builds yourself, consider checking out Ceedling,
910
a test-centered build manager for unit testing C code.
1011

12+
- [Known Issues](docs/CMockKnownIssues.md)
13+
- [Change Log](docs/CMockChangeLog.md)
14+
1115
Getting Started
12-
================
16+
===============
17+
18+
Your first step is to get yourself a copy of CMock. There are a number of ways to do this:
1319

14-
If you're using Ceedling, there is no need to install CMock. It will handle it for you.
15-
For everyone else, the simplest way is to grab it off github. You can also download it
16-
as a zip if you prefer. The Github method looks something like this:
20+
1. If you're using Ceedling, there is no need to install CMock. It will handle it for you.
21+
22+
2. The simplest way is to grab it off github. The Github method looks something like this:
1723

1824
> git clone --recursive https://github.com/throwtheswitch/cmock.git
19-
> cd cmock
20-
> bundle install # Ensures you have all RubyGems needed
25+
26+
3. You can also grab the `zip` file from github. If you do this, you'll also need to grab yourself a
27+
copy of Unity and CException, because github unfortunately doesn't bake dependencies into the zip
28+
files.
29+
30+
Contributing to this Project
31+
============================
2132

2233
If you plan to help with the development of CMock (or just want to verify that it can
23-
perform its self tests on your system) then you can enter the test directory and then
24-
ask it to test:
34+
perform its self tests on your system) then you can grab its self-testing dependencies,
35+
then run its self-tests:
2536

37+
> cd cmock
38+
> bundle install # Ensures you have all RubyGems needed
2639
> cd test
27-
> rake # Run all CMock self tests
40+
> rake # Run all CMock self tests
41+
42+
Before working on this project, you're going to want to read our guidelines on
43+
[contributing](docs/CONTRIBUTING.md).
2844

2945
API Documentation
3046
=================
3147

3248
* Not sure what you're doing?
3349
* [View docs/CMock_Summary.md](docs/CMock_Summary.md)
34-
* Interested in our MIT-style license?
50+
* Interested in our MIT license?
3551
* [View docs/license.txt](LICENSE.txt)
3652
* Are there examples?
3753
* They are all in [/examples](examples/)

cmock.gemspec

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- encoding: utf-8 -*-
2+
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
3+
require "lib/cmock_version"
4+
require 'date'
5+
6+
Gem::Specification.new do |s|
7+
s.name = "cmock"
8+
s.version = CMockVersion::GEM
9+
s.platform = Gem::Platform::RUBY
10+
s.authors = ["Mark VanderVoord", "Michael Karlesky", "Greg Williams"]
11+
12+
s.homepage = "http://throwtheswitch.org/cmock"
13+
s.summary = "CMock is a mocking framework for C unit testing. It's a member of the ThrowTheSwitch.org family of tools."
14+
s.description = <<-DESC
15+
CMock is a mocking framework for C unit testing. It accepts header files and generates mocks automagically for you.
16+
DESC
17+
s.licenses = ['MIT']
18+
19+
s.metadata = {
20+
"homepage_uri" => s.homepage,
21+
"bug_tracker_uri" => "https://github.com/ThrowTheSwitch/CMock/issues",
22+
"documentation_uri" => "https://github.com/ThrowTheSwitch/CMock/blob/master/docs/CMock_Summary.md",
23+
"mailing_list_uri" => "https://groups.google.com/forum/#!categories/throwtheswitch/cmock",
24+
"source_code_uri" => "https://github.com/ThrowTheSwitch/CMock"
25+
}
26+
27+
s.required_ruby_version = ">= 3.0.0"
28+
29+
s.files += Dir['**/*']
30+
s.test_files = Dir['test/**/*']
31+
s.executables = ['lib/cmock.rb']
32+
33+
s.require_paths = ["lib"]
34+
end

config/production_environment.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# ==========================================
2-
# CMock Project - Automatic Mock Generation for C
3-
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4-
# [Released under MIT License. Please refer to license.txt for details]
5-
# ==========================================
1+
# =========================================================================
2+
# CMock - Automatic Mock Generation for C
3+
# ThrowTheSwitch.org
4+
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
5+
# SPDX-License-Identifier: MIT
6+
# =========================================================================
67

78
# Setup our load path:
89
[
910
'lib'
1011
].each do |dir|
11-
$:.unshift(File.join(__dir__ + '/../', dir))
12+
$:.unshift(File.join("#{__dir__}//..//", dir))
1213
end

config/test_environment.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# ==========================================
2-
# CMock Project - Automatic Mock Generation for C
3-
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4-
# [Released under MIT License. Please refer to license.txt for details]
5-
# ==========================================
1+
# =========================================================================
2+
# CMock - Automatic Mock Generation for C
3+
# ThrowTheSwitch.org
4+
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
5+
# SPDX-License-Identifier: MIT
6+
# =========================================================================
67

78
# Setup our load path:
89
[
@@ -12,5 +13,5 @@
1213
'./vendor/unity/auto/',
1314
'./test/system/'
1415
].each do |dir|
15-
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__) + '/../'), dir))
16+
$:.unshift(File.join(File.expand_path("#{File.dirname(__FILE__)}//..//"), dir))
1617
end

docs/CMockChangeLog.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# CMock - Change Log
2+
3+
## A Note
4+
5+
This document captures significant features and fixes to the CMock project core source files
6+
and scripts. More detail can be found in the history on Github.
7+
8+
This project is now tracking changes in more detail. Previous releases get less detailed as
9+
we move back in histroy.
10+
11+
Prior to 2012, the project was hosted on SourceForge.net
12+
Prior to 2008, the project was an internal project and not released to the public.
13+
14+
## Log
15+
16+
### CMock 2.6.0 (January 2025)
17+
18+
New Features:
19+
20+
- Reintroduced option to run CMock without setjmp (slightly limited)
21+
- Significant speed improvements to parsing
22+
23+
Significant Bugfixes:
24+
25+
- Make return-thru-pointer calls const
26+
- Fix handling of static inlines
27+
- Fix some situations where parenthetical statements were misinterpreted as functions
28+
- Fix error in skeleton creation
29+
- Improvements towards making generated code fully C-compliant and warning free
30+
31+
Other:
32+
33+
- Improve error message wording where possible
34+
- Improve documentation
35+
- Updated to Ruby 3.0 - 3.3
36+
- Reintroduce matrix testing across multiple Ruby versions
37+
38+
### CMock 2.5.3 (January 2021)
39+
40+
New Features:
41+
42+
- Support mocks in sub-folders
43+
- Improved handling of static and inline functions
44+
- Stateless Ignore plugin added
45+
46+
Significant Bugfixes:
47+
48+
- Allow setting values to empty at command prompt
49+
- Improvements towards making generated code fully C-compliant and warning free
50+
51+
Other:
52+
53+
- Really basic mocking of cpp files (like C files with extern C)
54+
55+
### CMock 2.5.2 (May 2020)
56+
57+
Significant Bugfixes:
58+
59+
- Fix whitespace errors
60+
- Fix Stop Ignore
61+
62+
### CMock 2.5.1 (April 2020)
63+
64+
New Features:
65+
66+
- Add StopIgnore function to Ignore Plugin
67+
- Add ability to generate skeleton from a header.
68+
- Inline functions now have option to remove and mock (with Ceedling's help)
69+
70+
Significant Bugfixes:
71+
72+
- Convert internal handling of bools to chars from ints for memory savings
73+
- Convert CMOCK_MEM_INDEX_TYPE default type to size_t
74+
- Switch to old-school comments for supporting old C compilers
75+
- Significant improvements to handling array length expressions
76+
- Significant improvements to our "C parser"
77+
- Added brace-pair counting to improve parsing
78+
- Fixed error when `:unity_helper_path` is relative
79+
80+
Other:
81+
82+
- Improve documentation
83+
- Optimize speed for pass case, particularly in `_verify()` functions
84+
- Increased depth of unit and system tests
85+
86+
### CMock 2.5.0 (October 2019)
87+
88+
New Features:
89+
90+
- New memory bounds checking.
91+
- New memory alignment algorithm.
92+
- Add `ExpectAnyArgs` plugin
93+
- Divided `CVallback` from `Stub` functionality so we can do both.
94+
- Improved wording of failure messages.
95+
- Added `:treat_as_array` configuration option
96+
97+
Significant Bugfixes:
98+
99+
- Fixed bug where `CMock_Guts_MemBytesUsed()` didn't always return `0` before usage
100+
- Fixed bug which sometimes got `CMOCK_MEM_ALIGN` wrong
101+
- Fixed bug where `ExpectAnyArgs` was generated for functions without args.
102+
- Better handling of function pointers
103+
104+
Other:
105+
106+
- `void*` now tested as bytewise array comparison.
107+
- Documentation fixes, particularly to examples.
108+
- Added `resetTest` to documentation
109+
- New handling of messaging to greatly reduce memory footprint
110+
111+
### CMock 2.4.6 (November 2017)
112+
113+
Significant Bugfixes:
114+
115+
- Fixed critical bug when running dynamic memory.
116+
117+
### CMock 2.4.5 (September 2017)
118+
119+
New Features:
120+
121+
- Simple threading of mocks introduced.
122+
123+
Significant Bugfixes:
124+
125+
- Improvements to handling pointer const arguments.
126+
- Treat `char*` separately from an array of bytes.
127+
- Fixed handling of string arguments.
128+
- Preserve `const` in all arguments.
129+
- Fixed race condition when `require`ing plugins
130+
131+
Other:
132+
133+
- Expand docs on `strict_mock_calling`
134+
135+
### CMock 2.4.4 (April 2017)
136+
137+
New Features:
138+
139+
- Add `INCLUDE_PATH` option for specifying source
140+
141+
Significant Bugfixes:
142+
143+
- Parsing improvements related to braces, brackets, and parenthesis
144+
- `ReturnThruPtr` checks destination not null before copying data.
145+
- Stub overrides Ignore
146+
- Improvements to guessing memory alignment based on datatypes
147+
148+
Other:
149+
150+
- Reorganize testing into subdirectory to not clutter for new users
151+
- Docs switching to markdown from pdf
152+
153+
### CMock 2.4.3 (October 2016)
154+
155+
New Features:
156+
157+
- Support multiple helper header files.
158+
- Add ability to use `weak` symbols if compiler supports it
159+
- Add mock suffix option in addition to mock prefix.
160+
161+
Significant Bugfixes:
162+
163+
- Improved UNICODE support
164+
165+
166+

docs/CMockKnownIssues.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# CMock - Known Issues
2+
3+
## A Note
4+
5+
This project will do its best to keep track of significant bugs that might effect your usage of this
6+
project and its supporting scripts. A more detailed and up-to-date list for cutting edge CMock can
7+
be found on our Github repository.
8+
9+
## Issues
10+
11+
- Able to parse most C header files without preprocessor needs, but when handling headers with significant preprocessor usage (#ifdefs, etc), it can get confused
12+
- Multi-dimensional arrays currently simplified to single dimensional arrays of the full size
13+
- Incomplete support for VarArgs

0 commit comments

Comments
 (0)