diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-06-16 13:31:11 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-16 13:31:11 +0900 |
| commit | daee58cab824318ae49ad6f1c8b57684c770d8b9 (patch) | |
| tree | 8c97045e3c4cc759e518d549ae49fb6be15b5cf8 | |
| parent | 5387b2444f874082b378ef74831ae69853dab0f0 (diff) | |
| parent | 6a66b79fb6b85f01aeaa1cd339160957a98c97a6 (diff) | |
| download | rust-daee58cab824318ae49ad6f1c8b57684c770d8b9.tar.gz rust-daee58cab824318ae49ad6f1c8b57684c770d8b9.zip | |
Rollup merge of #86293 - GuillaumeGomez:filter-gui-tests-run, r=jsha
Allow to run only a few GUI tests It allows to specify only one (or more) GUI tests. Considering the tests are not super fast to run, this is very useful for development. cc `@Mark-Simulacrum` r? `@jsha`
| -rw-r--r-- | src/bootstrap/test.rs | 9 | ||||
| -rw-r--r-- | src/tools/rustdoc-gui/tester.js | 18 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index fe4666effe6..0b7a0e25df1 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -805,7 +805,7 @@ impl Step for RustdocGUI { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; - let run = run.path("src/test/rustdoc-gui"); + let run = run.suite_path("src/test/rustdoc-gui"); run.default_condition( builder.config.nodejs.is_some() && builder @@ -870,6 +870,13 @@ impl Step for RustdocGUI { .arg(out_dir) .arg("--tests-folder") .arg(builder.build.src.join("src/test/rustdoc-gui")); + for path in &builder.paths { + if let Some(name) = path.file_name().and_then(|f| f.to_str()) { + if name.ends_with(".goml") { + command.arg("--file").arg(name); + } + } + } builder.run(&mut command); } } diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index c55e014e834..8c8d86d5e38 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -10,6 +10,7 @@ const {Options, runTest} = require('browser-ui-test'); 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(" --help : show this message then quit"); console.log(" --tests-folder [PATH] : location of the .GOML tests folder"); } @@ -18,6 +19,7 @@ function parseOptions(args) { var opts = { "doc_folder": "", "tests_folder": "", + "files": [], }; var correspondances = { "--doc-folder": "doc_folder", @@ -26,13 +28,18 @@ function parseOptions(args) { for (var i = 0; i < args.length; ++i) { if (args[i] === "--doc-folder" - || args[i] === "--tests-folder") { + || args[i] === "--tests-folder" + || args[i] === "--file") { i += 1; if (i >= args.length) { console.log("Missing argument after `" + args[i - 1] + "` option."); return null; } - opts[correspondances[args[i - 1]]] = args[i]; + if (args[i - 1] !== "--file") { + opts[correspondances[args[i - 1]]] = args[i]; + } else { + opts["files"].push(args[i]); + } } else if (args[i] === "--help") { showHelp(); process.exit(0); @@ -78,7 +85,12 @@ async function main(argv) { } let failed = false; - let files = fs.readdirSync(opts["tests_folder"]).filter(file => path.extname(file) == ".goml"); + let files; + if (opts["files"].length === 0) { + files = fs.readdirSync(opts["tests_folder"]).filter(file => path.extname(file) == ".goml"); + } else { + files = opts["files"].filter(file => path.extname(file) == ".goml"); + } files.sort(); for (var i = 0; i < files.length; ++i) { |
