ceedling 0.15.5 → 0.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +13 -9
- data/README.md +4 -0
- data/bin/ceedling +1 -1
- data/ceedling-0.15.5.gem +0 -0
- data/ceedling.gemspec +1 -1
- data/lib/ceedling/configurator_builder.rb +63 -70
- data/lib/ceedling/defaults.rb +12 -9
- data/lib/ceedling/dependinator.rb +4 -12
- data/lib/ceedling/generator.rb +3 -2
- data/lib/ceedling/generator_test_runner.rb +2 -2
- data/lib/ceedling/tasks_base.rake +9 -16
- data/lib/ceedling/version.rb +1 -1
- data/lib/ceedling/version.rb.erb +1 -1
- data/spec/ceedling_spec.rb +27 -27
- data/spec/par_map_spec.rb +8 -8
- data/spec/preprocessinator_extractor_spec.rb +2 -2
- data/spec/preprocessinator_includes_handler_spec.rb +24 -24
- data/spec/spec_helper.rb +3 -3
- data/spec/spec_system_helper.rb +14 -14
- data/spec/system/deployment_spec.rb +9 -9
- data/test_graveyard/unit/busted/configurator_builder_test.rb +68 -70
- data/vendor/unity/auto/generate_test_runner.rb +2 -3
- data/vendor/unity/auto/unity_test_summary.rb +16 -16
- data/vendor/unity/src/unity.c +5 -2
- data/vendor/unity/src/unity_internals.h +10 -7
- data/vendor/unity/test/rakefile_helper.rb +2 -2
- metadata +5 -6
- data/release/build.info +0 -2
- data/release/version.info +0 -1
data/lib/ceedling/defaults.rb
CHANGED
@@ -42,11 +42,8 @@ DEFAULT_TEST_FIXTURE_TOOL = {
|
|
42
42
|
:arguments => [].freeze
|
43
43
|
}
|
44
44
|
|
45
|
-
|
46
|
-
|
47
45
|
DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL = {
|
48
|
-
|
49
|
-
:executable => FilePathUtils.os_executable_ext('gcc').freeze, # OSX clang
|
46
|
+
:executable => FilePathUtils.os_executable_ext('gcc').freeze,
|
50
47
|
:name => 'default_test_includes_preprocessor'.freeze,
|
51
48
|
:stderr_redirect => StdErrRedirect::NONE.freeze,
|
52
49
|
:background_exec => BackgroundExec::NONE.freeze,
|
@@ -62,10 +59,9 @@ DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL = {
|
|
62
59
|
{"-I$" => 'COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE'}.freeze,
|
63
60
|
{"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}.freeze,
|
64
61
|
{"-D$" => 'DEFINES_TEST_PREPROCESS'}.freeze,
|
65
|
-
# "-DGNU_PREPROCESSOR".freeze,
|
66
62
|
"-DGNU_COMPILER".freeze, # OSX clang
|
67
63
|
'-w'.freeze,
|
68
|
-
# '-nostdinc'.freeze,
|
64
|
+
# '-nostdinc'.freeze, # disabled temporarily due to stdio access violations on OSX
|
69
65
|
"\"${1}\"".freeze
|
70
66
|
].freeze
|
71
67
|
}
|
@@ -83,12 +79,19 @@ DEFAULT_TEST_FILE_PREPROCESSOR_TOOL = {
|
|
83
79
|
{"-D$" => 'COLLECTION_DEFINES_TEST_AND_VENDOR'}.freeze,
|
84
80
|
{"-D$" => 'DEFINES_TEST_PREPROCESS'}.freeze,
|
85
81
|
"-DGNU_COMPILER".freeze,
|
86
|
-
# '-nostdinc'.freeze,
|
82
|
+
# '-nostdinc'.freeze, # disabled temporarily due to stdio access violations on OSX
|
87
83
|
"\"${1}\"".freeze,
|
88
84
|
"-o \"${2}\"".freeze
|
89
85
|
].freeze
|
90
86
|
}
|
91
87
|
|
88
|
+
# Disable the -MD flag for OSX LLVM Clang, since unsupported
|
89
|
+
if RUBY_PLATFORM =~ /darwin/ && `gcc --version 2> /dev/null` =~ /Apple LLVM version .* \(clang/m # OSX w/LLVM Clang
|
90
|
+
MD_FLAG = '' # Clang doesn't support the -MD flag
|
91
|
+
else
|
92
|
+
MD_FLAG = '-MD'
|
93
|
+
end
|
94
|
+
|
92
95
|
DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = {
|
93
96
|
:executable => FilePathUtils.os_executable_ext('gcc').freeze,
|
94
97
|
:name => 'default_test_dependencies_generator'.freeze,
|
@@ -104,7 +107,7 @@ DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL = {
|
|
104
107
|
"-DGNU_COMPILER".freeze,
|
105
108
|
"-MT \"${3}\"".freeze,
|
106
109
|
'-MM'.freeze,
|
107
|
-
|
110
|
+
MD_FLAG.freeze,
|
108
111
|
'-MG'.freeze,
|
109
112
|
"-MF \"${2}\"".freeze,
|
110
113
|
"-c \"${1}\"".freeze,
|
@@ -127,7 +130,7 @@ DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL = {
|
|
127
130
|
"-DGNU_COMPILER".freeze,
|
128
131
|
"-MT \"${3}\"".freeze,
|
129
132
|
'-MM'.freeze,
|
130
|
-
|
133
|
+
MD_FLAG.freeze,
|
131
134
|
'-MG'.freeze,
|
132
135
|
"-MF \"${2}\"".freeze,
|
133
136
|
"-c \"${1}\"".freeze,
|
@@ -4,7 +4,7 @@ class Dependinator
|
|
4
4
|
constructor :configurator, :project_config_manager, :test_includes_extractor, :file_path_utils, :rake_wrapper, :file_wrapper
|
5
5
|
|
6
6
|
def touch_force_rebuild_files
|
7
|
-
@file_wrapper.touch( @configurator.project_test_force_rebuild_filepath )
|
7
|
+
@file_wrapper.touch( @configurator.project_test_force_rebuild_filepath )
|
8
8
|
@file_wrapper.touch( @configurator.project_release_force_rebuild_filepath ) if (@configurator.project_release_build)
|
9
9
|
end
|
10
10
|
|
@@ -16,9 +16,8 @@ class Dependinator
|
|
16
16
|
|
17
17
|
|
18
18
|
def enhance_release_file_dependencies(files)
|
19
|
-
files.each do |filepath|
|
19
|
+
files.each do |filepath|
|
20
20
|
@rake_wrapper[filepath].enhance( [@configurator.project_release_force_rebuild_filepath] ) if (@project_config_manager.release_config_changed)
|
21
|
-
@rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -32,14 +31,12 @@ class Dependinator
|
|
32
31
|
|
33
32
|
def enhance_runner_dependencies(runner_filepath)
|
34
33
|
@rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
35
|
-
@rake_wrapper[runner_filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
36
34
|
end
|
37
|
-
|
35
|
+
|
38
36
|
|
39
37
|
def enhance_shallow_include_lists_dependencies(include_lists)
|
40
38
|
include_lists.each do |include_list_filepath|
|
41
39
|
@rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
42
|
-
@rake_wrapper[include_list_filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
@@ -47,7 +44,6 @@ class Dependinator
|
|
47
44
|
def enhance_preprocesed_file_dependencies(files)
|
48
45
|
files.each do |filepath|
|
49
46
|
@rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
50
|
-
@rake_wrapper[filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
51
47
|
end
|
52
48
|
end
|
53
49
|
|
@@ -57,7 +53,6 @@ class Dependinator
|
|
57
53
|
mocks_list.each do |mock_filepath|
|
58
54
|
@rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
59
55
|
@rake_wrapper[mock_filepath].enhance( [@configurator.cmock_unity_helper] ) if (@configurator.cmock_unity_helper)
|
60
|
-
@rake_wrapper[mock_filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
61
56
|
@rake_wrapper[mock_filepath].enhance( [@configurator.cmock_build_info_filepath] )
|
62
57
|
end
|
63
58
|
end
|
@@ -66,7 +61,6 @@ class Dependinator
|
|
66
61
|
def enhance_dependencies_dependencies(dependencies)
|
67
62
|
dependencies.each do |dependencies_filepath|
|
68
63
|
@rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
69
|
-
@rake_wrapper[dependencies_filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
70
64
|
end
|
71
65
|
end
|
72
66
|
|
@@ -74,14 +68,12 @@ class Dependinator
|
|
74
68
|
def enhance_test_build_object_dependencies(objects)
|
75
69
|
objects.each do |object_filepath|
|
76
70
|
@rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
77
|
-
@rake_wrapper[object_filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
78
71
|
end
|
79
72
|
end
|
80
|
-
|
73
|
+
|
81
74
|
|
82
75
|
def enhance_results_dependencies(result_filepath)
|
83
76
|
@rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
84
|
-
@rake_wrapper[result_filepath].enhance( [@configurator.ceedling_build_info_filepath] )
|
85
77
|
end
|
86
78
|
|
87
79
|
|
data/lib/ceedling/generator.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'ceedling/constants'
|
2
2
|
|
3
|
-
|
4
3
|
class Generator
|
5
4
|
|
6
5
|
constructor :configurator,
|
@@ -66,9 +65,11 @@ class Generator
|
|
66
65
|
|
67
66
|
@streaminator.stdout_puts("Generating runner for #{module_name}...", Verbosity::NORMAL)
|
68
67
|
|
68
|
+
test_file_includes = [] # Empty list for now, since apparently unused
|
69
|
+
|
69
70
|
# build runner file
|
70
71
|
begin
|
71
|
-
@generator_test_runner.generate(module_name, runner_filepath, test_cases, mock_list,
|
72
|
+
@generator_test_runner.generate(module_name, runner_filepath, test_cases, mock_list, test_file_includes)
|
72
73
|
rescue
|
73
74
|
raise
|
74
75
|
ensure
|
@@ -52,13 +52,13 @@ class GeneratorTestRunner
|
|
52
52
|
return tests_and_line_numbers
|
53
53
|
end
|
54
54
|
|
55
|
-
def generate(module_name, runner_filepath, test_cases, mock_list,
|
55
|
+
def generate(module_name, runner_filepath, test_cases, mock_list, test_file_includes=[])
|
56
56
|
require 'generate_test_runner.rb'
|
57
57
|
@test_runner_generator ||= UnityTestRunnerGenerator.new( @configurator.get_runner_config )
|
58
58
|
@test_runner_generator.generate( module_name,
|
59
59
|
runner_filepath,
|
60
60
|
test_cases,
|
61
61
|
mock_list,
|
62
|
-
|
62
|
+
test_file_includes)
|
63
63
|
end
|
64
64
|
end
|
@@ -1,38 +1,36 @@
|
|
1
1
|
require 'ceedling/constants'
|
2
2
|
require 'ceedling/file_path_utils'
|
3
|
-
|
3
|
+
require 'ceedling/version'
|
4
4
|
|
5
5
|
desc "Display build environment version info."
|
6
6
|
task :version do
|
7
|
-
|
8
|
-
|
7
|
+
puts " Ceedling:: #{Ceedling::VERSION::Ceedling}"
|
8
|
+
|
9
|
+
[
|
9
10
|
['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)],
|
10
11
|
[' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)],
|
11
12
|
[' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)],
|
12
|
-
|
13
|
-
|
14
|
-
tools.each do |tool|
|
13
|
+
].each do |tool|
|
15
14
|
name = tool[0]
|
16
15
|
base_path = tool[1]
|
17
|
-
|
16
|
+
|
18
17
|
version_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip
|
19
18
|
build_string = @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip
|
20
19
|
puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}"
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
24
|
-
|
25
23
|
desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])."
|
26
24
|
task :verbosity, :level do |t, args|
|
27
25
|
verbosity_level = args.level.to_i
|
28
|
-
|
26
|
+
|
29
27
|
if (PROJECT_USE_MOCKS)
|
30
28
|
# don't store verbosity level in setupinator's config hash, use a copy;
|
31
29
|
# otherwise, the input configuration will change and trigger entire project rebuilds
|
32
30
|
hash = @ceedling[:setupinator].config_hash[:cmock].clone
|
33
31
|
hash[:verbosity] = verbosity_level
|
34
32
|
|
35
|
-
@ceedling[:cmock_builder].manufacture( hash )
|
33
|
+
@ceedling[:cmock_builder].manufacture( hash )
|
36
34
|
end
|
37
35
|
|
38
36
|
@ceedling[:configurator].project_verbosity = verbosity_level
|
@@ -41,13 +39,11 @@ task :verbosity, :level do |t, args|
|
|
41
39
|
verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) )
|
42
40
|
end
|
43
41
|
|
44
|
-
|
45
42
|
desc "Enable logging"
|
46
43
|
task :logging do
|
47
44
|
@ceedling[:configurator].project_logging = true
|
48
45
|
end
|
49
46
|
|
50
|
-
|
51
47
|
# non advertised debug task
|
52
48
|
task :debug do
|
53
49
|
Rake::Task[:verbosity].invoke(Verbosity::DEBUG)
|
@@ -55,14 +51,12 @@ task :debug do
|
|
55
51
|
@ceedling[:configurator].project_debug = true
|
56
52
|
end
|
57
53
|
|
58
|
-
|
59
54
|
# non advertised sanity checking task
|
60
55
|
task :sanity_checks, :level do |t, args|
|
61
56
|
check_level = args.level.to_i
|
62
57
|
@ceedling[:configurator].sanity_checks = check_level
|
63
58
|
end
|
64
59
|
|
65
|
-
|
66
60
|
# list expanded environment variables
|
67
61
|
if (not ENVIRONMENT.empty?)
|
68
62
|
desc "List all configured environment variables."
|
@@ -72,11 +66,10 @@ task :environment do
|
|
72
66
|
name = key.to_s.upcase
|
73
67
|
puts " - #{name}: \"#{env[key]}\""
|
74
68
|
end
|
75
|
-
end
|
69
|
+
end
|
76
70
|
end
|
77
71
|
end
|
78
72
|
|
79
|
-
|
80
73
|
namespace :options do
|
81
74
|
|
82
75
|
COLLECTION_PROJECT_OPTIONS.each do |option_path|
|
data/lib/ceedling/version.rb
CHANGED
data/lib/ceedling/version.rb.erb
CHANGED
data/spec/ceedling_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe 'Ceedling' do
|
|
10
10
|
# execute method
|
11
11
|
location = Ceedling.location
|
12
12
|
# validate results
|
13
|
-
location.
|
13
|
+
expect(location).to eq(ceedling_path)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -23,7 +23,7 @@ describe 'Ceedling' do
|
|
23
23
|
# execute method
|
24
24
|
location = Ceedling.load_path
|
25
25
|
# validate results
|
26
|
-
location.
|
26
|
+
expect(location).to eq(load_path)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -36,7 +36,7 @@ describe 'Ceedling' do
|
|
36
36
|
# execute method
|
37
37
|
location = Ceedling.rakefile
|
38
38
|
# validate results
|
39
|
-
location.
|
39
|
+
expect(location).to eq(rakefile_path)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -47,11 +47,11 @@ describe 'Ceedling' do
|
|
47
47
|
rakefile_path = File.join(File.dirname(__FILE__), '..').gsub('spec','lib')
|
48
48
|
rakefile_path = File.join( rakefile_path, 'lib', 'ceedling', 'rakefile.rb' )
|
49
49
|
# mocks/stubs/expected calls
|
50
|
-
Ceedling.
|
50
|
+
expect(Ceedling).to receive(:load).with(rakefile_path)
|
51
51
|
# execute method
|
52
52
|
Ceedling.load_project
|
53
53
|
# validate results
|
54
|
-
ENV['CEEDLING_MAIN_PROJECT_FILE'].
|
54
|
+
expect(ENV['CEEDLING_MAIN_PROJECT_FILE']).to eq('./project.yml')
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should load the project with the specified yaml file' do
|
@@ -60,11 +60,11 @@ describe 'Ceedling' do
|
|
60
60
|
rakefile_path = File.join(File.dirname(__FILE__), '..').gsub('spec','lib')
|
61
61
|
rakefile_path = File.join( rakefile_path, 'lib', 'ceedling', 'rakefile.rb' )
|
62
62
|
# mocks/stubs/expected calls
|
63
|
-
Ceedling.
|
63
|
+
expect(Ceedling).to receive(:load).with(rakefile_path)
|
64
64
|
# execute method
|
65
65
|
Ceedling.load_project(config: './foo.yml')
|
66
66
|
# validate results
|
67
|
-
ENV['CEEDLING_MAIN_PROJECT_FILE'].
|
67
|
+
expect(ENV['CEEDLING_MAIN_PROJECT_FILE']).to eq('./foo.yml')
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should load the project with the yaml file specified by the existing environment variable' do
|
@@ -73,11 +73,11 @@ describe 'Ceedling' do
|
|
73
73
|
rakefile_path = File.join(File.dirname(__FILE__), '..').gsub('spec','lib')
|
74
74
|
rakefile_path = File.join( rakefile_path, 'lib', 'ceedling', 'rakefile.rb' )
|
75
75
|
# mocks/stubs/expected calls
|
76
|
-
Ceedling.
|
76
|
+
expect(Ceedling).to receive(:load).with(rakefile_path)
|
77
77
|
# execute method
|
78
78
|
Ceedling.load_project
|
79
79
|
# validate results
|
80
|
-
ENV['CEEDLING_MAIN_PROJECT_FILE'].
|
80
|
+
expect(ENV['CEEDLING_MAIN_PROJECT_FILE']).to eq('./bar.yml')
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should load the project with the specified plugins enabled' do
|
@@ -88,15 +88,15 @@ describe 'Ceedling' do
|
|
88
88
|
rakefile_path = File.join(File.dirname(__FILE__), '..').gsub('spec','lib')
|
89
89
|
rakefile_path = File.join( rakefile_path, 'lib', 'ceedling', 'rakefile.rb' )
|
90
90
|
# mocks/stubs/expected calls
|
91
|
-
Gem::Specification.
|
92
|
-
spec_double.
|
93
|
-
Ceedling.
|
94
|
-
Ceedling.
|
91
|
+
expect(Gem::Specification).to receive(:find_by_name).with('ceedling-foo').and_return(spec_double)
|
92
|
+
expect(spec_double).to receive(:gem_dir).and_return('dummy/path')
|
93
|
+
expect(Ceedling).to receive(:require).with('ceedling/defaults')
|
94
|
+
expect(Ceedling).to receive(:load).with(rakefile_path)
|
95
95
|
# execute method
|
96
96
|
Ceedling.load_project( config: './foo.yml',
|
97
97
|
plugins: ['foo'])
|
98
98
|
# validate results
|
99
|
-
ENV['CEEDLING_MAIN_PROJECT_FILE'].
|
99
|
+
expect(ENV['CEEDLING_MAIN_PROJECT_FILE']).to eq('./foo.yml')
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'should set the project root if the root key is provided' do
|
@@ -107,13 +107,13 @@ describe 'Ceedling' do
|
|
107
107
|
rakefile_path = File.join(File.dirname(__FILE__), '..').gsub('spec','lib')
|
108
108
|
rakefile_path = File.join( rakefile_path, 'lib', 'ceedling', 'rakefile.rb' )
|
109
109
|
# mocks/stubs/expected calls
|
110
|
-
Ceedling.
|
110
|
+
expect(Ceedling).to receive(:load).with(rakefile_path)
|
111
111
|
# execute method
|
112
112
|
Ceedling.load_project( config: './foo.yml',
|
113
113
|
root: './')
|
114
114
|
# validate results
|
115
|
-
ENV['CEEDLING_MAIN_PROJECT_FILE'].
|
116
|
-
PROJECT_ROOT.
|
115
|
+
expect(ENV['CEEDLING_MAIN_PROJECT_FILE']).to eq('./foo.yml')
|
116
|
+
expect(PROJECT_ROOT).to eq('./')
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -124,14 +124,14 @@ describe 'Ceedling' do
|
|
124
124
|
DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths].clear()
|
125
125
|
spec_double = double('spec-double')
|
126
126
|
# mocks/stubs/expected calls
|
127
|
-
Gem::Specification.
|
128
|
-
spec_double.
|
129
|
-
Ceedling.
|
127
|
+
expect(Gem::Specification).to receive(:find_by_name).with('ceedling-foo').and_return(spec_double)
|
128
|
+
expect(spec_double).to receive(:gem_dir).and_return('dummy/path')
|
129
|
+
expect(Ceedling).to receive(:require).with('ceedling/defaults')
|
130
130
|
# execute method
|
131
131
|
Ceedling.register_plugin('foo')
|
132
132
|
# validate results
|
133
|
-
DEFAULT_CEEDLING_CONFIG[:plugins][:enabled].
|
134
|
-
DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths].
|
133
|
+
expect(DEFAULT_CEEDLING_CONFIG[:plugins][:enabled]).to eq ["foo"]
|
134
|
+
expect(DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths]).to eq(["dummy/path"])
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'should register a plugin with an alternative prefix' do
|
@@ -140,14 +140,14 @@ describe 'Ceedling' do
|
|
140
140
|
DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths].clear()
|
141
141
|
spec_double = double('spec-double')
|
142
142
|
# mocks/stubs/expected calls
|
143
|
-
Gem::Specification.
|
144
|
-
spec_double.
|
145
|
-
Ceedling.
|
143
|
+
expect(Gem::Specification).to receive(:find_by_name).with('prefix-foo').and_return(spec_double)
|
144
|
+
expect(spec_double).to receive(:gem_dir).and_return('dummy/path')
|
145
|
+
expect(Ceedling).to receive(:require).with('ceedling/defaults')
|
146
146
|
# execute method
|
147
147
|
Ceedling.register_plugin('foo','prefix-')
|
148
148
|
# validate results
|
149
|
-
DEFAULT_CEEDLING_CONFIG[:plugins][:enabled].
|
150
|
-
DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths].
|
149
|
+
expect(DEFAULT_CEEDLING_CONFIG[:plugins][:enabled]).to eq(["foo"])
|
150
|
+
expect(DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths]).to eq(["dummy/path"])
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
data/spec/par_map_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'ceedling/par_map'
|
2
2
|
|
3
|
-
def short_task_should(n)
|
3
|
+
def short_task_should(n)
|
4
4
|
done_count = 0
|
5
5
|
par_map(n, [0.01] * (n - 1) + [0] * 10) do |seconds|
|
6
6
|
sleep(seconds)
|
@@ -18,14 +18,14 @@ describe "par_map" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should run shorter tasks while larger tasks are blocking (with 3 threads)" do
|
21
|
-
short_task_should(3)
|
21
|
+
short_task_should(3)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should run shorter tasks while larger tasks are blocking (with 4 threads)" do
|
25
25
|
short_task_should(4)
|
26
|
-
end
|
26
|
+
end
|
27
27
|
|
28
|
-
#the following two tests are still slightly nondeterministic and may occasionally
|
28
|
+
#the following two tests are still slightly nondeterministic and may occasionally
|
29
29
|
# show false positives (though we think we've gotten it pretty stable)
|
30
30
|
it "should collide if multiple threads are used" do
|
31
31
|
is_running = false
|
@@ -40,18 +40,18 @@ describe "par_map" do
|
|
40
40
|
sleep(0.01 * x)
|
41
41
|
is_running = false
|
42
42
|
end
|
43
|
-
collision.
|
43
|
+
expect(collision).to eq true
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should be serial if only one thread is used" do
|
47
47
|
is_running = false
|
48
48
|
par_map(1, (1..5).to_a) do |x|
|
49
|
-
is_running.
|
49
|
+
expect(is_running).to eq false
|
50
50
|
is_running = true
|
51
51
|
sleep(0.01 * x)
|
52
52
|
is_running = false
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
end
|
56
|
+
|
57
|
+
end
|