Skip to content

Commit daee58c

Browse files
authored
Rollup merge of rust-lang#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`
2 parents 5387b24 + 6a66b79 commit daee58c

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/bootstrap/test.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ impl Step for RustdocGUI {
805805

806806
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
807807
let builder = run.builder;
808-
let run = run.path("src/test/rustdoc-gui");
808+
let run = run.suite_path("src/test/rustdoc-gui");
809809
run.default_condition(
810810
builder.config.nodejs.is_some()
811811
&& builder
@@ -870,6 +870,13 @@ impl Step for RustdocGUI {
870870
.arg(out_dir)
871871
.arg("--tests-folder")
872872
.arg(builder.build.src.join("src/test/rustdoc-gui"));
873+
for path in &builder.paths {
874+
if let Some(name) = path.file_name().and_then(|f| f.to_str()) {
875+
if name.ends_with(".goml") {
876+
command.arg("--file").arg(name);
877+
}
878+
}
879+
}
873880
builder.run(&mut command);
874881
}
875882
}

src/tools/rustdoc-gui/tester.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {Options, runTest} = require('browser-ui-test');
1010
function showHelp() {
1111
console.log("rustdoc-js options:");
1212
console.log(" --doc-folder [PATH] : location of the generated doc folder");
13+
console.log(" --file [PATH] : file to run (can be repeated)");
1314
console.log(" --help : show this message then quit");
1415
console.log(" --tests-folder [PATH] : location of the .GOML tests folder");
1516
}
@@ -18,6 +19,7 @@ function parseOptions(args) {
1819
var opts = {
1920
"doc_folder": "",
2021
"tests_folder": "",
22+
"files": [],
2123
};
2224
var correspondances = {
2325
"--doc-folder": "doc_folder",
@@ -26,13 +28,18 @@ function parseOptions(args) {
2628

2729
for (var i = 0; i < args.length; ++i) {
2830
if (args[i] === "--doc-folder"
29-
|| args[i] === "--tests-folder") {
31+
|| args[i] === "--tests-folder"
32+
|| args[i] === "--file") {
3033
i += 1;
3134
if (i >= args.length) {
3235
console.log("Missing argument after `" + args[i - 1] + "` option.");
3336
return null;
3437
}
35-
opts[correspondances[args[i - 1]]] = args[i];
38+
if (args[i - 1] !== "--file") {
39+
opts[correspondances[args[i - 1]]] = args[i];
40+
} else {
41+
opts["files"].push(args[i]);
42+
}
3643
} else if (args[i] === "--help") {
3744
showHelp();
3845
process.exit(0);
@@ -78,7 +85,12 @@ async function main(argv) {
7885
}
7986

8087
let failed = false;
81-
let files = fs.readdirSync(opts["tests_folder"]).filter(file => path.extname(file) == ".goml");
88+
let files;
89+
if (opts["files"].length === 0) {
90+
files = fs.readdirSync(opts["tests_folder"]).filter(file => path.extname(file) == ".goml");
91+
} else {
92+
files = opts["files"].filter(file => path.extname(file) == ".goml");
93+
}
8294

8395
files.sort();
8496
for (var i = 0; i < files.length; ++i) {

0 commit comments

Comments
 (0)