diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-06-22 07:37:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-22 07:37:48 +0900 |
| commit | 7dca2e276df7f2babce704f9b757bcfdb788fee1 (patch) | |
| tree | f93eb03573978b1d2553dfd0764d47ae40042c81 | |
| parent | 7ee6b8bc439501e8690af80b9995aa53c856e9e8 (diff) | |
| parent | 95c1bf60005085a5c83cc63b33319d6b484a704a (diff) | |
| download | rust-7dca2e276df7f2babce704f9b757bcfdb788fee1.tar.gz rust-7dca2e276df7f2babce704f9b757bcfdb788fee1.zip | |
Rollup merge of #86297 - GuillaumeGomez:rustdoc-gui-args, r=Mark-Simulacrum
Allow to pass arguments to rustdoc-gui tool Very convenient for testing. This is another part of https://github.com/rust-lang/rust/pull/86293 cc ``@jsha`` r? ``@Mark-Simulacrum``
| -rw-r--r-- | src/bootstrap/test.rs | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/README.md | 12 | ||||
| m--------- | src/tools/rust-analyzer | 35 | ||||
| -rw-r--r-- | src/tools/rustdoc-gui/tester.js | 32 |
4 files changed, 57 insertions, 25 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 93ba8b07f5b..92ac3b364f6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -894,6 +894,9 @@ impl Step for RustdocGUI { } } } + for test_arg in builder.config.cmd.test_args() { + command.arg(test_arg); + } builder.run(&mut command); } } diff --git a/src/test/rustdoc-gui/README.md b/src/test/rustdoc-gui/README.md index 499a98a3d22..8efe7a578b8 100644 --- a/src/test/rustdoc-gui/README.md +++ b/src/test/rustdoc-gui/README.md @@ -8,5 +8,17 @@ test what's being currently displayed in the web page. You can find more information and its documentation in its [repository][browser-ui-test]. +If you need to have more information on the tests run, you can use `--test-args`: + +```bash +$ ./x.py test src/test/rustdoc-gui --stage 1 --jobs 8 --test-args --debug +``` + +There are three options supported: + + * `--debug`: allows to see puppeteer commands. + * `--no-headless`: disable headless mode so you can see what's going on. + * `--show-text`: by default, text isn't rendered because of issues with fonts, it enables it back. + [browser-ui-test]: https://github.com/GuillaumeGomez/browser-UI-test/ [puppeteer]: https://pptr.dev/ diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer -Subproject f0618a8f06a464840079f30b3e25bcdcca3922a +Subproject 13da28cc2bc1b59f7af817eca36927a71edb023 diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index 8c8d86d5e38..416d824c564 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -11,6 +11,9 @@ function showHelp() { console.log("rustdoc-js options:"); console.log(" --doc-folder [PATH] : location of the generated doc folder"); console.log(" --file [PATH] : file to run (can be repeated)"); + console.log(" --debug : show extra information about script run"); + console.log(" --show-text : render font in pages"); + console.log(" --no-headless : disable headless mode"); console.log(" --help : show this message then quit"); console.log(" --tests-folder [PATH] : location of the .GOML tests folder"); } @@ -20,10 +23,16 @@ function parseOptions(args) { "doc_folder": "", "tests_folder": "", "files": [], + "debug": false, + "show_text": false, + "no_headless": false, }; var correspondances = { "--doc-folder": "doc_folder", "--tests-folder": "tests_folder", + "--debug": "debug", + "--show-text": "show_text", + "--no-headless": "no_headless", }; for (var i = 0; i < args.length; ++i) { @@ -43,6 +52,8 @@ function parseOptions(args) { } else if (args[i] === "--help") { showHelp(); process.exit(0); + } else if (correspondances[args[i]]) { + opts[correspondances[args[i]]] = true; } else { console.log("Unknown option `" + args[i] + "`."); console.log("Use `--help` to see the list of options"); @@ -68,17 +79,20 @@ async function main(argv) { const options = new Options(); try { // This is more convenient that setting fields one by one. - options.parseArguments([ + let args = [ "--no-screenshot", - // This option shows what puppeteer "code" is run - // "--debug", - // This option disable the headless mode, allowing you to see what's going on. - // "--no-headless", - // The text isn't rendered by default because of a lot of small differences - // between hosts. - // "--show-text", "--variable", "DOC_PATH", opts["doc_folder"], - ]); + ]; + if (opts["debug"]) { + args.push("--debug"); + } + if (opts["show_text"]) { + args.push("--show-text"); + } + if (opts["no_headless"]) { + args.push("--no-headless"); + } + options.parseArguments(args); } catch (error) { console.error(`invalid argument: ${error}`); process.exit(1); |
