Skip to content

Commit a1035f6

Browse files
htslib: add run_tests.sh (#14318)
``` $ python3 infra/experimental/chronos/manager.py check-tests --integrity-check htslib ... Number of tests: total .. 348 passed .. 348 failed .. 0 + mv /tmp/ce#large_seq.sam test/ + mv /tmp/xx#large_aux.sam test/ Integrity validator run tests for project: htslib Diff patching for stage after. Diff patch analysis begin. Stage: after, Current working dir: /src/htslib Diff patch analysis after stage. Git repo found: /src/htslib Diff patch generated at /tmp/chronos-diff.patch Difference between diffs: Patch result: success. No patch found that affects source control versioning. INFO:__main__:succeeded patch: True INFO:__main__:run_tests.sh result succeeded: does not patch source control INFO:__main__:htslib test completion succeeded: Duration of run_tests.sh: 134.07 seconds ``` Signed-off-by: David Korczynski <david@adalogics.com>
1 parent 8e3ff82 commit a1035f6

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

projects/htslib/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ RUN apt-get update && apt-get install -y make autoconf automake zlib1g-dev libbz
1919
RUN git clone --depth 1 --shallow-submodules --recurse-submodules https://github.com/samtools/htslib.git htslib
2020
WORKDIR htslib
2121
COPY build.sh $SRC/
22+
COPY run_tests.sh $SRC/
23+

projects/htslib/build.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@
1818
# build project
1919
autoconf
2020
autoheader
21-
./configure
22-
make -j$(nproc) libhts.a test/fuzz/hts_open_fuzzer.o
21+
export LDFLAGS="$CFLAGS"
22+
./configure LIBS="-lz -lm -lbz2 -llzma -lcurl -lcrypto -lpthread"
23+
make -j$(nproc) libhts.a bgzip htsfile tabix annot-tsv test/fuzz/hts_open_fuzzer.o
24+
25+
# Build tests
26+
make -j$(nproc) test/hts_endian test/fieldarith test/hfile test/pileup test/pileup_mod \
27+
test/sam test/test_bgzf test/test_expr test/test_faidx test/test_kfunc \
28+
test/test_khash test/test_kstring test/test_mod test/test_nibbles test/test_realn \
29+
test/test-regidx test/test_str2int test/test_time_funcs test/test_view \
30+
test/test_index test/test-vcf-api test/test-vcf-sweep test/test-bcf-sr \
31+
test/test-bcf-translate test/test-parse-reg test/test_introspection \
32+
test/test-bcf_set_variant_type
2333

2434
# build fuzzers
2535
$CXX $CXXFLAGS -o "$OUT/hts_open_fuzzer" test/fuzz/hts_open_fuzzer.o $LIB_FUZZING_ENGINE libhts.a -lz -lbz2 -llzma -lcurl -lcrypto -lpthread

projects/htslib/run_tests.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash -eux
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
# Run tests
19+
test/hts_endian
20+
test/test_expr
21+
test/test_kfunc
22+
test/test_khash
23+
test/test_kstring
24+
test/test_nibbles -v
25+
test/test_str2int
26+
test/test_time_funcs
27+
test/fieldarith test/fieldarith.sam
28+
test/hfile
29+
test/test_bgzf test/bgziptest.txt
30+
test/test-parse-reg -t test/colons.bam
31+
test/sam test/ce.fa test/faidx/faidx.fa test/faidx/fastqs.fq
32+
test/test-regidx
33+
34+
# Run script tests
35+
(cd test/faidx && ./test-faidx.sh faidx.tst)
36+
(cd test/sam_filter && ./filter.sh filter.tst)
37+
(cd test/tabix && ./test-tabix.sh tabix.tst)
38+
(cd test/mpileup && ./test-pileup.sh mpileup.tst)
39+
(cd test/fastq && ./test-fastq.sh)
40+
(cd test/base_mods && ./base-mods.sh base-mods.tst)
41+
(cd test/tlen && ./tlen.sh tlen.tst)
42+
43+
# Run perl tests
44+
# We need to be in test directory for test.pl to work correctly with relative paths if it expects that,
45+
# but Makefile runs it from test directory.
46+
47+
# Remove failing tests (likely due to ASan/Memory limits in OSS-Fuzz environment)
48+
#rm -f test/ce#large_seq.sam test/xx#large_aux.sam
49+
mv test/ce#large_seq.sam /tmp/
50+
mv test/xx#large_aux.sam /tmp/
51+
52+
(cd test && REF_PATH=: ./test.pl)
53+
54+
# restore failing tests
55+
mv /tmp/ce#large_seq.sam test/
56+
mv /tmp/xx#large_aux.sam test/

0 commit comments

Comments
 (0)