Skip to content

Commit 95ed11c

Browse files
andyleisersonErichDonGubler
authored andcommitted
test(cts): Make the CTS quieter by default
1 parent 194e4b4 commit 95ed11c

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

xtask/src/cts.rs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ pub fn run_cts(
6464
let skip_checkout = args.contains("--skip-checkout");
6565
let llvm_cov = args.contains("--llvm-cov");
6666
let release = args.contains("--release");
67+
let mut quiet = args.contains("--quiet");
68+
let verbose = args.contains("--verbose");
6769
let running_on_backend = args.opt_value_from_str::<_, String>("--backend")?;
6870
let mut filter_pattern = args.opt_value_from_str::<_, String>("--filter")?;
6971
let mut filter_invert = false;
@@ -109,6 +111,9 @@ pub fn run_cts(
109111
if passthrough_args.is_none() {
110112
log::info!("Reading default test list from {CTS_DEFAULT_TEST_LIST}");
111113
list_files.push(OsString::from(CTS_DEFAULT_TEST_LIST));
114+
115+
// Reduce output, unless `--verbose` was specified.
116+
quiet = !verbose;
112117
}
113118
} else if passthrough_args.is_some() {
114119
bail!("Test(s) and test list(s) are incompatible with passthrough arguments.");
@@ -304,7 +309,10 @@ pub fn run_cts(
304309
}
305310
}
306311

307-
log::info!("Running {}", test.selector.to_string_lossy());
312+
if !quiet {
313+
log::info!("Running {}", test.selector.to_string_lossy());
314+
}
315+
308316
let mut cmd = shell
309317
.cmd("cargo")
310318
.args(run_flags)
@@ -316,10 +324,31 @@ pub fn run_cts(
316324
cmd = cmd.arg("--release")
317325
}
318326

319-
cmd.args(["--", "./tools/run_deno", "--verbose"])
320-
.args([&test.selector])
321-
.run()
322-
.context("CTS failed")?;
327+
cmd = cmd
328+
.args(["--", "./tools/run_deno", "--verbose"])
329+
.args([&test.selector]);
330+
331+
if quiet {
332+
let output = cmd.ignore_status().output().context("Failed to run CTS")?;
333+
let stdout = String::from_utf8_lossy(&output.stdout);
334+
let stderr = String::from_utf8_lossy(&output.stderr);
335+
336+
if output.status.success() {
337+
if let Some((_, summary)) = stdout.split_once("** Summary **") {
338+
println!("\n== Summary for {} ==", test.selector.to_string_lossy());
339+
println!("{}", summary.trim());
340+
} else {
341+
print!("{}", stdout);
342+
eprint!("{}", stderr);
343+
}
344+
} else {
345+
print!("{}", stdout);
346+
eprint!("{}", stderr);
347+
bail!("CTS failed");
348+
}
349+
} else {
350+
cmd.run().context("CTS failed")?;
351+
}
323352
}
324353

325354
if tests.len() > 1 {

xtask/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Commands:
2222
cts [<options>] [<test selector...> | -f <test list file...> | -- <args...>]
2323
Check out, build, and run CTS tests
2424
25+
If no command-line arguments are specified, runs the default test list
26+
in `cts_runner/test.lst`, with quiet mode enabled.
27+
2528
--skip-checkout Don't check out the pinned CTS version, use whatever
2629
is already checked out.
2730
--release Build and run in release mode
@@ -31,6 +34,8 @@ Commands:
3134
--filter <regex> Filter tests by selector using a regex pattern.
3235
Prefix with '!' to invert (exclude matching tests).
3336
Applied after all tests are collected.
37+
--quiet Only show test counts for suites without failures.
38+
--verbose Show full output when running the default test list.
3439
3540
run-wasm
3641
Build and run web examples

0 commit comments

Comments
 (0)