Skip to content
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

Make it build and pass unittests on my machine #96

Merged
merged 8 commits into from
Jul 14, 2024

Conversation

xtsm
Copy link
Contributor

@xtsm xtsm commented Jul 9, 2024

There were some minor compilation errors and failing unittests.
One test was most likely failing because of google/googletest#705, I've updated gtest and gmock, now it's green.
Another couple of tests were failing because of the undefined iteration order for unordered_map. Also there was a hack for Apple builds that was probably supposed to fix that test by replacing the container with regular map. I've moved the hack to testing code and made it more reliable.

(This PR can be splitted, the commits are more or less independent.)

xtsm added 8 commits July 8, 2024 20:54
Allows using GMock command line options.
Necessary for GTest and GMock update.
Fixes random segfaults in RLMachineTest.SerializationOfSavepointValues.
- Operations `recMulti` and `grpMulti` each have two variants with different
  opcodes for different types of arguments. There's no way to tell these
  variants apart using just op name and overload index.
- RLModule allows us to iterate over all operations from the module. The
  order of iteration is undefined because it uses std::unordered_map
  under the hood.
- TestMachine fills an internal operations registry by iterating over module
  operations and adding them to a map. Map keys are pairs
  (op name, overload index). If there are duplicate keys (as it is with
  recMulti), we just overwrite whatever we recorded earlier. This is
  clearly wrong.
- The solution here is to add a crutch that ignores unneeded operation
  variants in testing code. There's now also a check for key dupes.
- There was an ifdef for using `std::map` instead of `std::unordered_map`
  in RLModule for Apple builds to fix some failing test. I presume it was the
  same test that gets fixed here so that ifdef also got removed.
@eglaysher
Copy link
Owner

(It will be a few more days until I can review this patch. Sorry.)

@eglaysher eglaysher merged commit 0eb99b8 into eglaysher:master Jul 14, 2024
@eglaysher
Copy link
Owner

Read everything. Thank you. I can't actually build anything right now (I don't have an ubuntu machine anymore and my mac isn't set up for development), but everything here makes sense so I'm just going to go ahead and merge this.

@xtsm
Copy link
Contributor Author

xtsm commented Jul 14, 2024

(btw probably fixes #66 and #84)

@xtsm xtsm deleted the fixes branch July 14, 2024 19:39
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