mutants-gui timeout 300 s (tests compete with other mutants' builds); read_only test restores permissions on failure and sweeps leftovers from killed runs
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
1 parent
122fed0a7a
commit
8ac4e5438d
2 files changed
+33
-1
No files matched your search
@@ -67,8 +67,39 @@ fn set_read_only(root: &Path, read_only: bool) {
|
|||||||
walk(root, read_only);
|
walk(root, read_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Makes the books writable again when dropped, so a failing or
|
||||||
|
/// interrupted run never leaves a folder no one can delete.
|
||||||
|
struct Writable(PathBuf);
|
||||||
|
impl Drop for Writable {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if self.0.exists() {
|
||||||
|
set_read_only(&self.0, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Folders left read-only by a killed run (no destructor ran): made
|
||||||
|
/// writable and removed once their process is gone.
|
||||||
|
fn sweep_leftovers() {
|
||||||
|
let Ok(entries) = std::fs::read_dir(std::env::temp_dir()) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for e in entries.flatten() {
|
||||||
|
let name = e.file_name().to_string_lossy().to_string();
|
||||||
|
let Some(pid) = name.strip_prefix("ledger-gui-ro-") else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if Path::new("/proc").join(pid).exists() {
|
||||||
|
continue; // still running (or the pid was reused): leave it
|
||||||
|
}
|
||||||
|
set_read_only(&e.path(), false);
|
||||||
|
let _ = std::fs::remove_dir_all(e.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_viewer_never_writes_into_the_books() {
|
fn the_viewer_never_writes_into_the_books() {
|
||||||
|
sweep_leftovers();
|
||||||
let dir = std::env::temp_dir().join(format!("ledger-gui-ro-{}", std::process::id()));
|
let dir = std::env::temp_dir().join(format!("ledger-gui-ro-{}", std::process::id()));
|
||||||
if dir.exists() {
|
if dir.exists() {
|
||||||
set_read_only(&dir, false);
|
set_read_only(&dir, false);
|
||||||
@@ -81,6 +112,7 @@ fn the_viewer_never_writes_into_the_books() {
|
|||||||
books_toml: Some(dir.join("wanderbooks.toml")),
|
books_toml: Some(dir.join("wanderbooks.toml")),
|
||||||
today: Some(today),
|
today: Some(today),
|
||||||
};
|
};
|
||||||
|
let _restore = Writable(dir.clone());
|
||||||
set_read_only(&dir, true);
|
set_read_only(&dir, true);
|
||||||
let before = tree(&dir);
|
let before = tree(&dir);
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ mutants-mcp:
|
|||||||
# spec-tested, not swept.
|
# spec-tested, not swept.
|
||||||
mutants-gui:
|
mutants-gui:
|
||||||
mkdir -p {{mutants_tmp}}
|
mkdir -p {{mutants_tmp}}
|
||||||
PROPTEST_MAX_SHRINK_ITERS=0 TMPDIR={{mutants_tmp}} cargo mutants -p ledger-gui --test-package ledger-gui -j 4 --timeout 60 -o mutants-gui -f crates/ledger-gui/src/books.rs -f crates/ledger-gui/src/fmt.rs -- --lib --test spec_gui
|
PROPTEST_MAX_SHRINK_ITERS=0 TMPDIR={{mutants_tmp}} cargo mutants -p ledger-gui --test-package ledger-gui -j 4 --timeout 300 -o mutants-gui -f crates/ledger-gui/src/books.rs -f crates/ledger-gui/src/fmt.rs -- --lib --test spec_gui
|
||||||
|
|
||||||
# Benchmarks of the core's hot paths (no budget gates them yet)
|
# Benchmarks of the core's hot paths (no budget gates them yet)
|
||||||
bench:
|
bench:
|
||||||
|
|||||||
Reference in new issue
Block a user