Fix MacOS C++ tests compatibility issues#3677
Fix MacOS C++ tests compatibility issues#3677nycrat wants to merge 11 commits intoUBC-Thunderbots:masterfrom
Conversation
| @@ -63,7 +89,8 @@ int main(int argc, char **argv) | |||
| { | |||
| // disable floating point errors when using visualizer due to potential | |||
| // floating point errors in QT | |||
| fedisableexcept(FE_INVALID | FE_OVERFLOW); | |||
| // TODO #(2510) Remove this once we port over to simulated pytests entirely | |||
| // fedisableexcept(FE_INVALID | FE_OVERFLOW); | |||
There was a problem hiding this comment.
Oh true I'll remove them now
| { | ||
| double out = linear(0, 0, 2); | ||
| EXPECT_EQ(out, 0.5); | ||
| EXPECT_NEAR(out, 0.5, 1e-15); |
There was a problem hiding this comment.
Could we use std::numeric_limits<double>::epsilon() here instead?
| qtawesome==1.4.0 \ | ||
| --hash=sha256:783e414d1317f3e978bf67ea8e8a1b1498bad9dbd305dec814027e3b50521be6 \ | ||
| --hash=sha256:a4d689fa071c595aa6184171ce1f0f847677cb8d2db45382c43129f1d72a3d93 | ||
| # via -r software/thunderscope/requirements.in |
There was a problem hiding this comment.
Are these intended dep updates?
| # Linker flags required for macos, doesn't affect linux | ||
| link_flags = ["-Wl,-undefined,dynamic_lookup"] |
There was a problem hiding this comment.
Does this affect the robots/cross-compile toolchain? They run on ARM.
There was a problem hiding this comment.
I'll look into it a bit more, from what I understand its a difference between apple's llvm ld and gnu ld
9db98e8 to
031ab83
Compare
914b755 to
bbf6240
Compare
| #if defined(__linux__) && defined(__GNUC__) | ||
| feenableexcept(excepts); | ||
| return true; | ||
| #else | ||
| // Unsupported platform | ||
| return false; |
There was a problem hiding this comment.
This looks fine, but just curious:
Is there any reason that we did not use polyfills such as
https://github.com/adobe/lagrange/blob/771d85889dd052b545de1fa4a66fe4b3ff2c5e91/modules/core/src/fpe.cpp#L94-L113
Not sure if polyfills like this will work, but I think if it does, it will enable more consistency behaviours across different platforms?
There was a problem hiding this comment.
Oh yea I tested it and it should technically be possible since I got it working for a minimal example https://gist.github.com/nycrat/3bfd574a7b3d328e51ae1b3705de9ebc. But for some reason it doesn't work with gtest. I'll keep trying to make it work since that would be optimal
Description
This PR makes unit tests and c++ simulated tests able to run on macos, and resolved issues caused by differences between mac and ubuntu (clang & gcc).
(14:40:33) ERROR: /Users/avah/2_school/team/thunderbots/src/proto/BUILD:64:21: Linking proto/liblink_nanopb_outputs.dylib failed: (Exit 1): cc_wrapper.sh failed: error exe cuting CppLink command (from target //proto:tbots_nanopb_proto)by adding linker flags to use dynamic lookupScreen.Recording.2026-04-06.at.13.55.44.mov
Testing Done
Ran simulated gameplay test suite and everything works. Ran software tests and there were three test failures and how they were fixed:
Resolved Issues
There was no issue made, but in #3496, it was stated that unit tests do not work on macos: #3496 (comment).
Length Justification and Key Files to Review
Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
.hfile) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.TODO(or similar) statements should either be completed or associated with a github issue