Skip to content

Commit

Permalink
Updated to latest version of Unity.
Browse files Browse the repository at this point in the history
Removed -Wno-duplicate-decl-specifier flag from all YAML files, since unsupported in some versions of gcc. Reimplemented ignore in specific files and generated code using a pragmas instead, which are setup to ignore undefined pragma values.
Added initial .travis.yml file for TravisCI builds.
  • Loading branch information
barneywilliams committed Jul 25, 2014
1 parent f597ba9 commit be7be41
Show file tree
Hide file tree
Showing 16 changed files with 266 additions and 99 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test/system/build
test/system/generated
*.sublime-project
Gemfile.lock
Gemfile.lock
.rake_t_cache
.DS_Store
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "vendor/unity"]
path = vendor/unity
url = git://github.com/ThrowTheSwitch/Unity.git
url = https://github.com/throwtheswitch/unity.git
branch = master
[submodule "vendor/c_exception"]
path = vendor/c_exception
url = git://github.com/ThrowTheSwitch/CException.git
url = https://github.com/throwtheswitch/cexception.git
branch = master
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: ruby
rvm:
- "1.9.3"
- "2.0.0"
install:
- bundle install
script:
- bundle exec ci
25 changes: 20 additions & 5 deletions README
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
Welcome to CMock.
Welcome to CMock!

![](http://travis-ci.org/atomicobject/kinetic-c.png?branch=master)

[CMock build status](http://travis-ci.org/throwtheswitch/kinetic-c) is provided via [Travis CI](http://travis-ci.org)

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

> git clone --recursive https://github.com/throwtheswitch/cmock.git
> cd cmock
> bundle install # Ensures you have all RubyGems needed
> bundle execute rake # Run all CMock library tests

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

* Not sure what you're doing?
** The docs are in /docs
** [View docs/CMock_Summary.md](docs/CMock_Summary.md)
* Interested in our MIT-style license?
** That's in /docs too
** [View docs/license.txt](docs/license.txt)
* Are there examples?
** Try /examples
** They are all in [/examples](examples/)
* Any other resources to check out?
** Sure. How about ThrowTheSwitch.org
** Definitely! Check out our developer portal on [ThrowTheSwitch.org](http://throwtheswitch.org)
112 changes: 112 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# ==============================================================================
# CMock Project - Automatic Mock Generation for C
# Copyright (c) 2007-2014 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==============================================================================

require './config/test_environment'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require './rakefile_helper'

require 'rspec/core/rake_task'

include RakefileHelpers

DEFAULT_CONFIG_FILE = 'gcc.yml'
CMOCK_ROOT = File.expand_path(File.dirname(__FILE__))

SYSTEM_TEST_SUPPORT_DIRS = [
File.join(CMOCK_ROOT, 'test/system/generated'),
File.join(CMOCK_ROOT, 'test/system/build')
]

SYSTEM_TEST_SUPPORT_DIRS.each do |dir|
p dir
directory(dir)
CLOBBER.include(dir)
end


task :prep_system_tests => SYSTEM_TEST_SUPPORT_DIRS

configure_clean
configure_toolchain(DEFAULT_CONFIG_FILE)

task :default => ['test:all']
task :ci => [:no_color, :default]
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])
end

namespace :test do
desc "Run all unit and system tests"
task :all => [:clobber, :prep_system_tests, 'test:units', 'test:c', 'test:system']

desc "Run Unit Tests"
Rake::TestTask.new('units') do |t|
t.pattern = 'test/unit/*_test.rb'
t.verbose = true
end

#individual unit tests
FileList['test/unit/*_test.rb'].each do |test|
Rake::TestTask.new(File.basename(test,'.*')) do |t|
t.pattern = test
t.verbose = true
end
end

desc "Run C Unit Tests"
task :c => [:prep_system_tests] do
build_and_test_c_files
end

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| 'test/system/test_interactions/'+a+'.yml'}
sys_tests_to_run = FileList['test/system/test_interactions/*.yml'] - sys_unsupported
compile_unsupported = $cfg['unsupported'].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..."
sys_unsupported.each {|a| report a}
compile_unsupported.each {|a| report a}
end
report "\nRunning system tests..."
tests_failed = run_system_test_interactions(sys_tests_to_run)
raise "System tests failed." if (tests_failed > 0)

run_system_test_compilations(compile_tests_to_run)
end

#individual system tests
FileList['test/system/test_interactions/*.yml'].each do |test|
desc "Run system test #{File.basename(test,'.*')}"
task "test:#{File.basename(test,'.*')}" do
run_system_test_interactions([test])
end
end

desc "Profile Mock Generation"
task :profile => [:clobber, :prep_system_tests] do
run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'])
end
end

task :no_color do
$colour_output = false
end

RSpec::Core::RakeTask.new(:spec) do |t|
spec_path = File.join(CMOCK_ROOT, 'test/spec')
t.pattern = spec_path + '/*_spec.rb'
end

4 changes: 4 additions & 0 deletions lib/cmock_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def create_mock_header_header(file, filename)
plugin_includes = @plugins.run(:include_files)
file << plugin_includes if (!plugin_includes.empty?)
file << "\n"
file << "/* Ignore the following warnings, since we are copying code */\n"
file << "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n"
file << "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n"
file << "\n"
end

def create_typedefs(file, typedefs)
Expand Down
21 changes: 10 additions & 11 deletions rakefile.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ==========================================
# ==============================================================================
# CMock Project - Automatic Mock Generation for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# Copyright (c) 2007-2014 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# ==============================================================================

require './config/test_environment'
require 'rake'
Expand All @@ -23,7 +23,6 @@
]

SYSTEM_TEST_SUPPORT_DIRS.each do |dir|
p dir
directory(dir)
CLOBBER.include(dir)
end
Expand Down Expand Up @@ -53,20 +52,20 @@
t.pattern = 'test/unit/*_test.rb'
t.verbose = true
end

#individual unit tests
FileList['test/unit/*_test.rb'].each do |test|
Rake::TestTask.new(File.basename(test,'.*')) do |t|
t.pattern = test
t.verbose = true
end
end

desc "Run C Unit Tests"
task :c => [:prep_system_tests] do
build_and_test_c_files
end

desc "Run System Tests"
task :system => [:clobber, :prep_system_tests] do
#get a list of all system tests, removing unsupported tests for this compiler
Expand All @@ -82,18 +81,18 @@
report "\nRunning system tests..."
tests_failed = run_system_test_interactions(sys_tests_to_run)
raise "System tests failed." if (tests_failed > 0)

run_system_test_compilations(compile_tests_to_run)
end

#individual system tests
FileList['test/system/test_interactions/*.yml'].each do |test|
desc "Run system test #{File.basename(test,'.*')}"
task "test:#{File.basename(test,'.*')}" do
run_system_test_interactions([test])
end
end

desc "Profile Mock Generation"
task :profile => [:clobber, :prep_system_tests] do
run_system_test_profiles(FileList[SYSTEST_COMPILE_MOCKABLES_PATH + '*.h'])
Expand All @@ -108,4 +107,4 @@
spec_path = File.join(CMOCK_ROOT, 'test/spec')
t.pattern = spec_path + '/*_spec.rb'
end
1 change: 0 additions & 1 deletion targets/clang_strict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ compiler:
- '-Wwrite-strings'
- '-Wbad-function-cast'
- '-Wno-missing-prototypes' #we've been lazy about things like setUp and tearDown
- '-Wno-duplicate-decl-specifier' #allows us to test things like "const char const *""
- '-fms-extensions'
- '-fno-omit-frame-pointer'
- '-ffloat-store'
Expand Down
1 change: 0 additions & 1 deletion targets/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ compiler:
- '-Wall'
- '-Wextra'
- '-Wunused-parameter'
- '-Wno-duplicate-decl-specifier'
- '-Wno-address'
- '-std=c99'
- '-pedantic'
Expand Down
1 change: 0 additions & 1 deletion targets/gcc_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ compiler:
- '-m64'
- '-Wall'
- '-Wunused-parameter'
- '-Wno-duplicate-decl-specifier'
- '-Wno-address'
- '-std=c99'
- '-pedantic'
Expand Down
Loading

0 comments on commit be7be41

Please sign in to comment.