From 9109491a380f202b6c8e30d00f0bfcdf2987516f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Juli=C3=A1n=20Espina?= Date: Fri, 16 Feb 2024 14:19:00 +0000 Subject: [PATCH] Consider strict + no-strict tests as a single test (#3675) --- test262_config.toml | 2 +- tests/tester/src/exec/mod.rs | 39 ++++++++++++++++++++---------------- tests/tester/src/main.rs | 2 -- tests/tester/src/results.rs | 9 ++------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/test262_config.toml b/test262_config.toml index d2b721243f..ea717923d1 100644 --- a/test262_config.toml +++ b/test262_config.toml @@ -1,4 +1,4 @@ -commit = "f742eb092df835fd07769bbb3537232d3efb61ed" +commit = "6f7ae1f311a7b01ef2358de7f4f6fd42c3ae3839" [ignored] # Not implemented yet: diff --git a/tests/tester/src/exec/mod.rs b/tests/tester/src/exec/mod.rs index b3301a15f4..f57d55aff8 100644 --- a/tests/tester/src/exec/mod.rs +++ b/tests/tester/src/exec/mod.rs @@ -73,13 +73,13 @@ impl TestSuite { self.tests .par_iter() .filter(|test| test.edition <= max_edition) - .flat_map(|test| test.run(harness, verbose, optimizer_options, console)) + .map(|test| test.run(harness, verbose, optimizer_options, console)) .collect() } else { self.tests .iter() .filter(|test| test.edition <= max_edition) - .flat_map(|test| test.run(harness, verbose, optimizer_options, console)) + .map(|test| test.run(harness, verbose, optimizer_options, console)) .collect() }; @@ -168,21 +168,29 @@ impl Test { verbose: u8, optimizer_options: OptimizerOptions, console: bool, - ) -> Vec { - let mut results = Vec::new(); - if self.flags.contains(TestFlags::MODULE) { - results.push(self.run_once(harness, false, verbose, optimizer_options, console)); - } else { - if self.flags.contains(TestFlags::STRICT) && !self.flags.contains(TestFlags::RAW) { - results.push(self.run_once(harness, true, verbose, optimizer_options, console)); - } + ) -> TestResult { + if self.flags.contains(TestFlags::MODULE) || self.flags.contains(TestFlags::RAW) { + return self.run_once(harness, false, verbose, optimizer_options, console); + } - if self.flags.contains(TestFlags::NO_STRICT) || self.flags.contains(TestFlags::RAW) { - results.push(self.run_once(harness, false, verbose, optimizer_options, console)); + if self + .flags + .contains(TestFlags::STRICT | TestFlags::NO_STRICT) + { + let r = self.run_once(harness, false, verbose, optimizer_options, console); + if r.result != TestOutcomeResult::Passed { + return r; } + self.run_once(harness, true, verbose, optimizer_options, console) + } else { + self.run_once( + harness, + self.flags.contains(TestFlags::STRICT), + verbose, + optimizer_options, + console, + ) } - - results } /// Runs the test once, in strict or non-strict mode @@ -208,7 +216,6 @@ impl Test { return TestResult { name: self.name.clone(), edition: self.edition, - strict, result: TestOutcomeResult::Failed, result_text: Box::from("Could not read test file."), }; @@ -227,7 +234,6 @@ impl Test { return TestResult { name: self.name.clone(), edition: self.edition, - strict, result: TestOutcomeResult::Ignored, result_text: Box::default(), }; @@ -579,7 +585,6 @@ impl Test { TestResult { name: self.name.clone(), edition: self.edition, - strict, result, result_text: result_text.into_boxed_str(), } diff --git a/tests/tester/src/main.rs b/tests/tester/src/main.rs index 792f26d471..8c703f176f 100644 --- a/tests/tester/src/main.rs +++ b/tests/tester/src/main.rs @@ -765,8 +765,6 @@ struct TestResult { name: Box, #[serde(rename = "v", default)] edition: SpecEdition, - #[serde(rename = "s", default)] - strict: bool, #[serde(skip)] result_text: Box, #[serde(rename = "r")] diff --git a/tests/tester/src/results.rs b/tests/tester/src/results.rs index 13f5779448..12600d1ca1 100644 --- a/tests/tester/src/results.rs +++ b/tests/tester/src/results.rs @@ -461,17 +461,12 @@ fn compute_result_diff( if let Some(new_test) = new_result .tests .iter() - .find(|new_test| new_test.strict == base_test.strict && new_test.name == base_test.name) + .find(|new_test| new_test.name == base_test.name) { let test_name = format!( - "test/{}/{}.js {}(previously {:?})", + "test/{}/{}.js (previously {:?})", base.display(), new_test.name, - if base_test.strict { - "[strict mode] " - } else { - "" - }, base_test.result ) .into_boxed_str();