mirror of
https://github.com/servo/servo.git
synced 2025-09-23 13:20:11 +01:00
#38614 was reverted due to CI flakiness, but it also included several improvements to the devtools tests. this patch relands those improvements, described below. we make three changes that speed up the devtools tests from 73 → 65 → 56 → 51 seconds: - we replace the hardcoded sleep(1) after starting servoshell with a loop that waits until the devtools port is open (this also fixes intermittent failures when servoshell starts too slowly, especially on macOS) - we start the internal web servers once, and reuse them across all tests - we run servoshell in headless mode (this is also required because most CI runners have no GUI) and we fix two bugs that cause very noisy but not very interesting error messages: - in the test code, we use a [context manager](https://docs.python.org/3/reference/datamodel.html#context-managers) to ensure the devtools client is disconnected unconditionally, even if test methods or assert helper methods raise exceptions (this was causing errors on all platforms) - in the devtools server, we treat “connection reset” errors when reading from the client like a normal EOF, rather than as a failure (this was causing errors on Windows) on self-hosted linux builds, there are still spurious error messages like the following, but we can fix them later: ``` error: XDG_RUNTIME_DIR not set in the environment. libEGL warning: egl: failed to create dri2 screen ``` Testing: this patch improves the devtools tests, but does not change their coverage Fixes: part of #36325 --------- Signed-off-by: Delan Azabani <dazabani@igalia.com> Signed-off-by: atbrakhi <atbrakhi@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
parent
476c501de7
commit
7aad72838a
3 changed files with 279 additions and 233 deletions
|
@ -5,7 +5,7 @@
|
|||
//! Low-level wire protocol implementation. Currently only supports
|
||||
//! [JSON packets](https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#json-packets).
|
||||
|
||||
use std::io::{Read, Write};
|
||||
use std::io::{ErrorKind, Read, Write};
|
||||
use std::net::TcpStream;
|
||||
|
||||
use log::debug;
|
||||
|
@ -49,7 +49,8 @@ impl JsonPacketStream for TcpStream {
|
|||
loop {
|
||||
let mut buf = [0];
|
||||
let byte = match self.read(&mut buf) {
|
||||
Ok(0) => return Ok(None), // EOF
|
||||
Ok(0) => return Ok(None), // EOF
|
||||
Err(e) if e.kind() == ErrorKind::ConnectionReset => return Ok(None), // EOF
|
||||
Ok(1) => buf[0],
|
||||
Ok(_) => unreachable!(),
|
||||
Err(e) => return Err(e.to_string()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue