Skip to content

Test for minimum free memory #308

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 4 commits into from
Sep 22, 2021
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Show output from successful compile
- `--min-free-space=N` command-line argument to fail if free space is below requred value

### Changed
- Change 266 files from CRLF to LF.
Expand Down
19 changes: 17 additions & 2 deletions exe/arduino_ci.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def self.parse(options)
ci_config: {
"unittest" => unit_config
},
min_free_space: 0,
}

opt_parser = OptionParser.new do |opts|
Expand All @@ -49,6 +50,10 @@ def self.parse(options)
unit_config["testfiles"]["reject"] << p
end

opts.on("--min-free-space=VALUE", "Minimum free SRAM memory for stack/heap") do |p|
output_options[:min_free_space] = p.to_i
end

opts.on("-h", "--help", "Prints this help") do
puts opts
puts
Expand Down Expand Up @@ -478,8 +483,18 @@ def perform_example_compilation_tests(cpp_library, config)
board = ovr_config.platform_info[p][:board]
attempt("Compiling #{example_name} for #{board}") do
ret = @backend.compile_sketch(example_path, board)
unless ret
puts
puts
if ret
output = @backend.last_msg
puts output
i = output.index("leaving")
free_space = output[i + 8..-1].to_i
min_free_space = @cli_options[:min_free_space]
if free_space < min_free_space
puts "Free space of #{free_space} is less than minimum of #{min_free_space}"
ret = false
end
else
Comment on lines +487 to +497
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will clean this up in #335

puts "Last command: #{@backend.last_msg}"
puts @backend.last_err
end
Expand Down
1 change: 1 addition & 0 deletions lib/arduino_ci/arduino_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def compile_sketch(path, boardname)
return false
end
ret = run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", "--dry-run", path.to_s)
@last_msg = ret[:out]
ret[:success]
end

Expand Down