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..91b1f0ac 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 @@ -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 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