-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: add global -j, --threads #9367
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ foundry_config::merge_impl_figment_convert!(TestArgs, opts, evm_opts); | |
#[derive(Clone, Debug, Parser)] | ||
#[command(next_help_heading = "Test options")] | ||
pub struct TestArgs { | ||
/// Include the global options. | ||
// Include global options for users of this struct. | ||
#[command(flatten)] | ||
pub global: GlobalOpts, | ||
|
||
|
@@ -149,11 +149,6 @@ pub struct TestArgs { | |
#[arg(long)] | ||
pub fuzz_input_file: Option<String>, | ||
|
||
/// Max concurrent threads to use. | ||
/// Default value is the number of available CPUs. | ||
#[arg(long, short = 'j', visible_alias = "jobs")] | ||
pub threads: Option<usize>, | ||
|
||
/// Show test execution progress. | ||
#[arg(long)] | ||
pub show_progress: bool, | ||
|
@@ -276,13 +271,6 @@ impl TestArgs { | |
// Merge all configs. | ||
let (mut config, mut evm_opts) = self.load_config_and_evm_opts_emit_warnings()?; | ||
|
||
// Set number of max threads to execute tests. | ||
// If not specified then the number of threads determined by rayon will be used. | ||
if let Some(test_threads) = config.threads { | ||
trace!(target: "forge::test", "execute tests with {} max threads", test_threads); | ||
rayon::ThreadPoolBuilder::new().num_threads(test_threads).build_global()?; | ||
} | ||
|
||
// Explicitly enable isolation for gas reports for more correct gas accounting. | ||
if self.gas_report { | ||
evm_opts.isolate = true; | ||
|
@@ -898,10 +886,6 @@ impl Provider for TestArgs { | |
dict.insert("show_progress".to_string(), true.into()); | ||
} | ||
|
||
if let Some(threads) = self.threads { | ||
dict.insert("threads".to_string(), threads.into()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have |
||
} | ||
|
||
Ok(Map::from([(Config::selected_profile(), dict)])) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the same value as the global one