Skip to content

Run test alphabetically and ignore library-already-installed errors #90

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 3 commits into from
Jan 15, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

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

### Deprecated

### Removed

### Fixed
- Library installation no longer "fails" if the library is already installed
- Platform definition for `mega2560` now includes proper AVR compiler flag

### Security

Expand Down
9 changes: 6 additions & 3 deletions lib/arduino_ci/arduino_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ def install_boards(boardfamily)
# @param name [String] the library name
# @return [bool] whether the command succeeded
def _install_library(library_name)
success = run_and_capture(flag_install_library, library_name)[:success]
result = run_and_capture(flag_install_library, library_name)

already_installed = result[:err].include?("Library is already installed: #{library_name}")
success = result[:success] || already_installed

@libraries_indexed = (@libraries_indexed || success) if library_name == WORKAROUND_LIB
success
Expand Down Expand Up @@ -237,7 +240,7 @@ def library_present?(library_name)
def update_library_index
# install random lib so the arduino IDE grabs a new library index
# see: https://github.com/arduino/Arduino/issues/3535
install_library("USBHost")
install_library(WORKAROUND_LIB)
end

# use a particular board for compilation
Expand Down Expand Up @@ -319,7 +322,7 @@ def library_examples(installed_library_path)
proj_file = example_path + e + "#{e}.ino"
proj_file.exist? ? proj_file.to_s : nil
end
files.reject(&:nil?)
files.reject(&:nil?).sort_by(&:to_s)
end
end
end
3 changes: 2 additions & 1 deletion lib/arduino_ci/cpp_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def cpp_files_in(some_dir)
real = some_dir.realpath
files = Find.find(real).map { |p| Pathname.new(p) }.reject(&:directory?)
cpp = files.select { |path| CPP_EXTENSIONS.include?(path.extname.downcase) }
cpp.reject { |path| path.basename.to_s.start_with?(".") } # ignore hidden
not_hidden = cpp.reject { |path| path.basename.to_s.start_with?(".") }
not_hidden.sort_by(&:to_s)
end

# CPP files that are part of the project library under test
Expand Down
1 change: 1 addition & 0 deletions misc/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ platforms:
gcc:
features:
defines:
- __AVR_ATmega2560__
warnings:
flags:
cplayClassic:
Expand Down