Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ab9e944
Add design spec for Sage API parity in timsrust_cpp_bridge
timosachsenberg Mar 11, 2026
bb53a62
Address spec review: fix types, sentinels, add missing fields
timosachsenberg Mar 11, 2026
eb5e0aa
Address second spec review: clarify types, derivations, memory
timosachsenberg Mar 11, 2026
9f6f1d3
Add implementation plan for Sage API parity
timosachsenberg Mar 11, 2026
072a013
Address Codex review: sync header per-chunk, fix null ptrs, propagate…
timosachsenberg Mar 11, 2026
7209494
feat: extend TimsFfiSpectrum with index, isolation, charge, precursor…
timosachsenberg Mar 11, 2026
b10b065
feat: add TimsFfiFrame type, FrameReader, and converters to TimsDataset
timosachsenberg Mar 11, 2026
07b1616
feat: add tims_get_frame, tims_get_frames_by_level, tims_free_frame_a…
timosachsenberg Mar 11, 2026
ccb7375
Fix Chunk 2 code quality issues: ms_level type, struct docs, formatting
timosachsenberg Mar 11, 2026
e439d1f
Add error messages and improve formatting in get_frame
timosachsenberg Mar 11, 2026
898a57e
feat: add tims_convert_tof_to_mz and tims_convert_scan_to_im FFI exports
timosachsenberg Mar 11, 2026
ee81eae
feat: add config builder, tims_open_with_config, and C header updates
timosachsenberg Mar 11, 2026
2e77803
feat: update C++ example with frame, converter, and extended spectrum…
timosachsenberg Mar 11, 2026
ef2dcb2
Fix header comment: filename and frame buffer invalidation scope
timosachsenberg Mar 11, 2026
a4a0af4
Address CodeRabbit review: error codes, stale errors, overflow checks
timosachsenberg Mar 12, 2026
d6ff05e
docs: add testing strategy design spec
timosachsenberg Mar 12, 2026
a57dc0b
fix: null-check and finalize bugs found during spec review
timosachsenberg Mar 12, 2026
9259011
docs: add testing strategy implementation plan
timosachsenberg Mar 12, 2026
0e03cca
feat: add test infrastructure (Cargo config, public modules, test hel…
timosachsenberg Mar 12, 2026
18ed983
test: add FFI lifecycle tests for open/close, config builder, and ope…
timosachsenberg Mar 12, 2026
0b2a245
test: add error handling, spectrum, and frame FFI tests
timosachsenberg Mar 12, 2026
024a651
test: add query/metadata and converter FFI tests
timosachsenberg Mar 12, 2026
0ce8582
test: add real data integration tests for DDA and DIA datasets
timosachsenberg Mar 12, 2026
48fa1d9
test: add C++ Catch2 test suite for ABI and smoke tests
timosachsenberg Mar 12, 2026
c695a85
ci: add GitHub Actions CI workflow for stub and integration tests
timosachsenberg Mar 12, 2026
36928c2
fix: gate stub-only tests with #[cfg] and serialize global error tests
timosachsenberg Mar 12, 2026
e37726c
ci: configure integration test dataset download from release artifacts
timosachsenberg Mar 12, 2026
5cfb010
ci: run integration tests on all PRs with cached datasets
timosachsenberg Mar 12, 2026
a17c7cd
docs: add testing section to README
timosachsenberg Mar 12, 2026
db6a644
fix: make stub converter methods public and force-link rlib in tests
timosachsenberg Mar 12, 2026
58db9bf
fix: make stub types pub(crate) and handle timsrust config panics in …
timosachsenberg Mar 12, 2026
3f97a15
fix: use libc::c_char for error buffers (ARM portability)
timosachsenberg Mar 12, 2026
689bfbd
chore: remove superpowers spec documents
timosachsenberg Mar 12, 2026
3ec0c71
docs: add OpenMS integration plan for Bruker TDF support
timosachsenberg Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Tests

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

jobs:
stub-tests:
name: Stub Tests (no dataset)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cargo test (stub mode)
run: cargo test -- --nocapture

- name: Build library (debug)
run: cargo build

- name: Fetch Catch2
run: tests_cpp/fetch_catch2.sh

- name: C++ ABI tests
run: |
cd tests_cpp
make test LIBDIR=../target/debug

integration-tests:
name: Integration Tests (real data)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache test datasets
id: cache-testdata
uses: actions/cache@v4
with:
path: testdata
key: test-data-v1

- name: Download test datasets
if: steps.cache-testdata.outputs.cache-hit != 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p testdata
gh release download test-data-v1 -D testdata
unzip testdata/DDA_HeLa_50ng_5_6min.d.zip -d testdata
unzip testdata/DIA_HeLa_50ng_5_6min.d.zip -d testdata
rm testdata/*.d.zip

- name: Build library (release, with timsrust)
run: cargo build --features with_timsrust --release

- name: Rust integration tests
env:
TIMSRUST_TEST_DATA_DDA: testdata/20210510_TIMS03_EVO03_PaSk_MA_HeLa_50ng_5_6min_DDA_S1-B1_1_25185.d
TIMSRUST_TEST_DATA_DIA: testdata/20210510_TIMS03_EVO03_PaSk_SA_HeLa_50ng_5_6min_DIA_high_speed_S1-B2_1_25186.d
run: cargo test --features with_timsrust -- --nocapture

- name: Fetch Catch2
run: tests_cpp/fetch_catch2.sh

- name: C++ smoke tests
run: |
cd tests_cpp
make test LIBDIR=../target/release \
DDA=../testdata/20210510_TIMS03_EVO03_PaSk_MA_HeLa_50ng_5_6min_DDA_S1-B1_1_25185.d \
DIA=../testdata/20210510_TIMS03_EVO03_PaSk_SA_HeLa_50ng_5_6min_DIA_high_speed_S1-B2_1_25186.d
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Build artifacts
target/

# Catch2 amalgamated files (download via tests_cpp/fetch_catch2.sh)
tests_cpp/catch2/

# Compiled test objects and binary
tests_cpp/*.o
tests_cpp/run_tests
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "C FFI wrapper around timsrust for TDF/miniTDF access"

[lib]
# We want something C/C++ can link against
crate-type = ["cdylib", "staticlib"]
crate-type = ["cdylib", "staticlib", "lib"]

[dependencies]
# timsrust is optional for environments where the native crate is available.
Expand All @@ -26,3 +26,6 @@ with_timsrust = ["timsrust"]
# only if you want auto header generation
cbindgen = "0.27"

[dev-dependencies]
libc = "0.2"

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,55 @@ int main(int argc, char** argv) {
}
```

## Testing

The project uses a two-tier testing strategy: **stub tests** (no data needed) and **integration tests** (real Bruker datasets).

### Stub Tests

Run the FFI contract tests against the lightweight stub build (no `timsrust` dependency, no datasets):

```bash
cargo test
```

C++ ABI layout tests (requires Catch2, fetched automatically):

```bash
cargo build
tests_cpp/fetch_catch2.sh
cd tests_cpp && make test LIBDIR=../target/debug
```

### Integration Tests (Real Data)

Integration tests require real Bruker timsTOF Pro `.d` datasets. Test data is available as [GitHub release artifacts](https://github.com/OpenMS/timsrust_cpp_bridge/releases/tag/test-data-v1) (HeLa 50ng, 5.6-min gradient, from [PRIDE PXD027359](https://www.ebi.ac.uk/pride/archive/projects/PXD027359)).

Download and extract the datasets, then point the env vars at them:

```bash
# Download and extract
gh release download test-data-v1 -D testdata
unzip testdata/DDA_HeLa_50ng_5_6min.d.zip -d testdata
unzip testdata/DIA_HeLa_50ng_5_6min.d.zip -d testdata

# Run Rust integration tests
TIMSRUST_TEST_DATA_DDA=testdata/20210510_TIMS03_EVO03_PaSk_MA_HeLa_50ng_5_6min_DDA_S1-B1_1_25185.d \
TIMSRUST_TEST_DATA_DIA=testdata/20210510_TIMS03_EVO03_PaSk_SA_HeLa_50ng_5_6min_DIA_high_speed_S1-B2_1_25186.d \
cargo test --features with_timsrust -- --nocapture

# Run C++ smoke tests (after building with --features with_timsrust --release)
cd tests_cpp && make test LIBDIR=../target/release \
DDA=../testdata/20210510_TIMS03_EVO03_PaSk_MA_HeLa_50ng_5_6min_DDA_S1-B1_1_25185.d \
DIA=../testdata/20210510_TIMS03_EVO03_PaSk_SA_HeLa_50ng_5_6min_DIA_high_speed_S1-B2_1_25186.d
```

Tests gracefully skip if the env vars are unset.

### CI

Both test tiers run on every push and PR via GitHub Actions. Integration test datasets are cached to avoid repeated downloads.

## Notes and Caveats

- For DIA-PASEF datasets, `tims_num_spectra` reflects expanded MS2 spectra, while `tims_num_frames` reflects raw LC frames (including MS1).
Expand Down
Loading
Loading