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

accept a seed option to the build runner and shuffle the dependency order using it #14940

Closed
Tracked by #14647
andrewrk opened this issue Mar 16, 2023 · 2 comments · Fixed by #16817
Closed
Tracked by #14647

accept a seed option to the build runner and shuffle the dependency order using it #14940

andrewrk opened this issue Mar 16, 2023 · 2 comments · Fixed by #16817
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@andrewrk
Copy link
Member

Extracted from #14647.

Add a --seed option to the build runner and make the zig build subcommand always supply a random seed argument.

Use this seed to shuffle the dependency order of steps when -j1 is selected, and ideally also shuffle order of steps for dependency peers when concurrency is being used. Be sure not to disrupt the heuristics for starting leaf dependencies first when the number of threads in the thread pool is greater than one.

This will help protect build scripts from accumulating concurrency bugs.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. breaking Implementing this issue could cause existing code to no longer compile or have different behavior. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Mar 16, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Mar 16, 2023
@LAC-Tech
Copy link

Adding to what was discussed with Andrew on IRC:

It would also be very useful to expose this some how to tests. In property-based testing, there's a different seed for each run of tests, the idea being that as you re-run tests you will randomly explore more of the state space.

@andrewrk
Copy link
Member Author

@LAC-Tech I filed a proposal for that idea here: #17609

@andrewrk andrewrk modified the milestones: 0.14.0, 0.12.0 Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants