Skip to content

Commit

Permalink
Don't consider panic fixes as "new failures" (#1294)
Browse files Browse the repository at this point in the history
* Don't consider panic fixes as "new failures"

* Improved coding style

* Fixed Test262 tester for the testing update

* Ignore JSON module tests

* Test262 uses _FIXTURE at any point of the file name
  • Loading branch information
Razican authored May 30, 2021
1 parent c6d5689 commit ac99899
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
20 changes: 15 additions & 5 deletions boa_tester/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub(super) fn read_suite(path: &Path) -> io::Result<TestSuite> {

if entry.file_type()?.is_dir() {
suites.push(read_suite(entry.path().as_path())?);
} else if entry.file_name().to_string_lossy().ends_with("_FIXTURE.js") {
} else if entry.file_name().to_string_lossy().contains("_FIXTURE") {
continue;
} else if IGNORED.contains_file(&entry.file_name().to_string_lossy()) {
let mut test = Test::default();
Expand Down Expand Up @@ -165,13 +165,13 @@ pub(super) fn read_test(path: &Path) -> io::Result<Test> {
})?;

let content = fs::read_to_string(path)?;
let metadata = read_metadata(&content)?;
let metadata = read_metadata(&content, path)?;

Ok(Test::new(name, content, metadata))
}

/// Reads the metadata from the input test code.
fn read_metadata(code: &str) -> io::Result<MetaData> {
fn read_metadata(code: &str, test: &Path) -> io::Result<MetaData> {
use once_cell::sync::Lazy;
use regex::Regex;

Expand All @@ -183,9 +183,19 @@ fn read_metadata(code: &str) -> io::Result<MetaData> {

let yaml = META_REGEX
.captures(code)
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "no metadata found"))?
.ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidData,
format!("no metadata found for test {}", test.display()),
)
})?
.get(1)
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "no metadata found"))?
.ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidData,
format!("no metadata found for test {}", test.display()),
)
})?
.as_str()
.replace('\r', "\n");

Expand Down
8 changes: 3 additions & 5 deletions boa_tester/src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,13 @@ fn compute_result_diff(
.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) => {}
(a, b) if a == b => {}

(_, TestOutcomeResult::Passed) => final_diff.fixed.push(test_name),
(TestOutcomeResult::Panic, _) => final_diff.panic_fixes.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),

