Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMock 2.6 Release Candidate #425

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cde38e4
test against all valid rubies
mvandervoord Feb 6, 2023
0b28344
bump version
mvandervoord Feb 6, 2023
69258f7
Tweaks to self-test action script and bump version info
mvandervoord Feb 6, 2023
bbfaf04
Handle yaml.load in a way that is ruby version agnostic.
mvandervoord Feb 6, 2023
e4ba3be
newer rubies are confused about the first array argument to some func…
mvandervoord Feb 7, 2023
6cf8fb9
Fix to incorrect handling of static inlines.
mvandervoord Nov 14, 2023
161d58b
Merge branch 'master' into cmock_2_6_rc
mvandervoord Nov 14, 2023
097b3ec
Let's see how we're doing if we only run on Ruby 3.x
mvandervoord Nov 22, 2023
3204939
Fixes to the temp_sensor example.
mvandervoord Nov 22, 2023
a642b1f
Update to latest Unity and therefore newer Rubocop standards. Tweaked…
mvandervoord Nov 22, 2023
4f73b40
Bump to the latest rubocop
mvandervoord Nov 23, 2023
b032cfa
Merge branch 'master' into cmock_2_6_rc
mvandervoord Nov 23, 2023
c2e3c74
Fix test for const feature of return-thru-pointer
mvandervoord Nov 23, 2023
95d29ee
Add part of our new "standard" documentation for status! woo!
mvandervoord Nov 23, 2023
cac4907
Add Argument Validation documentation, because it's a common question.
mvandervoord Nov 29, 2023
083bbd6
Add to verbosity of failures to find prototypes in headers.
mvandervoord Feb 21, 2024
3232b72
fixed wrong quote usage.
mvandervoord Feb 21, 2024
dddd01d
copied change from pr 468
mvandervoord Mar 10, 2024
4fb4fba
Jump to next release of unity and cexception.
mvandervoord Mar 10, 2024
7925641
:memo: Add Code of Conduct and Contributing docs
mvandervoord Mar 13, 2024
07a0e25
:beetle: Added fail messages when using Expect for ExpectAndReturn or…
mvandervoord Mar 14, 2024
0240b4a
:arrow_up: Updated Unity and CException to latest versions.
mvandervoord Mar 14, 2024
3a6f1f2
:beetle: Fixed issue where `-oblah.yml` isn't parsed by powershell.
mvandervoord Mar 20, 2024
597a6d8
Finish giving clues when you've chosen the wrong AndReturn version.
mvandervoord Mar 21, 2024
001bbec
:beetle: `:fail_on_unexpected_calls` options now insists on required …
mvandervoord Mar 23, 2024
714619e
:beetle: protect against bad filenames with multiple `.c` instances i…
mvandervoord Mar 23, 2024
ecaccb4
:beetle: remove unused AbortFrame (#316)
mvandervoord Mar 27, 2024
93e2f52
Update example project to handle pointers of different sizes and not …
mvandervoord Apr 2, 2024
9cc8fb5
Let's enable validation of examples. failures should trip errors.
mvandervoord Apr 2, 2024
df73448
Remove some stuff that shouldn't really be in config file.
mvandervoord Apr 2, 2024
119f660
Don't need to escape symbols in brackets
mvandervoord Apr 2, 2024
c83f8bd
Working towards gemifying and automatically reporting version.
mvandervoord Aug 1, 2024
6b0587f
Fixes to latest stylistic warnings.
mvandervoord Aug 1, 2024
74b8ed2
Bump dependencies
mvandervoord Aug 1, 2024
43618c8
:bug: Fix problem if unity helper path is specified as relative path …
mvandervoord Oct 3, 2024
7d6ec03
If a short-path cannot be created, fallback to absolute path, even th…
mvandervoord Oct 23, 2024
d5e938e
- refactor to match coding standards.
mvandervoord Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ jobs:
unit-tests:
name: "Unit Tests"
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches

# Install Multilib
- name: Install Multilib
run: |
sudo apt-get update --assume-yes
sudo apt-get update -qq
sudo apt-get install --assume-yes --quiet gcc-multilib

# Checks out repository under $GITHUB_WORKSPACE
Expand All @@ -33,12 +31,19 @@ jobs:
with:
submodules: recursive

# Setup Ruby Testing Tools to do tests on multiple ruby version
- name: Setup Ruby Testing Tools
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

# Install Ruby Testing Tools
- name: Setup Ruby Testing Tools
run: |
sudo gem install bundler
sudo gem install rspec
sudo gem install rubocop -v 0.57.2
sudo gem install rubocop -v 1.57.2
sudo gem install bundler
bundle update
bundle install

# Run Tests
Expand Down
7 changes: 0 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
source "http://rubygems.org/"

gem "bundler"
gem "rake"
gem "minitest"
gem "require_all"
gem "constructor"
gem "diy"
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, Greg Williams

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CMock ![CI](https://github.com/ThrowTheSwitch/CMock/workflows/CI/badge.svg)
=====

CMock is a mock and stub generator and runtime for unit testing C. It's been designed
to work smoothly with Unity Test, another of the embedded-software testing tools
developed by ThrowTheSwitch.org. CMock automagically parses your C headers and creates
Expand All @@ -8,30 +9,45 @@ useful and usable mock interfaces for unit testing. Give it a try!
If you don't care to manage unit testing builds yourself, consider checking out Ceedling,
a test-centered build manager for unit testing C code.

- [Known Issues](docs/CMockKnownIssues.md)
- [Change Log](docs/CMockChangeLog.md)

Getting Started
================
===============

Your first step is to get yourself a copy of CMock. There are a number of ways to do this:

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

2. The simplest way is to grab it off github. The Github method looks something like this:

> git clone --recursive https://github.com/throwtheswitch/cmock.git
> cd cmock
> bundle install # Ensures you have all RubyGems needed

3. You can also grab the `zip` file from github. If you do this, you'll also need to grab yourself a
copy of Unity and CException, because github unfortunately doesn't bake dependencies into the zip
files.

Contributing to this Project
============================

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

> cd cmock
> bundle install # Ensures you have all RubyGems needed
> cd test
> rake # Run all CMock self tests
> rake # Run all CMock self tests

Before working on this project, you're going to want to read our guidelines on
[contributing](docs/CONTRIBUTING.md).

API Documentation
=================

* Not sure what you're doing?
* [View docs/CMock_Summary.md](docs/CMock_Summary.md)
* Interested in our MIT-style license?
* Interested in our MIT license?
* [View docs/license.txt](LICENSE.txt)
* Are there examples?
* They are all in [/examples](examples/)
Expand Down
34 changes: 34 additions & 0 deletions cmock.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
require "lib/cmock_version"
require 'date'

Gem::Specification.new do |s|
s.name = "cmock"
s.version = CMockVersion::GEM
s.platform = Gem::Platform::RUBY
s.authors = ["Mark VanderVoord", "Michael Karlesky", "Greg Williams"]
s.email = ["mark@vandervoord.net", "michael@karlesky.net", "barney.williams@gmail.com"]
s.homepage = "http://throwtheswitch.org/cmock"
s.summary = "CMock is a mocking framework for C unit testing. It's a member of the ThrowTheSwitch.org family of tools."
s.description = <<-DESC
CMock is a mocking framework for C unit testing. It accepts header files and generates mocks automagically for you.
DESC
s.licenses = ['MIT']

s.metadata = {
"homepage_uri" => s.homepage,
"bug_tracker_uri" => "https://github.com/ThrowTheSwitch/CMock/issues",
"documentation_uri" => "https://github.com/ThrowTheSwitch/CMock/blob/master/docs/CMock_Summary.md",
"mailing_list_uri" => "https://groups.google.com/forum/#!categories/throwtheswitch/cmock",
"source_code_uri" => "https://github.com/ThrowTheSwitch/CMock"
}

s.required_ruby_version = ">= 3.0.0"

s.files += Dir['**/*']
s.test_files = Dir['test/**/*']
s.executables = ['lib/cmock.rb']

s.require_paths = ["lib"]
end
2 changes: 1 addition & 1 deletion config/production_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
[
'lib'
].each do |dir|
$:.unshift(File.join(__dir__ + '/../', dir))
$:.unshift(File.join("#{__dir__}//..//", dir))
end
2 changes: 1 addition & 1 deletion config/test_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
'./vendor/unity/auto/',
'./test/system/'
].each do |dir|
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__) + '/../'), dir))
$:.unshift(File.join(File.expand_path("#{File.dirname(__FILE__)}//..//"), dir))
end
166 changes: 166 additions & 0 deletions docs/CMockChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# CMock - Change Log

