Fix mach test-wpt to make crash tests work (#29832)

* Fix `mach test-wpt` to make crash tests work

There are two issues related to crash tests:
1. test-wpt is unable to find existing crash tests even when
   called with --test-types=crashtests. The fix here is to
   add crashtests to the default test suite types to python/wpt/run.py
2. When running in headless mode, crashes in style threads
   don't cause servo to crash because the logic in constellation.rs
   currently calls handle_panic only when the top-level browsing
   context id is some value. Since style pool threads are shared,
   they always generate Panic messages with None as top-level
   browsing context id.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Send bactrace to stderr and capture it in test runner

Servo's panic hook writes backtraces to stdout. This
patch changes it so they are written to stderr.

The crash test executor for servo in WPT grouping formatter
was also not capturing the output correctly for crashtests
as the log events were being aggregated based on thread name
which doesn't seem to match correctly in case of crashtests.
This patch also fixes the log grouping logic to be based on
test name.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* crashtests: update expectations for layout 2020

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* crashtests: update expectations for layout 2013

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* remove outdated & intemittent test expectations

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2023-08-19 05:13:32 +05:30 committed by GitHub
parent b256a72448
commit 33fa49c8ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
102 changed files with 221 additions and 53 deletions

View file

@ -1484,11 +1484,10 @@ where
// Panic a top level browsing context. // Panic a top level browsing context.
FromCompositorMsg::SendError(top_level_browsing_context_id, error) => { FromCompositorMsg::SendError(top_level_browsing_context_id, error) => {
debug!("constellation got SendError message"); debug!("constellation got SendError message");
if let Some(id) = top_level_browsing_context_id { if top_level_browsing_context_id.is_none() {
self.handle_panic(id, error, None);
} else {
warn!("constellation got a SendError message without top level id"); warn!("constellation got a SendError message without top level id");
} }
self.handle_panic(top_level_browsing_context_id, error, None);
}, },
// Send frame tree to WebRender. Make it visible. // Send frame tree to WebRender. Make it visible.
FromCompositorMsg::SelectBrowser(top_level_browsing_context_id) => { FromCompositorMsg::SelectBrowser(top_level_browsing_context_id) => {
@ -2752,15 +2751,13 @@ where
.pipelines .pipelines
.get(&pipeline_id) .get(&pipeline_id)
.map(|pipeline| pipeline.top_level_browsing_context_id); .map(|pipeline| pipeline.top_level_browsing_context_id);
if let Some(top_level_browsing_context_id) = top_level_browsing_context_id { let reason = format!("Send failed ({})", err);
let reason = format!("Send failed ({})", err); self.handle_panic(top_level_browsing_context_id, reason, None);
self.handle_panic(top_level_browsing_context_id, reason, None);
}
} }
fn handle_panic( fn handle_panic(
&mut self, &mut self,
top_level_browsing_context_id: TopLevelBrowsingContextId, top_level_browsing_context_id: Option<TopLevelBrowsingContextId>,
reason: String, reason: String,
backtrace: Option<String>, backtrace: Option<String>,
) { ) {
@ -2771,6 +2768,11 @@ where
process::exit(1); process::exit(1);
} }
let top_level_browsing_context_id = match top_level_browsing_context_id {
Some(id) => id,
None => return,
};
debug!( debug!(
"Panic handler for top-level browsing context {}: {}.", "Panic handler for top-level browsing context {}: {}.",
top_level_browsing_context_id, reason top_level_browsing_context_id, reason
@ -2852,13 +2854,16 @@ where
entry: LogEntry, entry: LogEntry,
) { ) {
debug!("Received log entry {:?}.", entry); debug!("Received log entry {:?}.", entry);
match (entry, top_level_browsing_context_id) { if let LogEntry::Panic(ref reason, ref backtrace) = entry {
(LogEntry::Panic(reason, backtrace), Some(top_level_browsing_context_id)) => { self.handle_panic(
self.handle_panic(top_level_browsing_context_id, reason, Some(backtrace)); top_level_browsing_context_id,
}, reason.clone(),
(LogEntry::Panic(reason, _), _) | Some(backtrace.clone()),
(LogEntry::Error(reason), _) | );
(LogEntry::Warn(reason), _) => { }
match entry {
LogEntry::Panic(reason, _) | LogEntry::Error(reason) | LogEntry::Warn(reason) => {
// VecDeque::truncate is unstable // VecDeque::truncate is unstable
if WARNINGS_BUFFER_SIZE <= self.handled_warnings.len() { if WARNINGS_BUFFER_SIZE <= self.handled_warnings.len() {
self.handled_warnings.pop_front(); self.handled_warnings.pop_front();

View file

@ -117,11 +117,11 @@ pub fn main() {
}; };
let current_thread = thread::current(); let current_thread = thread::current();
let name = current_thread.name().unwrap_or("<unnamed>"); let name = current_thread.name().unwrap_or("<unnamed>");
let stdout = std::io::stdout(); let stderr = std::io::stderr();
let mut stdout = stdout.lock(); let mut stderr = stderr.lock();
if let Some(location) = info.location() { if let Some(location) = info.location() {
let _ = writeln!( let _ = writeln!(
&mut stdout, &mut stderr,
"{} (thread {}, at {}:{})", "{} (thread {}, at {}:{})",
msg, msg,
name, name,
@ -129,12 +129,16 @@ pub fn main() {
location.line() location.line()
); );
} else { } else {
let _ = writeln!(&mut stdout, "{} (thread {})", msg, name); let _ = writeln!(&mut stderr, "{} (thread {})", msg, name);
} }
if env::var("RUST_BACKTRACE").is_ok() { if env::var("RUST_BACKTRACE").is_ok() {
let _ = backtrace::print(&mut stdout); let _ = backtrace::print(&mut stderr);
}
drop(stderr);
if opts::get().hard_fail && !opts::get().multiprocess {
std::process::exit(1);
} }
drop(stdout);
error!("{}", msg); error!("{}", msg);
})); }));

View file

@ -216,10 +216,8 @@ class ServoHandler(mozlog.reader.LogHandler):
)) ))
def process_output(self, data): def process_output(self, data):
if data['thread'] not in self.running_tests: if 'test' in data:
return self.test_output[data['test']] += data['data'] + "\n"
test_name = self.running_tests[data['thread']]
self.test_output[test_name] += data['data'] + "\n"
def log(self, _): def log(self, _):
pass pass

