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

Weak test revisions #365

Merged
merged 9 commits into from
Jun 13, 2023
Merged

Weak test revisions #365

merged 9 commits into from
Jun 13, 2023

Conversation

jmid
Copy link
Collaborator

@jmid jmid commented Jun 9, 2023

This PR revises our Weak tests...

The Weak module depends on the state of the GC.
As such, we have to be extra careful to start from "as clean a starting point as possible".
Just having run sequential tests pollutes the heap state - so better run a Gc.full_major () initially - and a cheaper Gc.minor () in between attempts.

Secondly, the PR switches away from strings to more easy-to-shrink int64s.

Finally I think running Lin tests of Weak is misguided, as I don't think it makes sense to perform a fragile GC-dependent parallel run and compare its outputs against more fragile GC-dependent sequential runs.
Parallel Weak STM tests however work well as stress tests - we previously caught run-time bugs that way (e.g., #181)

Hopefully this will solve #299.

I can see a 5.2 s390x run even completed within the timelimit with this: 🎉
https://ocaml-multicoretests.ci.dev:8100/job/2023-06-09/150708-ci-ocluster-build-44e4ee

jmid added 6 commits June 9, 2023 15:25
- to use easier to shrink int64s
- doing a full major GC to have a clean starting point
- doing a minor GC in between attempts
- increasing the frequency of cmds that make us observe the state
- also adding minor and major GC calls for reproducability
- increasing the frequency of state observing cmds
- adding a simple cmd shrinker
Copy link
Collaborator

@shym shym left a comment

Choose a reason for hiding this comment

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

This looks very good! 😄

The only thing I would have done differently is the support for 5.0. I’ve used this in the past: shym/ortac@cecf0c5 which has the nice side-effect that it doesn’t override the standard module when not needed. But I’m not sure this makes such a difference.

@jmid
Copy link
Collaborator Author

jmid commented Jun 9, 2023

Good point about overriding 👍
Actually, now that you mention it, I realize by reordering the include I would use the 5.1 and 5.2 bindings when they are available. I've previously used that trick in QCheck but forgotten about it: 😅
https://github.com/c-cube/qcheck/blob/9424d94c8fa682ef90ad8bf2d487c852d8c4f38d/src/core/QCheck.ml#L12-L19

@shym
Copy link
Collaborator

shym commented Jun 9, 2023

Nice trick 👍

@jmid
Copy link
Collaborator Author

jmid commented Jun 12, 2023

The shadowing is handled in 9b85211.
I've also gone for removing the Lin tests entirely as I don't see us needing them in the future.
We may have to disable the parallel src/weak/stm_tests_hashset test on Windows bytecode where it doesn't seem to consistently trigger.

@jmid
Copy link
Collaborator Author

jmid commented Jun 12, 2023

CI summary for 720028c

Modulo the first one, none of this is related to this PR.

@shym
Copy link
Collaborator

shym commented Jun 12, 2023

Small suggestion for the last commit: rather than disabling the warning globally, it can be disabled only where it might trigger, it’s easier to understand why it is required.

@@ -41,6 +41,7 @@ struct
 
   module Int64 =
   struct
+    [@@@warning "-unused-value-declaration"]
     (* support Int64.hash added in 5.1 *)
     external seeded_hash_param :
       int -> int -> int -> 'a -> int = "caml_hash" [@@noalloc]

@jmid
Copy link
Collaborator Author

jmid commented Jun 12, 2023

CI summary of latest run

  • 2 Windows bytecode runs on 5.1.0~alpha2 and 5.2 trunk timed out due to threadomain [ocaml5-issue] Windows failures on threadomain #203
  • 2 Cygwin part 1 runs (1 on 5.1.0~alpha2 and 1 trunk) were cancelled before running 🤔 potentially getting confused by the midway push...

@jmid jmid force-pushed the weak-hashset-predictable branch from d45824f to f3d0160 Compare June 12, 2023 21:13
@jmid
Copy link
Collaborator Author

jmid commented Jun 12, 2023

Small suggestion for the last commit: [...]

Fair enough. No need to silence more than necessary. Should be addressed in f3d0160 👍

@jmid
Copy link
Collaborator Author

jmid commented Jun 13, 2023

CI summary for the latest run:

I'll go ahead and merge.

@jmid jmid merged commit c08b00a into main Jun 13, 2023
@jmid jmid deleted the weak-hashset-predictable branch June 13, 2023 15:12
@jmid jmid linked an issue Jun 13, 2023 that may be closed by this pull request
@jmid jmid mentioned this pull request Jun 13, 2023
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.

Lin HashSet tests shrinking taking very long
2 participants