From 362cf1554fc573d16200ac0fd0890b56776395bf Mon Sep 17 00:00:00 2001 From: James Foster Date: Fri, 27 Aug 2021 14:32:16 -0700 Subject: [PATCH 1/4] * Report output from compile. * Allow test for minimum free space. --- CHANGELOG.md | 2 ++ exe/arduino_ci.rb | 14 ++++++++++++-- lib/arduino_ci/arduino_backend.rb | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f29be1a6..d97279dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 01234e7c..932f754d 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -478,8 +478,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 puts "Last command: #{@backend.last_msg}" puts @backend.last_err end diff --git a/lib/arduino_ci/arduino_backend.rb b/lib/arduino_ci/arduino_backend.rb index 4e04f5b3..e67710bf 100644 --- a/lib/arduino_ci/arduino_backend.rb +++ b/lib/arduino_ci/arduino_backend.rb @@ -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 From c23fbd0d363a41ea7b187612ef8912b55b3e8f0b Mon Sep 17 00:00:00 2001 From: James Foster Date: Fri, 27 Aug 2021 14:41:18 -0700 Subject: [PATCH 2/4] Add in missed code. --- exe/arduino_ci.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 932f754d..ac159f06 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -24,6 +24,7 @@ def self.parse(options) ci_config: { "unittest" => unit_config }, + min_free_space: 0, } opt_parser = OptionParser.new do |opts| @@ -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 From 8d58657ccff259b48a40e9ed634a373704ad1cb7 Mon Sep 17 00:00:00 2001 From: James Foster Date: Fri, 27 Aug 2021 14:44:59 -0700 Subject: [PATCH 3/4] Do not use parenthesis for method calls with no arguments. --- exe/arduino_ci.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index ac159f06..ba043274 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -51,7 +51,7 @@ def self.parse(options) end opts.on("--min-free-space=VALUE", "Minimum free SRAM memory for stack/heap") do |p| - output_options[:min_free_space] = p.to_i() + output_options[:min_free_space] = p.to_i end opts.on("-h", "--help", "Prints this help") do From c29936431debe8174ca6346d79e3da4049deff0d Mon Sep 17 00:00:00 2001 From: James Foster Date: Fri, 27 Aug 2021 14:50:46 -0700 Subject: [PATCH 4/4] Another parenthesis with no arguments! --- exe/arduino_ci.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index ba043274..91b1f0ac 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -488,7 +488,7 @@ def perform_example_compilation_tests(cpp_library, config) output = @backend.last_msg puts output i = output.index("leaving") - free_space = output[i + 8..-1].to_i() + 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}"