Skip to content

Skip compilation or unit tests in arduino_ci_remote.rb #99

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

Merged
merged 1 commit into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `ArduinoInstallation` and `ArduinoDownloader` now allow console output to optionally be set to an `IO` object of choice during `force_install`
- `ArduinoInstallation::force_install` now optionally accepts a version string
- `arduino_library_location.rb` script to print Arduino library location to stdout
- `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.

### Changed
- Unit tests and examples are now executed alphabetically by filename
Expand Down
44 changes: 32 additions & 12 deletions exe/arduino_ci_remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,36 @@
# Use some basic parsing to allow command-line overrides of config
class Parser
def self.parse(options)
parsed_config = {}
parsed_config["unittest"] = {}
unit_config = {}
output_options = {
skip_unittests: false,
skip_compilation: false,
ci_config: {
"unittest" => unit_config
},
}

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

opts.on("--skip-unittests", "Don't run unit tests") do |p|
output_options[:skip_unittests] = p
end

opts.on("--skip-compilation", "Don't compile example sketches") do |p|
output_options[:skip_compilation] = p
end

opts.on("--testfile-select=GLOB", "Unit test file (or glob) to select") do |p|
parsed_config["unittest"]["testfiles"] ||= {}
parsed_config["unittest"]["testfiles"]["select"] ||= []
parsed_config["unittest"]["testfiles"]["select"] << p
unit_config["testfiles"] ||= {}
unit_config["testfiles"]["select"] ||= []
unit_config["testfiles"]["select"] << p
end

opts.on("--testfile-reject=GLOB", "Unit test file (or glob) to reject") do |p|
parsed_config["unittest"]["testfiles"] ||= {}
parsed_config["unittest"]["testfiles"]["reject"] ||= []
parsed_config["unittest"]["testfiles"]["reject"] << p
unit_config["testfiles"] ||= {}
unit_config["testfiles"]["reject"] ||= []
unit_config["testfiles"]["reject"] << p
end

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

opt_parser.parse!(options)
parsed_config
output_options
end
end

Expand Down Expand Up @@ -154,9 +168,11 @@ def display_files(pathname)
end

def perform_unit_tests(file_config)
puts file_config.to_h[:unittest].to_s
config = file_config.with_override_config(@cli_options)
puts config.to_h[:unittest].to_s
if @cli_options[:skip_unittests]
inform("Skipping unit tests") { "as requested via command line" }
return
end
config = file_config.with_override_config(@cli_options[:ci_config])
cpp_library = ArduinoCI::CppLibrary.new(Pathname.new("."), @arduino_cmd.lib_dir)

# check GCC
Expand Down Expand Up @@ -220,6 +236,10 @@ def perform_unit_tests(file_config)
end

def perform_compilation_tests(config)
if @cli_options[:skip_compilation]
inform("Skipping compilation of examples") { "as requested via command line" }
return
end

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