Skip to content

Commit

Permalink
Merge fa529b3 into 24deb83
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican authored May 24, 2021
2 parents 24deb83 + fa529b3 commit d6c5a64
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test262.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
body-includes: Test262 conformance changes

- name: Update comment
if: github.event_name == 'pull_request' && steps.previous-comment.outputs.comment-id
# if: github.event_name == 'pull_request' && steps.previous-comment.outputs.comment-id
uses: peter-evans/create-or-update-comment@v1.4.5
continue-on-error: true
with:
Expand All @@ -84,7 +84,7 @@ jobs:
edit-mode: replace

- name: Write a new comment
if: github.event_name == 'pull_request' && !steps.previous-comment.outputs.comment-id
# if: github.event_name == 'pull_request' && !steps.previous-comment.outputs.comment-id
uses: peter-evans/create-or-update-comment@v1.4.5
continue-on-error: true
with:
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/bigint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod tests;
pub struct BigInt(num_bigint::BigInt);

impl BuiltIn for BigInt {
const NAME: &'static str = "BigInt";
const NAME: &'static str = "BigInt2";

fn attribute() -> Attribute {
Attribute::WRITABLE | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE
Expand Down
155 changes: 155 additions & 0 deletions boa_tester/src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ pub(crate) fn compare_results(base: &Path, new: &Path, markdown: bool) {
let new_conformance = (new_passed as f64 / new_total as f64) * 100_f64;
let conformance_diff = new_conformance - base_conformance;

let test_diff = compute_result_diff(base, &base_results.results, &new_results.results);

if markdown {
use num_format::{Locale, ToFormattedString};

Expand Down Expand Up @@ -269,6 +271,46 @@ pub(crate) fn compare_results(base: &Path, new: &Path, markdown: bool) {
},
),
);

if !test_diff.fixed.is_empty() {
println!();
println!("#### Fixed tests:");
println!("```");
for test in test_diff.fixed {
println!("{}", test);
}
println!("```");
}

if !test_diff.broken.is_empty() {
println!();
println!("#### Broken tests:");
println!("```");
for test in test_diff.broken {
println!("{}", test);
}
println!("```");
}

if !test_diff.new_panics.is_empty() {
println!();
println!("#### New panics:");
println!("```");
for test in test_diff.new_panics {
println!("{}", test);
}
println!("```");
}

if !test_diff.panic_fixes.is_empty() {
println!();
println!("#### Fixed panics:");
println!("```");
for test in test_diff.panic_fixes {
println!("{}", test);
}
println!("```");
}
} else {
println!("Test262 conformance changes:");
println!("| Test result | master | PR | difference |");
Expand Down Expand Up @@ -296,5 +338,118 @@ pub(crate) fn compare_results(base: &Path, new: &Path, markdown: bool) {
new_panics,
base_panics - new_panics
);

if !test_diff.fixed.is_empty() {
println!();
println!("Fixed tests:");
for test in test_diff.fixed {
println!("{}", test);
}
}

if !test_diff.broken.is_empty() {
println!();
println!("Broken tests:");
for test in test_diff.broken {
println!("{}", test);
}
}

if !test_diff.new_panics.is_empty() {
println!();
println!("New panics:");
for test in test_diff.new_panics {
println!("{}", test);
}
}

if !test_diff.panic_fixes.is_empty() {
println!();
println!("Fixed panics:");
for test in test_diff.panic_fixes {
println!("{}", test);
}
}
}
}

/// Test differences.
#[derive(Debug, Clone, Default)]
struct ResultDiff {
fixed: Vec<Box<str>>,
broken: Vec<Box<str>>,
new_panics: Vec<Box<str>>,
panic_fixes: Vec<Box<str>>,
}

impl ResultDiff {
/// Extends the diff with new results.
fn extend(&mut self, new: Self) {
self.fixed.extend(new.fixed);
self.broken.extend(new.broken);
self.new_panics.extend(new.new_panics);
self.panic_fixes.extend(new.panic_fixes);
}
}

/// Compares a base and a new result and returns the list of differences.
fn compute_result_diff(
base: &Path,
base_result: &SuiteResult,
new_result: &SuiteResult,
) -> ResultDiff {
use super::TestOutcomeResult;

let mut final_diff = ResultDiff::default();

for base_test in &base_result.tests {
if let Some(new_test) = new_result
.tests
.iter()
.find(|new_test| new_test.strict == base_test.strict && new_test.name == base_test.name)
{
let test_name = format!(
"test/{}/{}.js {}(previously {:?})",
base.strip_prefix("../gh-pages/test262/refs/heads/master/latest.json")
.expect("error removing prefix")
.display(),
new_test.name,
if base_test.strict {
"[strict mode] "
} else {
""
},
base_test.result
)
.into_boxed_str();

match (base_test.result, new_test.result) {
(TestOutcomeResult::Passed, TestOutcomeResult::Passed)
| (TestOutcomeResult::Ignored, TestOutcomeResult::Ignored)
| (TestOutcomeResult::Failed, TestOutcomeResult::Failed)
| (TestOutcomeResult::Panic, TestOutcomeResult::Panic) => {}

(_, TestOutcomeResult::Passed) => final_diff.fixed.push(test_name),
(_, TestOutcomeResult::Failed) => final_diff.broken.push(test_name),
(_, TestOutcomeResult::Panic) => final_diff.new_panics.push(test_name),
(TestOutcomeResult::Panic, _) => final_diff.panic_fixes.push(test_name),
_ => {}
}
}
}

for base_suite in &base_result.suites {
if let Some(new_suite) = new_result
.suites
.iter()
.find(|new_suite| new_suite.name == base_suite.name)
{
let new_base = base.join(new_suite.name.as_ref());
let diff = compute_result_diff(new_base.as_path(), base_suite, new_suite);

final_diff.extend(diff)
}
}

final_diff
}

0 comments on commit d6c5a64

Please sign in to comment.