Skip to content

Report compile errors in shared library #327

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 15 commits into from
Jul 1, 2022

Conversation

jgfoster
Copy link
Member

@jgfoster jgfoster commented Jul 1, 2022

Add test for compile errors.

@jgfoster jgfoster merged commit 33a136d into Arduino-CI:master Jul 1, 2022
@jgfoster jgfoster deleted the shared_library branch July 1, 2022 04:22
Comment on lines +426 to +441
got_shared_library = true
attempt_multiline("Build shared library with #{gcc_binary} for #{p}") do
exe = cpp_library.build_shared_library(
config.aux_libraries_for_unittest,
gcc_binary,
config.gcc_config(p)
)
unless exe
puts "Last command: #{cpp_library.last_cmd}"
puts cpp_library.last_out
puts cpp_library.last_err
got_shared_library = false
end
next got_shared_library
end
next unless got_shared_library
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain this change a bit? I'm not opposed to it, it just seems weird to move a small function into a big function

Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I don't understand it myself. But the symptom was that a failure in the compile shared library function (which called the attempt_multiline() method) did not get properly reported out when it failed. That is, we got a compile error in the shared library then went on to compile the examples and when the examples compiled okay the overall test reported as passed. It seemed to me that when the attempt_multiline() method recognized a failure it reported it out one level but it didn't get out two levels. That is, by putting the call into a small, well-named method (which would otherwise be a good practice), it swallowed the error. But by moving it up a level the error got properly reported.

Of course, this is all speculation and since I don't really understand what is going on I'm not real comfortable with the explanation. In an case, I added tests that confirmed the problem and verified the fix. But I really would welcome a better understanding of what changed and how this fixed it!

puts cpp_library.last_err
return false
end
return true
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jgfoster I think the actual problem was this return true which should just be an implicit return of exe 🤦 I'll push up this change in a bit and see what happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants