From ee6830fefb125f1fba4c1bd85632e9c0783ebd25 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 15:01:40 +0700 Subject: [PATCH] sam2: integration tests in one binary (tests/it/main.rs) Co-Authored-By: Claude Opus 5.5 --- crates/sam2/tests/{ => it}/figure.rs | 0 crates/sam2/tests/it/main.rs | 4 ++++ crates/sam2/tests/{ => it}/reference.rs | 0 docs/roto-brush-sam2.md | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) rename crates/sam2/tests/{ => it}/figure.rs (100%) create mode 100644 crates/sam2/tests/it/main.rs rename crates/sam2/tests/{ => it}/reference.rs (100%) diff --git a/crates/sam2/tests/figure.rs b/crates/sam2/tests/it/figure.rs similarity index 100% rename from crates/sam2/tests/figure.rs rename to crates/sam2/tests/it/figure.rs diff --git a/crates/sam2/tests/it/main.rs b/crates/sam2/tests/it/main.rs new file mode 100644 index 000000000..b8232c63f --- /dev/null +++ b/crates/sam2/tests/it/main.rs @@ -0,0 +1,4 @@ +//! The crate's integration tests, one binary (each module is a former `tests/.rs`). + +mod figure; +mod reference; diff --git a/crates/sam2/tests/reference.rs b/crates/sam2/tests/it/reference.rs similarity index 100% rename from crates/sam2/tests/reference.rs rename to crates/sam2/tests/it/reference.rs diff --git a/docs/roto-brush-sam2.md b/docs/roto-brush-sam2.md index b165a29bc..f81e854c3 100644 --- a/docs/roto-brush-sam2.md +++ b/docs/roto-brush-sam2.md @@ -134,7 +134,7 @@ A single object's results need no pending buffer. ## How it works `crates/sam2` is a Rust port (on [candle](https://github.com/huggingface/candle), native only) of the Hugging Face `transformers` SAM 2 implementation, Apache-2.0 (see its `NOTICE`). Every stage is checked against PyTorch by -`crates/sam2/tests/reference.rs` (they skip without the weights; reference tensors come from +`crates/sam2/tests/it/reference.rs` (they skip without the weights; reference tensors come from `tools/sam2_reference.py` and `tools/sam2_video_reference.py`): | Stage | Max abs error vs PyTorch |