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`
This commit is contained in:
Yuki Okushi 2021-06-16 13:31:11 +09:00 committed by GitHub
commit daee58cab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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) {