View file

@ -86,7 +86,7 @@ def run_tests(default_binary_path: str, **kwargs):
if not kwargs.get("no_default_test_types"): if not kwargs.get("no_default_test_types"):
test_types = { test_types = {
"servo": ["testharness", "reftest", "wdspec"], "servo": ["testharness", "reftest", "wdspec", "crashtest"],
"servodriver": ["testharness", "reftest"], "servodriver": ["testharness", "reftest"],
} }
product = kwargs.get("product") or "servo" product = kwargs.get("product") or "servo"

View file

@ -0,0 +1,2 @@
[contain-size-layout-abspos-flex-container-crash.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[background-image-alpha.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[background-image-multiple.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[background-repeat-x.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[column-count-crash.https.html]
expected: CRASH

View file

@ -1,2 +1,2 @@
[custom-property-animation-on-main-thread.https.html] [custom-property-animation-on-main-thread.https.html]
expected: FAIL expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-background-image-001.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-background-image-002.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-background-image-tiled-001.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-background-image-tiled-002.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-background-image-tiled-003.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-border-image-001.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-border-image-002.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-border-image-003.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-border-image-004.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[geometry-border-image-005.https.html]
expected: CRASH

View file

@ -1,3 +1,3 @@
[geometry-with-float-size.https.html] [geometry-with-float-size.https.html]
type: reftest type: reftest
expected: FAIL expected: CRASH

View file

@ -1,2 +1,2 @@
[canvas-transform.https.html] [canvas-transform.https.html]
expected: FAIL expected: CRASH

View file

@ -1,3 +1,3 @@
[device-pixel-ratio.https.html] [device-pixel-ratio.https.html]
type: reftest type: reftest
expected: FAIL expected: CRASH

View file

@ -0,0 +1,2 @@
[invalid-image-constructor-error.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[invalid-image-paint-error.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[invalid-image-pending-script.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[non-registered-property-value.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[overdraw.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint-arguments.https.html]
expected: CRASH

View file

@ -1,2 +1,2 @@
[paint-function-arguments-var.https.html] [paint-function-arguments-var.https.html]
expected: FAIL expected: CRASH

View file

@ -0,0 +1,2 @@
[paint-function-arguments.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint-function-this-value.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-canvasFilter.tentative.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-composite.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-conicGradient.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-filter.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-gradient.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-image.https.html]
expected: CRASH

View file

@ -1,4 +1,4 @@
[paint2d-paths.https.html] [paint2d-paths.https.html]
type: reftest type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/17597 bug: https://github.com/servo/servo/issues/17597
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-rects.https.html]
expected: CRASH

View file

@ -1,2 +1,2 @@
[paint2d-reset.https.html] [paint2d-reset.https.html]
expected: FAIL expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-roundRect.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-shadows.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[paint2d-transform.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-001.https.html]
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-002.https.html] [parse-input-arguments-002.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-003.https.html] [parse-input-arguments-003.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-004.https.html]
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-005.https.html] [parse-input-arguments-005.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-006.https.html] [parse-input-arguments-006.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-007.https.html]
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-008.https.html] [parse-input-arguments-008.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-009.https.html] [parse-input-arguments-009.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-010.https.html] [parse-input-arguments-010.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-011.https.html] [parse-input-arguments-011.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-012.https.html] [parse-input-arguments-012.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-013.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-014.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-015.https.html]
expected: CRASH

View file

@ -1,3 +1,4 @@
[parse-input-arguments-016.https.html] [parse-input-arguments-016.https.html]
type: reftest type: reftest
bug: https://github.com/servo/servo/issues/17852 bug: https://github.com/servo/servo/issues/17852
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-017.https.html]
expected: CRASH

View file

@ -1,3 +1,3 @@
[parse-input-arguments-018.https.html] [parse-input-arguments-018.https.html]
type: reftest type: reftest
expected: FAIL expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-019.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-020.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-021.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[parse-input-arguments-022.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[roundrect.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[setTransform-001.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[setTransform-002.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[setTransform-003.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[setTransform-004.https.html]
expected: CRASH

View file

@ -1,4 +1,4 @@
[style-background-image.https.html] [style-background-image.https.html]
type: reftest type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/17378 bug: https://github.com/servo/servo/issues/17378
expected: CRASH

View file

@ -1,4 +1,4 @@
[style-before-pseudo.https.html] [style-before-pseudo.https.html]
type: reftest type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/17854 bug: https://github.com/servo/servo/issues/17854
expected: CRASH

View file

@ -1,4 +1,4 @@
[style-first-letter-pseudo.https.html] [style-first-letter-pseudo.https.html]
type: reftest type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/17854 bug: https://github.com/servo/servo/issues/17854
expected: CRASH

View file

@ -0,0 +1,2 @@
[valid-image-after-load.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[valid-image-before-load.https.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[overlay-popover-backdrop-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[ellisize-rtl-text-crash.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[client-props-root-display-none-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[broken-reference-crash-001.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[chrome-1312699.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[input-form-detach-style-crash.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[popover-dialog-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[popover-hint-crash.tentative.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[popover-manual-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[cycle-without-delay.html]
expected: CRASH

View file

@ -465041,7 +465041,7 @@
[] []
], ],
"executorservo.py": [ "executorservo.py": [
"a8ec38699616c5baf7a3b43b8149b89746308f35", "3250c74ff4397d229e370a8c317b0e2a269dc9a8",
[] []
], ],
"executorservodriver.py": [ "executorservodriver.py": [

View file

@ -0,0 +1,2 @@
[overlay-popover-backdrop-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[ellisize-rtl-text-crash.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[preserve3d-scene-001.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[preserve3d-scene-002.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[broken-reference-crash-001.html]
expected: TIMEOUT

View file

@ -1,8 +1,5 @@
[element-img-environment-change.sub.html] [element-img-environment-change.sub.html]
expected: TIMEOUT expected: TIMEOUT
[sec-fetch-site - Not sent to non-trustworthy same-origin destination, no attributes]
expected: FAIL
[sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes] [sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes]
expected: TIMEOUT expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[chrome-1312699.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[popover-dialog-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[popover-hint-crash.tentative.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[popover-manual-crash.html]
expected: TIMEOUT

View file

@ -0,0 +1,2 @@
[cycle-without-delay.html]
expected: CRASH

View file

@ -0,0 +1,2 @@
[test_paint_worklet.html]
expected: CRASH

View file

@ -1,3 +1,3 @@
[test_paint_worklet_size.html] [test_paint_worklet_size.html]
type: reftest type: reftest
expected: FAIL expected: CRASH

Some files were not shown because too many files have changed in this diff Show more