@@ -72,6 +72,7 @@ BUILT_TEST_PROGRAMS = \
7272 test/hfile \
7373 test/sam \
7474 test/test_bgzf \
75+ test/test-ref \
7576 test/test_realn \
7677 test/test-regidx \
7778 test/test_view \
@@ -140,6 +141,7 @@ LIBHTS_OBJS = \
140141 multipart.o \
141142 probaln.o \
142143 realn.o \
144+ ref.o \
143145 regidx.o \
144146 sam.o \
145147 synced_bcf_reader.o \
@@ -158,8 +160,6 @@ LIBHTS_OBJS = \
158160 cram/cram_samtools.o \
159161 cram/cram_stats.o \
160162 cram/files.o \
161- cram/mFILE.o \
162- cram/open_trace_file.o \
163163 cram/pooled_alloc.o \
164164 cram/rANS_static.o \
165165 cram/sam_header.o \
@@ -174,11 +174,12 @@ cram_misc_h = cram/misc.h $(cram_os_h)
174174cram_os_h = cram/os.h $(htslib_hts_endian_h )
175175cram_sam_header_h = cram/sam_header.h cram/string_alloc.h cram/pooled_alloc.h $(htslib_khash_h ) $(htslib_kstring_h )
176176cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h ) $(cram_sam_header_h )
177- cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h ) cram/string_alloc.h cram/mFILE.h $(htslib_khash_h )
178- cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h
179177bcf_sr_sort_h = bcf_sr_sort.h $(htslib_synced_bcf_reader_h ) $(htslib_kbitset_h )
178+ cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h ) cram/string_alloc.h $(htslib_khash_h )
179+
180180hfile_internal_h = hfile_internal.h $(htslib_hfile_h ) $(textutils_internal_h )
181181hts_internal_h = hts_internal.h $(htslib_hts_h ) $(textutils_internal_h )
182+ ref_internal_h = ref_internal.h $(htslib_hfile_h ) cram/mFILE.h
182183textutils_internal_h = textutils_internal.h $(htslib_kstring_h )
183184thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h )
184185
@@ -316,18 +317,17 @@ plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h)
316317probaln.o probaln.pico : probaln.c config.h $(htslib_hts_h )
317318realn.o realn.pico : realn.c config.h $(htslib_hts_h ) $(htslib_sam_h )
318319textutils.o textutils.pico : textutils.c config.h $(htslib_hfile_h ) $(htslib_kstring_h ) $(hts_internal_h )
320+ ref.o ref.pico : ref.c config.h $(htslib_kstring_h ) $(htslib_bgzf_h ) $(cram_h ) $(cram_io_h ) $(htslib_hfile_h )
319321
320322cram/cram_codecs.o cram/cram_codecs.pico : cram/cram_codecs.c config.h $(cram_h )
321323cram/cram_decode.o cram/cram_decode.pico : cram/cram_decode.c config.h $(cram_h ) $(cram_os_h ) $(htslib_hts_h )
322324cram/cram_encode.o cram/cram_encode.pico : cram/cram_encode.c config.h $(cram_h ) $(cram_os_h ) $(htslib_hts_h ) $(htslib_hts_endian_h )
323325cram/cram_external.o cram/cram_external.pico : cram/cram_external.c config.h $(htslib_hfile_h ) $(cram_h )
324326cram/cram_index.o cram/cram_index.pico : cram/cram_index.c config.h $(htslib_bgzf_h ) $(htslib_hfile_h ) $(hts_internal_h ) $(cram_h ) $(cram_os_h )
325- cram/cram_io.o cram/cram_io.pico : cram/cram_io.c config.h os/lzma_stub.h $(cram_h ) $(cram_os_h ) $(htslib_hts_h ) $(cram_open_trace_file_h ) cram/rANS_static.h $(htslib_hfile_h ) $(htslib_bgzf_h ) $(htslib_faidx_h ) $(hts_internal_h )
327+ cram/cram_io.o cram/cram_io.pico : cram/cram_io.c config.h os/lzma_stub.h $(cram_h ) $(cram_os_h ) $(htslib_hts_h ) $(htslib_ref_h ) cram/rANS_static.h $(htslib_hfile_h ) $(htslib_bgzf_h ) $(htslib_faidx_h ) $(hts_internal_h )
326328cram/cram_samtools.o cram/cram_samtools.pico : cram/cram_samtools.c config.h $(cram_h ) $(htslib_sam_h )
327329cram/cram_stats.o cram/cram_stats.pico : cram/cram_stats.c config.h $(cram_h ) $(cram_os_h )
328330cram/files.o cram/files.pico : cram/files.c config.h $(cram_misc_h )
329- cram/mFILE.o cram/mFILE.pico : cram/mFILE.c config.h $(htslib_hts_log_h ) $(cram_os_h ) cram/mFILE.h
330- cram/open_trace_file.o cram/open_trace_file.pico : cram/open_trace_file.c config.h $(cram_os_h ) $(cram_open_trace_file_h ) $(cram_misc_h ) $(htslib_hfile_h ) $(htslib_hts_log_h )
331331cram/pooled_alloc.o cram/pooled_alloc.pico : cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h )
332332cram/rANS_static.o cram/rANS_static.pico : cram/rANS_static.c config.h cram/rANS_static.h cram/rANS_byte.h
333333cram/sam_header.o cram/sam_header.pico : cram/sam_header.c config.h $(htslib_hts_log_h ) $(cram_sam_header_h ) cram/string_alloc.h
@@ -354,7 +354,7 @@ tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htsl
354354#
355355# If using MSYS, avoid poor shell expansion via:
356356# MSYS2_ARG_CONV_EXCL="*" make check
357- check test : $(BUILT_PROGRAMS ) $(BUILT_TEST_PROGRAMS )
357+ check test : $(BUILT_PROGRAMS ) $(BUILT_TEST_PROGRAMS ) test_ebi_fetch
358358 test/hts_endian
359359 test/fieldarith test/fieldarith.sam
360360 test/hfile
@@ -364,6 +364,26 @@ check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS)
364364 test/test-regidx
365365 cd test && REF_PATH=: ./test.pl $$ {TEST_OPTS:-}
366366
367+ test_ebi_fetch :
368+ @if [ " $( ENABLE_HTTP_TESTS) " = true ] ; then \
369+ export REF_CACHE=` mktemp -d` && \
370+ echo " test ref: fetching" && \
371+ test/test-ref && \
372+ echo " test ref: fetch from cache" && \
373+ test/test-ref && \
374+ rm -rf $$ REF_CACHE; \
375+ export REF_CACHE=` mktemp -d` && \
376+ test/test_view -t test/xx.fa -S -C test/xx#rg.sam > test/xx#rg.tmp.cram && \
377+ echo " test view: fetching" && \
378+ test/test_view -D test/xx#rg.tmp.cram > /dev/null && \
379+ echo " test view: fetch from cache" && \
380+ test/test_view -D test/xx#rg.tmp.cram > /dev/null && \
381+ rm -rf $$ REF_CACHE; \
382+ else \
383+ echo " Warning: testing of EBI fetching disabled" ; \
384+ fi
385+
386+
367387test/hts_endian : test/hts_endian.o
368388 $(CC ) $(LDFLAGS ) -o $@ test/hts_endian.o $(LIBS )
369389
@@ -379,6 +399,9 @@ test/sam: test/sam.o libhts.a
379399test/test_bgzf : test/test_bgzf.o libhts.a
380400 $(CC ) $(LDFLAGS ) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS ) -lpthread
381401
402+ test/test-ref : test/test-ref.o libhts.a
403+ $(CC ) $(LDFLAGS ) -o $@ test/test-ref.o libhts.a $(LIBS ) -lpthread
404+
382405test/test_realn : test/test_realn.o libhts.a
383406 $(CC ) $(LDFLAGS ) -o $@ test/test_realn.o libhts.a $(LIBS ) -lpthread
384407
@@ -406,6 +429,7 @@ test/hfile.o: test/hfile.c config.h $(htslib_hfile_h) $(htslib_hts_defs_h)
406429test/sam.o : test/sam.c config.h $(htslib_hts_defs_h ) $(htslib_sam_h ) $(htslib_faidx_h ) $(htslib_kstring_h )
407430test/test_bgzf.o : test/test_bgzf.c config.h $(htslib_bgzf_h ) $(htslib_hfile_h ) $(hfile_internal_h )
408431test/test-realn.o : test/test_realn.c config.h $(htslib_hts_h ) $(htslib_sam_h ) $(htslib_faidx_h )
432+ test/test-ref.o : test/test-ref.c $(htslib_bgzf_h )
409433test/test-regidx.o : test/test-regidx.c config.h $(htslib_regidx_h ) $(hts_internal_h )
410434test/test_view.o : test/test_view.c config.h $(cram_h ) $(htslib_sam_h )
411435test/test-vcf-api.o : test/test-vcf-api.c config.h $(htslib_hts_h ) $(htslib_vcf_h ) $(htslib_kstring_h ) $(htslib_kseq_h )
0 commit comments