-
Notifications
You must be signed in to change notification settings - Fork 6
improve perf of junit bindings #1045
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,16 +91,16 @@ | |
| test_build_information, | ||
| }: TestResult, | ||
| ) -> Self { | ||
| let test_cases: Vec<BindingsTestCase> = test_case_runs | ||
| let parent_name_map: HashMap<String, Vec<BindingsTestCase>> = test_case_runs | ||
| .into_iter() | ||
| .map(BindingsTestCase::from) | ||
| .collect(); | ||
| let parent_name_map: HashMap<String, Vec<BindingsTestCase>> = | ||
| test_cases.iter().fold(HashMap::new(), |mut acc, testcase| { | ||
| .fold(HashMap::new(), |mut acc, testcase| { | ||
| if let Some(parent_name) = testcase.extra.get("parent_name") { | ||
| acc.entry(parent_name.clone()) | ||
| .or_default() | ||
| .push(testcase.to_owned()); | ||
| if let Some(parent_name_vec) = acc.get_mut(parent_name) { | ||
| parent_name_vec.push(testcase); | ||
| } else { | ||
| acc.insert(parent_name.to_string(), vec![testcase]); | ||
| } | ||
|
Comment on lines
-101
to
+103
Member
Author
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. Only clone the |
||
| } | ||
| acc | ||
| }); | ||
|
|
@@ -366,16 +366,16 @@ | |
| classname: "test_classname".into(), | ||
| file: "test_file".into(), | ||
| parent_name: "test_parent_name1".into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| line: 0, | ||
| line_number: Some(LineNumber { number: 1 }), | ||
| status: TestCaseRunStatus::Success.into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| attempt_number: 0, | ||
| attempt_index: Some(AttemptNumber { number: 1 }), | ||
| started_at: Some(test_started_at.clone()), | ||
| finished_at: Some(test_finished_at.clone()), | ||
| // trunk-ignore(clippy/deprecated) | ||
| status_output_message: "test_status_output_message".into(), | ||
| codeowners: vec![codeowner1], | ||
| test_output: Some(TestOutput { | ||
|
|
@@ -393,14 +393,14 @@ | |
| classname: "test_classname".into(), | ||
| file: "test_file".into(), | ||
| parent_name: "test_parent_name2".into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| line: 1, | ||
| status: TestCaseRunStatus::Failure.into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| attempt_number: 1, | ||
| started_at: Some(test_started_at.clone()), | ||
| finished_at: Some(test_finished_at), | ||
| // trunk-ignore(clippy/deprecated) | ||
| status_output_message: "test_status_output_message".into(), | ||
| test_output: Some(TestOutput { | ||
| message: "".into(), | ||
|
|
@@ -491,11 +491,11 @@ | |
| ); | ||
| assert_eq!(test_case2.extra["id"], test2.id); | ||
| assert_eq!(test_case2.extra["file"], test2.file); | ||
| // trunk-ignore(clippy/deprecated) | ||
| assert_eq!(test_case2.extra["line"], test2.line.to_string()); | ||
| assert_eq!( | ||
| test_case2.extra["attempt_number"], | ||
| // trunk-ignore(clippy/deprecated) | ||
| test2.attempt_number.to_string() | ||
| ); | ||
| assert_eq!(test_case2.properties.len(), 0); | ||
|
|
@@ -664,14 +664,14 @@ | |
| classname: "test_classname".into(), | ||
| file: "test_file1.java".into(), | ||
| parent_name: "test_parent_name1".into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| line: 1, | ||
| status: TestCaseRunStatus::Success.into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| attempt_number: 1, | ||
| started_at: Some(test_started_at.clone()), | ||
| finished_at: Some(test_finished_at.clone()), | ||
| // trunk-ignore(clippy/deprecated) | ||
| status_output_message: "".into(), | ||
| codeowners: vec![codeowner1.clone()], | ||
| test_output: None, | ||
|
|
@@ -684,14 +684,14 @@ | |
| classname: "test_classname".into(), | ||
| file: "test_file2.java".into(), | ||
| parent_name: "test_parent_name1".into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| line: 2, | ||
| status: TestCaseRunStatus::Success.into(), | ||
| // trunk-ignore(clippy/deprecated) | ||
| attempt_number: 1, | ||
| started_at: Some(test_started_at.clone()), | ||
| finished_at: Some(test_finished_at.clone()), | ||
| // trunk-ignore(clippy/deprecated) | ||
| status_output_message: "".into(), | ||
| codeowners: vec![codeowner2.clone()], | ||
| test_output: None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,8 +262,8 @@ impl BindingsTestCase { | |
| } | ||
|
|
||
| impl BindingsTestCase { | ||
| pub fn extra(&self) -> HashMap<String, String> { | ||
| self.extra.clone() | ||
| pub fn extra(&self) -> &HashMap<String, String> { | ||
| &self.extra | ||
|
Comment on lines
-265
to
+266
Member
Author
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. The caller can clone if needed |
||
| } | ||
|
|
||
| pub fn is_quarantined(&self) -> bool { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ impl From<JunitReportValidation> for BindingsJunitReportValidation { | |
| .collect(), | ||
| level, | ||
| test_suites, | ||
| valid_test_suites: valid_test_suites.into_iter().collect(), | ||
| valid_test_suites, | ||
|
Member
Author
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. not needed |
||
| test_runner_report, | ||
| } | ||
| } | ||
|
|
||
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.
I combined these operations to skip allocating a
Vecwhen we iterate over the results of theVecanyways