## A Note

This document captures significant features and fixes to the CMock project core source files
and scripts. More detail can be found in the history on Github.

This project is now tracking changes in more detail. Previous releases get less detailed as
we move back in histroy.

Prior to 2012, the project was hosted on SourceForge.net
Prior to 2008, the project was an internal project and not released to the public.

## Log

### CMock 2.6.0 ()

New Features:

- Reintroduced option to run CMock without setjmp (slightly limited)
- Significant speed improvements to parsing

Significant Bugfixes:

- Make return-thru-pointer calls const
- Fix handling of static inlines
- Fix some situations where parenthetical statements were misinterpreted as functions
- Fix error in skeleton creation
- Improvements towards making generated code fully C-compliant and warning free

Other:

- Improve error message wording where possible
- Improve documentation
- Updated to Ruby 3.0 - 3.3
- Reintroduce matrix testing across multiple Ruby versions

### CMock 2.5.3 (January 2021)

New Features:

- Support mocks in sub-folders
- Improved handling of static and inline functions
- Stateless Ignore plugin added

Significant Bugfixes:

- Allow setting values to empty at command prompt
- Improvements towards making generated code fully C-compliant and warning free

Other:

- Really basic mocking of cpp files (like C files with extern C)

### CMock 2.5.2 (May 2020)

