Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(scripts): refuse a benchmark fixture that overlaps the work directory
Marcos Daniel Rivera Gonzalez2858f64ee314
diff --git a/scripts/capbench.py b/scripts/capbench.pyindex 12f072b1a..1decfcd06 100644--- a/scripts/capbench.py+++ b/scripts/capbench.py@@ -602,6 +602,8 @@ def cmd_run(args):out_root = Path(args.out).resolve()work = out_root / "work"+ if ctx.source_fixture.is_relative_to(work) or work.is_relative_to(ctx.source_fixture):+ sys.exit(f"--fixture {ctx.source_fixture} and the work directory {work} overlap; the work directory is deleted before each run")for _, bin_dir in variants:ctx.bin_dir = Path(bin_dir).resolve()try:diff --git a/scripts/test-capbench.py b/scripts/test-capbench.pyindex d38d5fa8b..d6b60c01c 100644--- a/scripts/test-capbench.py+++ b/scripts/test-capbench.py@@ -3,6 +3,7 @@ import importlib.utilimport jsonfrom pathlib import Pathimport sys+import tempfilefrom types import SimpleNamespaceimport unittest@@ -98,6 +99,19 @@ class CapbenchTests(unittest.TestCase):clean = DECODE_OUTPUT + "\n Frames failed: 0\n"self.assertIn("sequential_fps", capbench.parse_decode(timed(clean)))+ def test_fixture_inside_the_work_directory_is_not_deleted(self):+ with tempfile.TemporaryDirectory() as tmp:+ out = Path(tmp) / "out"+ fixture = out / "work" / "fixture" / "run" / "reference.cap"+ fixture.mkdir(parents=True)+ args = SimpleNamespace(+ bench=["decode-display"], out=str(out), label="run", fixture=str(fixture), bin_dir=tmp,+ variant=[], env=[], screen=None, animate=False, affinity=None,+ )+ with self.assertRaisesRegex(SystemExit, "overlap"):+ capbench.cmd_run(args)+ self.assertTrue(fixture.exists())+def test_startup_check_finds_missing_helpers(self):args = SimpleNamespace(fixture=".", bin_dir=str(Path(__file__).parent), screen=None, animate=False, affinity=None)with self.assertRaisesRegex(FileNotFoundError, "cap-test"):