-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
[Merged by Bors] - Retrieve feature-based results for Test262 runs #1980
Closed
NorbertGarfield
wants to merge
2
commits into
boa-dev:main
from
NorbertGarfield:garfield/test-features
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -50,12 +50,45 @@ impl From<ResultInfo> for ReducedResultInfo { | |||||
} | ||||||
} | ||||||
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)] | ||||||
struct FeaturesInfo { | ||||||
#[serde(rename = "c")] | ||||||
commit: Box<str>, | ||||||
#[serde(rename = "u")] | ||||||
test262_commit: Box<str>, | ||||||
#[serde(rename = "n")] | ||||||
suite_name: Box<str>, | ||||||
#[serde(rename = "f")] | ||||||
features: Vec<String>, | ||||||
} | ||||||
|
||||||
fn remove_duplicates(features_vec: &Vec<String>) -> Vec<String> { | ||||||
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. This should solve the clippy error, but might need some changes in the code to convert the slice to a vector.
Suggested change
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. |
||||||
let mut result = features_vec.clone(); | ||||||
result.sort(); | ||||||
result.dedup(); | ||||||
result | ||||||
} | ||||||
|
||||||
impl From<ResultInfo> for FeaturesInfo { | ||||||
fn from(info: ResultInfo) -> Self { | ||||||
Self { | ||||||
commit: info.commit, | ||||||
test262_commit: info.test262_commit, | ||||||
suite_name: info.results.name, | ||||||
features: remove_duplicates(&info.results.features), | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
/// File name of the "latest results" JSON file. | ||||||
const LATEST_FILE_NAME: &str = "latest.json"; | ||||||
|
||||||
/// File name of the "all results" JSON file. | ||||||
const RESULTS_FILE_NAME: &str = "results.json"; | ||||||
|
||||||
/// File name of the "features" JSON file. | ||||||
const FEATURES_FILE_NAME: &str = "features.json"; | ||||||
|
||||||
/// Writes the results of running the test suite to the given JSON output file. | ||||||
/// | ||||||
/// It will append the results to the ones already present, in an array. | ||||||
|
@@ -108,14 +141,33 @@ pub(crate) fn write_json( | |||||
Vec::new() | ||||||
}; | ||||||
|
||||||
all_results.push(new_results.into()); | ||||||
all_results.push(new_results.clone().into()); | ||||||
|
||||||
let output = BufWriter::new(fs::File::create(&all_path)?); | ||||||
serde_json::to_writer(output, &all_results)?; | ||||||
|
||||||
if verbose != 0 { | ||||||
println!("Results written correctly"); | ||||||
} | ||||||
|
||||||
// Write the full list of features, existing features go first. | ||||||
|
||||||
let features_path = path.join(FEATURES_FILE_NAME); | ||||||
|
||||||
let mut all_features: Vec<FeaturesInfo> = if features_path.exists() { | ||||||
serde_json::from_reader(BufReader::new(fs::File::open(&features_path)?))? | ||||||
} else { | ||||||
Vec::new() | ||||||
}; | ||||||
|
||||||
all_features.push(new_results.into()); | ||||||
|
||||||
let features_output = BufWriter::new(fs::File::create(&features_path)?); | ||||||
serde_json::to_writer(features_output, &all_features)?; | ||||||
|
||||||
if verbose != 0 { | ||||||
println!("Features written correctly"); | ||||||
} | ||||||
} | ||||||
|
||||||
Ok(()) | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is giving a clippy warning, should be fixed with this:
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.
Thanks. Applied https://github.com/boa-dev/boa/pull/1980/files#diff-fc3d7ad7b5e64574258c9febbe56171f3309b74e0c8da35238a76002f3ee34d9R77