Skip to content

Commit f583bf6

Browse files
authored
Rollup merge of rust-lang#100403 - GuillaumeGomez:improve-messages, r=jsha
Improve error messages when running rustdoc GUI tests There was already a message on how to install `browser-ui-test`, so nothing to be done there. However, we didn't show how to update its version, so the first commit adds it. Another pain point was how to fix the unexpected crash in `browser-ui-test` (because of a missing `--no-sandbox`, still no idea why it became mandatory a few months ago on some linux distributions...). It now looks like this: ```console Running 1 rustdoc-gui (8 concurrently) ... ERROR: puppeteer failed when trying to create a new page. Please try again with `--no-sandbox` `browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args --no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox` Build completed unsuccessfully in 0:00:03 ``` Thanks to `@jsha` for suggesting these improvements! r? `@jsha`
2 parents 7ecc892 + 46af79c commit f583bf6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/bootstrap/test.rs

+5
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,11 @@ fn compare_browser_ui_test_version(installed_version: &str, src: &Path) {
924924
one used in the CI (`{}`)",
925925
installed_version, v
926926
);
927+
eprintln!(
928+
"You can install this version using `npm update browser-ui-test` or by using \
929+
`npm install browser-ui-test@{}`",
930+
v,
931+
);
927932
}
928933
}
929934
Err(e) => eprintln!("Couldn't find the CI browser-ui-test version: {:?}", e),

src/tools/rustdoc-gui/tester.js

+16
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ async function main(argv) {
201201
process.setMaxListeners(opts["jobs"] + 1);
202202
}
203203

204+
// We catch this "event" to display a nicer message in case of unexpected exit (because of a
205+
// missing `--no-sandbox`).
206+
const exitHandling = (code) => {
207+
if (!opts["no_sandbox"]) {
208+
console.log("");
209+
console.log(
210+
"`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args \
211+
--no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`");
212+
console.log("");
213+
}
214+
};
215+
process.on('exit', exitHandling);
216+
204217
const tests_queue = [];
205218
let results = {
206219
successful: [],
@@ -247,6 +260,9 @@ async function main(argv) {
247260
}
248261
status_bar.finish();
249262

263+
// We don't need this listener anymore.
264+
process.removeListener("exit", exitHandling);
265+
250266
if (debug) {
251267
results.successful.sort(by_filename);
252268
results.successful.forEach(r => {

0 commit comments

Comments
 (0)