8000 Add system tests by Griffan · Pull Request #1 · Griffan/minibwa · GitHub
[go: up one dir, main page]

Skip to content

Add system tests - #1

Merged
Griffan merged 40 commits into
masterfrom
add_system_tests
Jul 4, 2026
Merged

Griffan merged 40 commits into
masterfrom
add_system_tests

Conversation

@Griffan
@Griffan Griffan commented Jul 2, 2026 •
Copy link
Copy Markdown
Owner

Summary

This PR adds a comprehensive bash-based system test suite for minibwa and wires it into GitHub Actions CI, including code coverage reporting.

Key Outcomes

System test suite with code coverage

A full bash-based test suite now covers the minibwa CLI, API, and BS-seq workflows, running on every push/PR via CI.

  • run-tests.sh — CLI basics, indexing, mapping, mem, utilities
  • test-utils.sh — bench, fastmap, version
  • test-index-routines.sh — Individual indexing steps (fa2bit, genbwt, genraw, raw2bwt, gensa)
  • test-api.sh — C API examples (ex-one.c, ex-batch.c)
  • test-bisulfite.sh — BS-seq simulation tests

Changes

Test Suite (test/)

  • run-tests.sh — Main system test runner covering:
    • CLI basics (version, help, unknown commands)
    • Indexing (normal, multi-thread, SA sampling, low-memory, BS-seq mode)
    • Mapping (SAM/PAF output, presets, read groups, tags, threading)
    • Mem subcommand
    • Utility commands (getref, fa2bit, genbwt)
  • test-utils.sh — Utility command tests (bench, fastmap, version)
  • test-index-routines.sh — Individual indexing step tests
  • test-api.sh — C API example tests
  • test-bisulfite.sh — BS-seq simulation tests (43 tests across 16 groups)
    • Simulated read group — synthetic C-to-T / G-to-A read generation with ground-truth position validation
    • Single-end and paired-end BS-seq mapping
    • Presets, scoring params, output tags, PAF, Hi-C mode
    • Determinism, edge cases, mixed-strand reads

CI (.github/workflows/build.yml)

  • Added test job that runs all 5 test scripts on every push/PR
  • Coverage instrumentation via lcov with atomic counters (-fprofile-update=atomic)
  • Filters coverage to minibwa source only (excludes libsais, ksw2, mimalloc, test files)
  • Generates HTML report (genhtml) and plain-text coverage percentage for shields.io badge

Other

  • test/data/ — moved test fixtures from test/ into a dedicated data directory
  • .gitignore — ignore test/_minibwa_test_tmp/

Test Coverage

Coverage from CI run: coverage-report.zip

LCOV - code coverage report

View: Coverage Total Hit
Lines: 79.8% 5530 4415
Functions: 87.2% 320 279

Legend: Rating: low: < 75% medium: >= 75% high: >= 90%

Griffan added 3 commits July 1, 2026 23:49
Each PR commit now triggers both the multi-platform build job and
a system test job on ubuntu-latest that runs the full 43-test suite.
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a bash-based system test suite for minibwa and wires it into GitHub Actions so core CLI/indexing/mapping behaviors can be exercised in CI.

Changes:

  • Added a comprehensive end-to-end system test runner (test/run-tests.sh) covering CLI basics, indexing, mapping outputs (SAM/PAF), presets, and several options.
  • Added additional standalone scripts for utility commands, separate indexing routines, and C API examples (test/test-*.sh).
  • Updated CI workflow to run the system tests and updated .gitignore.

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
test/test-utils.sh Adds utility-command tests (bench, fastmap, version).
test/test-index-routines.sh Adds tests for individual indexing pipeline steps (fa2bit, genbwt, genraw, raw2bwt, gensa, etc.).
test/test-api.sh Builds and runs the C API example binaries under api-test/.
test/run-tests.sh Adds the main system test suite used by CI.
.gitignore Ignores .claude.
.github/workflows/build.yml Adds a test job that runs bash test/run-tests.sh.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/run-tests.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Griffan added 2 commits July 2, 2026 12:11
- fail(): accept optional second argument for failure details (both files)
- run-tests.sh: register cleanup() via 'trap cleanup EXIT'
- run-tests.sh: assert_contains/assert_line_count/assert_not_contains:
  guard against missing files instead of aborting under set -e
- run-tests.sh: version check pattern [0-9]+\.[0-9]+ instead of 0\.
- run-tests.sh: genbwt call now passes both input and output paths
- test-index-routines.sh: Test 3 passes -t2 to genbwt for real multi-thread
- test-index-routines.sh: ls | wc -l pipelines use || echo 0 fallback
- test-index-routines.sh: fix raw2bwt comment and output path check
- test-index-routines.sh: genraw/raw2bwt tests create .pac via genbwt
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 7 comments.

Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
- test-bisulfite.sh:
  - fail() now reports second argument (diagnostic context)
  - assert_contains/assert_line_count check file existence before grep/wc
  - Removed redundant tr 'c' 't' (use tr 'Cc' 'Tt' instead)
  - Fixed assert_contains || assert_contains chain (use single grep)
  - Fixed assert_contains || pass (use if/else with direct grep)
  - Fixed mixed-strand FASTA construction (concat decompressed, re-gzip)
  - Removed duplicate grep in PE flag check

- test-utils.sh:
  - Version check uses [0-9]+ instead of hard-coded 0. for future-proofing
@Griffan
Griffan commented Jul 2, 2026
Copy link
Copy Markdown
Owner Author

All 19 Copilot review comments have been resolved across two commits:

First review (12 comments on run-tests.sh, test-index-routines.sh):

  • fail() now includes diagnostic context from 2nd argument
  • cleanup() registered via trap cleanup EXIT
  • assert_contains / assert_line_count check file existence before grep/wc (prevents set -e aborts)
  • genbwt test now passes -t2 for actual multi-threading coverage
  • ls | wc -l pipelines guarded with || count=0 for pipefail safety
  • genraw/raw2bwt tests use fa2bit -p to create .pac files correctly
  • raw2bwt output check uses exact path (no assumed extension)
  • Version regex updated to [0-9]+\.[0-9]+ (not hardcoded to 0.x)

Second review (7 comments on test-bisulfite.sh):

  • fail() includes diagnostic context
  • Alignment flag checks use single grep -qP with alternation (not broken || chains)
  • Mixed-strand FASTA built by concatenating decompressed streams + re-gzipping
  • Redundant tr 'c' 't' replaced with single tr 'Cc' 'Tt'

Ready to push once credentials are available.

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 11 changed files in this pull request and generated 10 comments.

Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh 8BD0 Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/test-api.sh Resolved
@Griffan
Griffan commented Jul 3, 2026
Copy link
Copy Markdown
Owner Author

All 19 Copilot review comments have been resolved across both reviews. Here is a summary of each fix:

Review 4615192533 (5 fixes in run-tests.sh + 7 in test-index-routines.sh)

run-tests.sh:

  1. fail() now includes diagnostic context from 2nd arg (line 24)
  2. cleanup() registered via trap cleanup EXIT (line 102)
  3. assert_contains guards against missing files before grep (lines 38-41)
  4. assert_line_count guards against missing files before wc (lines 73-76)
  5. genbwt call includes both input and output path args (line 41)
  6. Version regex updated to [0-9]+\.[0-9]+ for 1.0+ compatibility (line 137)

test-index-routines.sh:
7. genbwt passes -t2 for multi-threading test (line 56)
8. ls | wc -l guarded with || count=0 at line 73
9. ls | wc -l guarded with || count=0 at line 97
10. Comment corrected: raw2bwt writes to exact output path (line 87)
11. raw2bwt output check uses exact path /tmp/mb_ir_raw2bwt_final (line 93)
12. .pac file created via fa2bit -p so genraw/raw2bwt are exercised (line 66)

Review 4621382485 (7 fixes in test-bisulfite.sh)

test-bisulfite.sh:
13. fail() includes diagnostic context from 2nd arg (line 26)
14. Alignment flag check uses single grep -qP with alternation (lines 279-283)
15. assert_contains || pass replaced with proper if/else grep check (lines 279-283)
16. Mixed-strand FASTA: concat decompressed streams then re-gzip (lines 584-586)
17. Redundant tr 'c' 't' replaced with tr 'Cc' 'Tt' (line 126)
18. PE reads: tr 'Cc' 'Tt' (line 174) and tr 'Gg' 'Aa' (line 186)
19. Duplicate grep -qP removed; single grep with alternation (line 279)

All fixes are in the latest commit (5176dfddb21960a550bc761d0a8ed876a55be6aa).

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 8 comments.

Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-api.sh Resolved
Comment thread .github/workflows/build.yml Resolved
Griffan and others added 4 commits July 2, 2026 19:14
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Changes:
- Added TMP_DIR=${TMPDIR:-.}/_minibwa_test_tmp to all test scripts
- Replaced all hardcoded /tmp/ paths with $TMP_DIR/ for temp files
- Updated cleanup functions to remove files from $TMP_DIR
- Converted 11 previously skipped tests to actual tests:
  * run-tests.sh: 4 tests (chain-only, missing index, missing FASTA, index missing FASTA)
  * test-utils.sh: 7 tests (bench 2a, sa, msa, msa -v 50, msa -1, fastmap -n, bench -p, checksum)
- Fixed bench -p test to write to file instead of capturing in variable (1M+ lines)

Result: 175 tests pass, 0 fail, 0 skipped
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 11 changed files in this pull request and generated 6 comments.

Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/build.yml Resolved
Comment thread README.md Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-utils.sh Resolved
Griffan and others added 2 commits July 2, 2026 21:57
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 5 comments.

Comment thread test/run-tests.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Griffan and others added 2 commits July 3, 2026 01:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 12 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/build.yml Resolved
Comment thread test/test-utils.sh Resolved
Griffan and others added 2 commits July 3, 2026 14:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 6 comments.

Comment thread test/test-utils.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-utils.sh Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 8 comments.

Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-api.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/test-utils.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 1 comment.

Comment thread test/test-index-routines.sh Outdated
Comment on lines +82 to +85
"$BINARY" genraw $TMP_DIR/mb_ir_genraw.pac $TMP_DIR/mb_ir_genraw_out > /dev/null 2>&1
if [ -f "$TMP_DIR/mb_ir_genraw_out.bwt" ] || [ -f "$TMP_DIR/mb_ir_genraw_out.occ" ]; then
pass "genraw produces BWT/occ files"
else
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 3 comments.

Comment thread test/run-tests.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 6 comments.

Comment thread test/test-utils.sh Resolved
Comment thread test/run-tests.sh Resolved
Comment thread test/test-bisulfite.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Comment thread test/test-index-routines.sh Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Griffan
Griffan merged commit 77488ad into master Jul 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0