_ => {}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test262
Submodule test262 updated 88 files
+2 −2 CONTRIBUTING.md
+3 −1 INTERPRETING.md
+4 −0 features.txt
+6 −1 harness/regExpUtils.js
+2 −2 package.json
+20 −0 test/language/import/json-extensibility-array.js
+20 −0 test/language/import/json-extensibility-object.js
+6 −0 test/language/import/json-idempotency-indirect_FIXTURE.js
+21 −0 test/language/import/json-idempotency.js
+1 −0 test/language/import/json-idempotency_FIXTURE.json
+23 −0 test/language/import/json-invalid.js
+3 −0 test/language/import/json-invalid_FIXTURE.json
+20 −0 test/language/import/json-named-bindings.js
+3 −0 test/language/import/json-named-bindings_FIXTURE.json
+47 −0 test/language/import/json-value-array.js
+10 −0 test/language/import/json-value-array_FIXTURE.json
+20 −0 test/language/import/json-value-boolean.js
+1 −0 test/language/import/json-value-boolean_FIXTURE.json
+20 −0 test/language/import/json-value-null.js
+1 −0 test/language/import/json-value-null_FIXTURE.json
+20 −0 test/language/import/json-value-number.js
+1 −0 test/language/import/json-value-number_FIXTURE.json
+67 −0 test/language/import/json-value-object.js
+10 −0 test/language/import/json-value-object_FIXTURE.json
+20 −0 test/language/import/json-value-string.js
+1 −0 test/language/import/json-value-string_FIXTURE.json
+13 −0 test/language/import/json-via-namespace.js
+1 −0 test/language/import/json-via-namespace_FIXTURE.json
+1 −1 tools/lint/lib/checks/frontmatter.py
+3 −0 tools/lint/lib/checks/license.py
+0 −0 tools/lint/test/fixtures/test/esid_invalid.js
+0 −0 tools/lint/test/fixtures/test/features_empty.js
+0 −0 tools/lint/test/fixtures/test/features_unrecognized.js
+0 −0 tools/lint/test/fixtures/test/features_valid.js
+0 −0 tools/lint/test/fixtures/test/filename_forbidden_char_$.js
+0 −0 tools/lint/test/fixtures/test/flags_canblock_true_and_false.js
+0 −0 tools/lint/test/fixtures/test/flags_module_and_noStrict.js
+0 −0 tools/lint/test/fixtures/test/flags_module_and_onlyStrict.js
+0 −0 tools/lint/test/fixtures/test/flags_onlyStrict_and_noStrict.js
+0 −0 tools/lint/test/fixtures/test/flags_raw_and_noStrict.js
+0 −0 tools/lint/test/fixtures/test/flags_raw_and_onlyStrict.js
+2 −0 tools/lint/test/fixtures/test/frontmatter_copyright_FIXTURE.json
+0 −0 tools/lint/test/fixtures/test/frontmatter_invalid_yaml.js
+0 −0 tools/lint/test/fixtures/test/frontmatter_missing_desc.js
+0 −0 tools/lint/test/fixtures/test/frontmatter_module_FIXTURE.js
+0 −0 tools/lint/test/fixtures/test/frontmatter_module_with_meta_FIXTURE.js
+0 −0 tools/lint/test/fixtures/test/frontmatter_omitted.js
+0 −0 tools/lint/test/fixtures/test/frontmatter_unrecognized.js
+0 −0 tools/lint/test/fixtures/test/harness_features_missing.js
+0 −0 tools/lint/test/fixtures/test/harness_features_multiple_includes.js
+0 −0 tools/lint/test/fixtures/test/harness_features_partial.js
+0 −0 tools/lint/test/fixtures/test/harness_features_valid.js
+0 −0 tools/lint/test/fixtures/test/harness_verifyconfigurableproperty_invalid.js
+0 −0 tools/lint/test/fixtures/test/harness_verifyconfigurableproperty_valid.js
+0 −0 tools/lint/test/fixtures/test/includes_invalid_empty.js
+0 −0 tools/lint/test/fixtures/test/includes_invalid_noref.js
+0 −0 tools/lint/test/fixtures/test/includes_valid_direct.js
+0 −0 tools/lint/test/fixtures/test/includes_valid_indirect.js
+0 −0 tools/lint/test/fixtures/test/license_alternate_1.js
+0 −0 tools/lint/test/fixtures/test/license_alternate_2.js
+0 −0 tools/lint/test/fixtures/test/license_alternate_3.js
+0 −0 tools/lint/test/fixtures/test/license_alternate_4.js
+0 −0 tools/lint/test/fixtures/test/license_alternate_5.js
+0 −0 tools/lint/test/fixtures/test/license_generated.js
+0 −0 tools/lint/test/fixtures/test/license_invalid_year.js
+0 −0 tools/lint/test/fixtures/test/license_invalid_year_range.js
+0 −0 tools/lint/test/fixtures/test/license_missing.js
+0 −0 tools/lint/test/fixtures/test/negative_invalid_phase.js
+0 −0 tools/lint/test/fixtures/test/negative_missing_phase.js
+0 −0 tools/lint/test/fixtures/test/negative_missing_type.js
+0 −0 tools/lint/test/fixtures/test/negative_no_raw_stmt.js
+0 −0 tools/lint/test/fixtures/test/negative_no_raw_wrong_stmt.js
+0 −0 tools/lint/test/fixtures/test/negative_parse_throw_bad_value.js
+0 −0 tools/lint/test/fixtures/test/negative_parse_throw_missing.js
+0 −0 tools/lint/test/fixtures/test/negative_raw_call.js
+0 −0 tools/lint/test/fixtures/test/negative_raw_wrong_call.js
+0 −0 tools/lint/test/fixtures/test/negative_resolution_throw_bad_value.js
+0 −0 tools/lint/test/fixtures/test/negative_resolution_throw_missing.js
+0 −0 tools/lint/test/fixtures/test/negative_string.js
+0 −0 tools/lint/test/fixtures/test/negative_valid_parse.js
+0 −0 tools/lint/test/fixtures/test/negative_valid_resolution.js
+0 −0 tools/lint/test/fixtures/test/negative_valid_runtime.js
+0 −0 tools/lint/test/fixtures/test/valid_es5id.js
+0 −0 tools/lint/test/fixtures/test/valid_es6id.js
+0 −0 tools/lint/test/fixtures/test/valid_esid.js
+0 −0 tools/lint/test/fixtures/test/valid_esid_alternate.js
+2 −3 tools/lint/test/run.py
+1 −8 tools/scripts/ci_test.sh
1 change: 1 addition & 0 deletions test_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ flag:async

// Non-implemented features:
feature:TypedArray
feature:json-modules
//feature:generators
//feature:async-iteration
//feature:class
Expand Down

0 comments on commit ac99899

Please sign in to comment.