Skip to content

Commit f3d6374

Browse files
authored
Merge pull request #99 from ianfixes/2019-01-28_skip_ci
Skip compilation or unit tests in arduino_ci_remote.rb
2 parents 90b3e68 + c4fb3a1 commit f3d6374

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
- `ArduinoInstallation` and `ArduinoDownloader` now allow console output to optionally be set to an `IO` object of choice during `force_install`
1010
- `ArduinoInstallation::force_install` now optionally accepts a version string
1111
- `arduino_library_location.rb` script to print Arduino library location to stdout
12+
- `arduino_ci_remote.rb` now supports `--skip-unittests` and `--skip-compilation`. If you skip both, only the `autolocate!` of the Arduino binary will be performed.
1213

1314
### Changed
1415
- Unit tests and examples are now executed alphabetically by filename

exe/arduino_ci_remote.rb

+32-12
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,36 @@
1313
# Use some basic parsing to allow command-line overrides of config
1414
class Parser
1515
def self.parse(options)
16-
parsed_config = {}
17-
parsed_config["unittest"] = {}
16+
unit_config = {}
17+
output_options = {
18+
skip_unittests: false,
19+
skip_compilation: false,
20+
ci_config: {
21+
"unittest" => unit_config
22+
},
23+
}
1824

1925
opt_parser = OptionParser.new do |opts|
2026
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
2127

28+
opts.on("--skip-unittests", "Don't run unit tests") do |p|
29+
output_options[:skip_unittests] = p
30+
end
31+
32+
opts.on("--skip-compilation", "Don't compile example sketches") do |p|
33+
output_options[:skip_compilation] = p
34+
end
35+
2236
opts.on("--testfile-select=GLOB", "Unit test file (or glob) to select") do |p|
23-
parsed_config["unittest"]["testfiles"] ||= {}
24-
parsed_config["unittest"]["testfiles"]["select"] ||= []
25-
parsed_config["unittest"]["testfiles"]["select"] << p
37+
unit_config["testfiles"] ||= {}
38+
unit_config["testfiles"]["select"] ||= []
39+
unit_config["testfiles"]["select"] << p
2640
end
2741

2842
opts.on("--testfile-reject=GLOB", "Unit test file (or glob) to reject") do |p|
29-
parsed_config["unittest"]["testfiles"] ||= {}
30-
parsed_config["unittest"]["testfiles"]["reject"] ||= []
31-
parsed_config["unittest"]["testfiles"]["reject"] << p
43+
unit_config["testfiles"] ||= {}
44+
unit_config["testfiles"]["reject"] ||= []
45+
unit_config["testfiles"]["reject"] << p
3246
end
3347

3448
opts.on("-h", "--help", "Prints this help") do
@@ -38,7 +52,7 @@ def self.parse(options)
3852
end
3953

4054
opt_parser.parse!(options)
41-
parsed_config
55+
output_options
4256
end
4357
end
4458

@@ -154,9 +168,11 @@ def display_files(pathname)
154168
end
155169

156170
def perform_unit_tests(file_config)
157-
puts file_config.to_h[:unittest].to_s
158-
config = file_config.with_override_config(@cli_options)
159-
puts config.to_h[:unittest].to_s
171+
if @cli_options[:skip_unittests]
172+
inform("Skipping unit tests") { "as requested via command line" }
173+
return
174+
end
175+
config = file_config.with_override_config(@cli_options[:ci_config])
160176
cpp_library = ArduinoCI::CppLibrary.new(Pathname.new("."), @arduino_cmd.lib_dir)
161177

162178
# check GCC
@@ -220,6 +236,10 @@ def perform_unit_tests(file_config)
220236
end
221237

222238
def perform_compilation_tests(config)
239+
if @cli_options[:skip_compilation]
240+
inform("Skipping compilation of examples") { "as requested via command line" }
241+
return
242+
end
223243

224244
# index the existing libraries
225245
attempt("Indexing libraries") { @arduino_cmd.index_libraries } unless @arduino_cmd.libraries_indexed

0 commit comments

Comments
 (0)