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

Rpc_genfake: introduce maxcomb to limit number of combinations #177

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

edwintorok
Copy link
Collaborator

Now we no longer run out of memory trying to generate tests for Xenops_interface with maxcomb:100 or maxcomb:1000.
This builds on top of #176

Still TODO: gen_nice still dies on recursive datatypes, which prevent generating documentation in some cases, noticed by @psafont , but I'll leave that for yet another PR (it is not obvious how to limit it there, because it must return a type 'a', so likely we need to perform the 'seen' check before making the call)

@psafont
Copy link
Contributor

psafont commented Feb 12, 2024

Seq.cycle is not available in ocaml 4.08 (probably other methods as well) Should these definitions be added where they are used, or should a compatibility library be used instead?

@mseri
Copy link
Collaborator

mseri commented Feb 12, 2024

We could even drop compatibility with older ocaml if you ask me

Rpc_genfake generates lists, and then throws away all elements except first when depth limit is reached.
Use Seq.t instead so we can avoid generating the data that we'd throw away.

Signed-off-by: Edwin Török <[email protected]>
For a struct with `n` field, each with `m` values, this might otherwise try to generate `m`^`n` values.

Signed-off-by: Edwin Török <[email protected]>
@edwintorok
Copy link
Collaborator Author

@Vincent-lau 's PR dropped compat with old OCaml versions, and the CI passes now.

@edwintorok edwintorok merged commit 7bd056d into mirage:master Sep 25, 2024
4 checks passed
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.

3 participants