diff --git a/src/test/java/htsjdk/samtools/cram/CRAMInteropTestUtils.java b/src/test/java/htsjdk/samtools/cram/CRAMInteropTestUtils.java index 71b7b39555..8085693302 100644 --- a/src/test/java/htsjdk/samtools/cram/CRAMInteropTestUtils.java +++ b/src/test/java/htsjdk/samtools/cram/CRAMInteropTestUtils.java @@ -8,29 +8,14 @@ import java.util.ArrayList; import java.util.List; -import htsjdk.utils.SamtoolsTestUtils; - -/** - * Interop test data is kept in a separate repository, currently at https://github.com/samtools/htscodecs - * so it can be shared across htslib/samtools/htsjdk. - */ public class CRAMInteropTestUtils { - public static final String INTEROP_TEST_FILES_PATH = SamtoolsTestUtils.getCRAMInteropData(); - - /** - * @return true if interop test data is available, otherwise false - */ - public static boolean isInteropTestDataAvailable() { - final Path testDataPath = getInteropTestDataLocation(); - return Files.exists(testDataPath); - } /** - * @return the name and location of the local interop test data as specified by the - * variable INTEROP_TEST_FILES_PATH + * Return the location of the locally checked-in test CRAM 3.1 test interop data dir (the files + * there are copied from the originals in htscodecs), and should be updated periodically. */ public static Path getInteropTestDataLocation() { - return Paths.get(INTEROP_TEST_FILES_PATH); + return Paths.get("src/test/resources/htsjdk/samtools/cram/3.1_streams/"); } // the input files have embedded newlines that the test remove before round-tripping... diff --git a/src/test/java/htsjdk/samtools/cram/RANSInteropTest.java b/src/test/java/htsjdk/samtools/cram/RANSInteropTest.java index 9c1abafc29..a99c97aa97 100644 --- a/src/test/java/htsjdk/samtools/cram/RANSInteropTest.java +++ b/src/test/java/htsjdk/samtools/cram/RANSInteropTest.java @@ -30,12 +30,8 @@ /** * RANSInteropTest tests if the htsjdk RANS4x8 and RANSNx16 implementations are interoperable - * with the htslib implementations. The test files for Interop tests is kept in a separate repository, - * currently at https://github.com/samtools/htscodecs so it can be shared across htslib/samtools/htsjdk. - * - * For local development env, the Interop test files must be downloaded locally and made available at "../htscodecs/tests" - * For CI env, the Interop test files are made available from the existing samtools installation - * at "/samtools-1.14/htslib-1.14/htscodecs/tests" + * with the htslib implementations. The test files for Interop tests originate a separate repository, + * currently at https://github.com/samtools/htscodecs, but are checked into this repo as wrll. */ public class RANSInteropTest extends HtsjdkTest { public static final String COMPRESSED_RANS4X8_DIR = "r4x8"; @@ -155,16 +151,7 @@ public Object[][] getDecodeOnlyTestCases() throws IOException { .toArray(Object[][]::new); } - @Test(description = "Test if CRAM Interop Test Data is available") - public void testHtsCodecsCorpusIsAvailable() { - if (!CRAMInteropTestUtils.isInteropTestDataAvailable()) { - throw new SkipException(String.format("RANS Interop Test Data is not available at %s", - CRAMInteropTestUtils.INTEROP_TEST_FILES_PATH)); - } - } - @Test ( - dependsOnMethods = "testHtsCodecsCorpusIsAvailable", dataProvider = "roundTripTestCases", description = "Roundtrip using htsjdk RANS. Compare the output with the original file" ) public void testRANSRoundTrip( @@ -192,7 +179,6 @@ public void testRANSRoundTrip( } @Test ( - dependsOnMethods = "testHtsCodecsCorpusIsAvailable", dataProvider = "decodeOnlyTestCases", description = "Uncompress the existing compressed file using htsjdk RANS and compare it with the original file.") public void testDecodeOnly( diff --git a/src/test/java/htsjdk/utils/SamtoolsTestUtils.java b/src/test/java/htsjdk/utils/SamtoolsTestUtils.java index a4c1cc1918..c62c8a5fef 100644 --- a/src/test/java/htsjdk/utils/SamtoolsTestUtils.java +++ b/src/test/java/htsjdk/utils/SamtoolsTestUtils.java @@ -48,6 +48,11 @@ public static String getSamtoolsBin() { return samtoolsPath == null ? "/usr/local/bin/samtools" : samtoolsPath; } + public static String getCRAMInteropData() { + final String samtoolsPath = System.getenv(SAMTOOLS_BINARY_ENV_VARIABLE); + return samtoolsPath == null ? "../htscodecs/tests" : "./samtools-"+expectedSamtoolsVersion+ "/htslib-"+expectedHtslibVersion+"/htscodecs/tests"; + } + /** * Execute a samtools command line if a local samtools executable is available see {@link #isSamtoolsAvailable()}. *