plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
bc57276
— Peter John
2026-11-10T23:12:38+05:30
plum test: the default per-test deadline is 120 s
- compiler/cli/src/main.rs +8 -3
compiler/cli/src/main.rs
CHANGED
|
@@ -147,7 +147,7 @@ enum Command {
|
|
|
147
147
|
/// default: `.` when it holds `std`, else the repository plum was built from)
|
|
148
148
|
#[arg(long)]
|
|
149
149
|
lib_path: Option<std::path::PathBuf>,
|
|
150
|
-
/// Seconds one test may run before it fails as timed out (default: `PLUM_TEST_TIMEOUT`, else
|
|
150
|
+
/// Seconds one test may run before it fails as timed out (default: `PLUM_TEST_TIMEOUT`, else 120; 0 = no limit)
|
|
151
151
|
#[arg(long)]
|
|
152
152
|
timeout: Option<f64>,
|
|
153
153
|
/// Run only the tests whose name contains this text
|
|
@@ -478,14 +478,14 @@ fn collectPlumFiles(path: &std::path::Path) -> Result<Vec<std::path::PathBuf>> {
|
|
|
478
478
|
Ok(files)
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
/// How long one test may run: `--timeout`, else `PLUM_TEST_TIMEOUT`, else
|
|
481
|
+
/// How long one test may run: `--timeout`, else `PLUM_TEST_TIMEOUT`, else `DEFAULT_TEST_TIMEOUT`.
|
|
482
482
|
/// `None` (a limit of 0) means no limit.
|
|
483
483
|
fn testTimeout(flag: Option<f64>) -> Result<Option<std::time::Duration>> {
|
|
484
484
|
let secs = match flag {
|
|
485
485
|
Some(s) => s,
|
|
486
486
|
None => match std::env::var("PLUM_TEST_TIMEOUT") {
|
|
487
487
|
Ok(v) => v.trim().parse::<f64>().map_err(|_| anyhow::anyhow!("PLUM_TEST_TIMEOUT={v} is not a number of seconds"))?,
|
|
488
|
-
Err(_) =>
|
|
488
|
+
Err(_) => DEFAULT_TEST_TIMEOUT,
|
|
489
489
|
},
|
|
490
490
|
};
|
|
491
491
|
if !(secs >= 0.0 && secs.is_finite()) {
|
|
@@ -494,6 +494,11 @@ fn testTimeout(flag: Option<f64>) -> Result<Option<std::time::Duration>> {
|
|
|
494
494
|
Ok((secs > 0.0).then(|| std::time::Duration::from_secs_f64(secs)))
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
+
/// Seconds one test may run by default. The slowest test in the repository takes about 2 s
|
|
498
|
+
/// alone (debug build) and up to 20 times that while `test-all.sh` runs three sweeps at once
|
|
499
|
+
/// beside other checkouts' runs; a deadline is only there to stop a test that never ends.
|
|
500
|
+
const DEFAULT_TEST_TIMEOUT: f64 = 120.0;
|
|
501
|
+
|
|
497
502
|
/// The epoch tick of `plum test`'s engine: a test's deadline is counted in these.
|
|
498
503
|
const TEST_TICK: std::time::Duration = std::time::Duration::from_millis(50);
|
|
499
504
|
|