Significant Bugfixes:

- Fix whitespace errors
- Fix Stop Ignore

### CMock 2.5.1 (April 2020)

New Features:

- Add StopIgnore function to Ignore Plugin
- Add ability to generate skeleton from a header.
- Inline functions now have option to remove and mock (with Ceedling's help)

Significant Bugfixes:

- Convert internal handling of bools to chars from ints for memory savings
- Convert CMOCK_MEM_INDEX_TYPE default type to size_t
- Switch to old-school comments for supporting old C compilers
- Significant improvements to handling array length expressions
- Significant improvements to our "C parser"
- Added brace-pair counting to improve parsing
- Fixed error when `:unity_helper_path` is relative

Other:

- Improve documentation
- Optimize speed for pass case, particularly in `_verify()` functions
- Increased depth of unit and system tests

### CMock 2.5.0 (October 2019)

New Features:

- New memory bounds checking.
- New memory alignment algorithm.
- Add `ExpectAnyArgs` plugin
- Divided `CVallback` from `Stub` functionality so we can do both.
- Improved wording of failure messages.
- Added `:treat_as_array` configuration option

Significant Bugfixes:

- Fixed bug where `CMock_Guts_MemBytesUsed()` didn't always return `0` before usage
- Fixed bug which sometimes got `CMOCK_MEM_ALIGN` wrong
- Fixed bug where `ExpectAnyArgs` was generated for functions without args.
- Better handling of function pointers

Other:

- `void*` now tested as bytewise array comparison.
- Documentation fixes, particularly to examples.
- Added `resetTest` to documentation
- New handling of messaging to greatly reduce memory footprint

### CMock 2.4.6 (November 2017)

Significant Bugfixes:

- Fixed critical bug when running dynamic memory.

### CMock 2.4.5 (September 2017)

New Features:

- Simple threading of mocks introduced.

Significant Bugfixes:

- Improvements to handling pointer const arguments.
- Treat `char*` separately from an array of bytes.
- Fixed handling of string arguments.
- Preserve `const` in all arguments.
- Fixed race condition when `require`ing plugins

Other:

- Expand docs on `strict_mock_calling`

### CMock 2.4.4 (April 2017)

New Features:

- Add `INCLUDE_PATH` option for specifying source

Significant Bugfixes:

- Parsing improvements related to braces, brackets, and parenthesis
- `ReturnThruPtr` checks destination not null before copying data.
- Stub overrides Ignore
- Improvements to guessing memory alignment based on datatypes

Other:

- Reorganize testing into subdirectory to not clutter for new users
- Docs switching to markdown from pdf

### CMock 2.4.3 (October 2016)

New Features:

- Support multiple helper header files.
- Add ability to use `weak` symbols if compiler supports it
- Add mock suffix option in addition to mock prefix.

Significant Bugfixes:

- Improved UNICODE support



13 changes: 13 additions & 0 deletions docs/CMockKnownIssues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CMock - Known Issues

## A Note

This project will do its best to keep track of significant bugs that might effect your usage of this
project and its supporting scripts. A more detailed and up-to-date list for cutting edge CMock can
be found on our Github repository.

## Issues

- Able to parse most C header files without preprocessor needs, but when handling headers with significant preprocessor usage (#ifdefs, etc), it can get confused
- Multi-dimensional arrays currently simplified to single dimensional arrays of the full size
- Incomplete support for VarArgs
Loading
Loading