Skip to content

Commit aacfdb2

Browse files
committed
Fix typo in compiler flag generation
1 parent 2572813 commit aacfdb2

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2020
### Fixed
2121
- A missing `examples` directory no longer causes a crash in `cpp_library.rb`
2222
- Referring to an undefined platform no longer causes a crash; it's now a helpful error message
23+
- A copy/paste error that prevented compiler warning flags from being supplied has been fixed, via jgfoster
2324

2425
### Security
2526

Diff for: lib/arduino_ci/cpp_library.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def feature_args(ci_gcc_config)
446446
def warning_args(ci_gcc_config)
447447
return [] if ci_gcc_config[:warnings].nil?
448448

449-
ci_gcc_config[:features].map { |w| "-W#{w}" }
449+
ci_gcc_config[:warnings].map { |w| "-W#{w}" }
450450
end
451451

452452
# GCC command line arguments for defines (e.g. -Dhave_something)

Diff for: spec/cpp_library_spec.rb

+26
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,32 @@ def verified_install(backend, path)
7676
RSpec.describe ArduinoCI::CppLibrary do
7777
next if skip_ruby_tests
7878

79+
context "compiler flags" do
80+
config = ArduinoCI::CIConfig.new
81+
config.load_yaml(File.join(File.dirname(__FILE__), "yaml", "o1.yaml"))
82+
bogo_config = config.gcc_config("bogo")
83+
fld = FakeLibDir.new
84+
backend = fld.backend
85+
cpp_lib_path = sampleproj_path + "DoSomething"
86+
cpp_library = verified_install(backend, cpp_lib_path)
87+
88+
# the keys are the methods of cpp_library to call
89+
# the results are what we expect to see based on the config we loaded
90+
methods_and_results = {
91+
feature_args: ["-fa", "-fb"],
92+
warning_args: ["-We", "-Wf"],
93+
define_args: ["-Dc", "-Dd"],
94+
flag_args: ["g", "h"]
95+
}
96+
97+
methods_and_results.each do |m, expected|
98+
it "Creates #{m} from config" do
99+
expect(expected).to eq(cpp_library.send(m, bogo_config))
100+
end
101+
end
102+
103+
end
104+
79105
context "arduino-library-specification detection" do
80106

81107
answers = {

0 commit comments

Comments
 (0)