Commit da2a7765 authored by Shayan Doust's avatar Shayan Doust
Browse files

Autopkgtest now works using pre-existing test scripts

parent b4a3a065
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ SET (GATB_CORE_EXCLUDE_TESTS 1)
SET (GATB_CORE_EXCLUDE_EXAMPLES  1)

# GATB CORE
include (GatbCore)
# include (GatbCore)

################################################################################
# TOOL
@@ -106,11 +106,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# we define the files to be compiled
file (GLOB_RECURSE  ProjectFiles  src/*)

include(GNUInstallDirs)
LINK_DIRECTORIES ( /usr/${CMAKE_INSTALL_LIBDIR}/hdf5/serial )

# we define the artifact to be built: the project binary
add_executable        (${PROJECT_NAME}  src/main.cpp ${ProjectFiles})

# we define which libraries to be linked with project binary
target_link_libraries (${PROJECT_NAME}  ${gatb-core-libraries})
target_link_libraries (${PROJECT_NAME} gatbcore hdf5)


################################################################################
@@ -145,12 +148,12 @@ SET (CPACK_SOURCE_IGNORE_FILES

# We copy the project binary to the 'bin' directory
INSTALL (TARGETS   ${PROJECT_NAME}                           DESTINATION bin)
INSTALL (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test          DESTINATION .)
INSTALL (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data          DESTINATION .)
#INSTALL (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test          DESTINATION .)
#INSTALL (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data          DESTINATION .)
#INSTALL (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc           DESTINATION .)
INSTALL (FILES     ${CMAKE_CURRENT_SOURCE_DIR}/README.md     DESTINATION .)
INSTALL (FILES     ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md     DESTINATION .)
INSTALL (FILES     ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE       DESTINATION .)
#INSTALL (FILES     ${CMAKE_CURRENT_SOURCE_DIR}/README.md     DESTINATION .)
#INSTALL (FILES     ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md     DESTINATION .)
#INSTALL (FILES     ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE       DESTINATION .)

# We include the "bin" tag into binary archive file name
set (CPACK_PACKAGE_FILE_NAME  ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-bin-${CMAKE_SYSTEM_NAME})
+92 −0
Original line number Diff line number Diff line
Index: mindthegap/test/simple_full_test.sh
===================================================================
--- mindthegap.orig/test/simple_full_test.sh
+++ mindthegap/test/simple_full_test.sh
@@ -1,18 +1,5 @@
 #! /bin/bash
 
-# look for MindTheGap binary. In devel mode, it's in ../build/bin directory.
-# In production mode, it's in ../bin directory.
-if [ -f "../bin/MindTheGap" ]
-then
- bindir="../bin"
-elif [ -f "../build/bin/MindTheGap" ]
-then
- bindir="../build/bin"
-else
- echo "could not find a compiled MindTheGap binary"
- exit 1
-fi
-
 RETVAL=0
 testDir="test-output"
 outputPrefix=$testDir/full-test
@@ -33,7 +20,7 @@ mkdir $testDir
 ################################################################################
 # we launch the find module
 ################################################################################
-${bindir}/MindTheGap find -in ../data/reads_r1.fastq,../data/reads_r2.fastq -ref ../data/reference.fasta -out $outputPrefix >$outputPrefix.out -nb-cores 1 2> /dev/null
+MindTheGap find -in ../data/reads_r1.fastq,../data/reads_r2.fastq -ref ../data/reference.fasta -out $outputPrefix >$outputPrefix.out -nb-cores 1 2> /dev/null
 
 ################################################################################
 # we check the results 
@@ -78,7 +65,7 @@ fi
 ################################################################################
 # we launch the fill module
 ################################################################################
-${bindir}/MindTheGap fill -graph $outputPrefix.h5 -bkpt $outputPrefix.breakpoints -out $outputPrefix -nb-cores 1 >>$outputPrefix.out 2> /dev/null
+MindTheGap fill -graph $outputPrefix.h5 -bkpt $outputPrefix.breakpoints -out $outputPrefix -nb-cores 1 >>$outputPrefix.out 2> /dev/null
 
 ################################################################################
 # we check the results 
@@ -117,7 +104,7 @@ fi
 ################################################################################
 # we launch the fill module in contig mode
 ################################################################################
-${bindir}/MindTheGap fill -in ../data/contig-reads.fasta.gz -contig ../data/contigs.fasta -abundance-min 3 -out $outputPrefix2 -nb-cores 1 >>$outputPrefix2.out 2> /dev/null
+MindTheGap fill -in ../data/contig-reads.fasta.gz -contig ../data/contigs.fasta -abundance-min 3 -out $outputPrefix2 -nb-cores 1 >>$outputPrefix2.out 2> /dev/null
 
 ################################################################################
 # we check the results
Index: mindthegap/test/simple_test.sh
===================================================================
--- mindthegap.orig/test/simple_test.sh
+++ mindthegap/test/simple_test.sh
@@ -1,26 +1,13 @@
 #!/bin/bash
 
-# look for MindTheGap binary. In devel mode, it's in ../build/bin directory.
-# In production mode, it's in ../bin directory.
-if [ -f "../bin/MindTheGap" ]
-then
- bindir="../bin"
-elif [ -f "../build/bin/MindTheGap" ]
-then
- bindir="../build/bin"
-else
- echo "could not find a compiled mindthegap binary"
- exit 1
-fi
-
 testOK="true"
 
 run_test()
 {
     # param : reads_file ref_file true_result prefix
-    $bindir/MindTheGap find -in $1 -ref $2 -kmer-size 31 -out output/$4_find $5 1> output/$4_find.out 2> output/$4_find.err
+    MindTheGap find -in $1 -ref $2 -kmer-size 31 -out output/$4_find $5 1> output/$4_find.out 2> output/$4_find.err
 
-    $bindir/MindTheGap fill -bkpt output/$4_find.breakpoints -graph output/$4_find.h5  -out output/$4_fill 1> output/$4_fill.out 2> output/$4_fill.err
+    MindTheGap fill -bkpt output/$4_find.breakpoints -graph output/$4_find.h5  -out output/$4_fill 1> output/$4_fill.out 2> output/$4_fill.err
 
     tmp1=output/$4_fill.insertions.fasta.tmp
     tmp2=output/tmp2
@@ -45,7 +32,7 @@ run_test()
 run_test_vcf()
 {
 # param : reads_file ref_file true_result prefix
-	$bindir/MindTheGap find -in $1 -ref $2 -kmer-size 31 -out output/$4_find $5 1> output/$4_find.out 2> output/$4_find.err
+	MindTheGap find -in $1 -ref $2 -kmer-size 31 -out output/$4_find $5 1> output/$4_find.out 2> output/$4_find.err
 
 	sh compare_vcf.sh output/$4_find.othervariants.vcf  $3 1> /dev/null 2>&1
 
+1 −0
Original line number Diff line number Diff line
use_debian_packaged_gatb-core.patch
remove_unnecessary_installs.patch
modify_tests_for_autopkgtest.patch
+8 −3
Original line number Diff line number Diff line
#!/bin/bash
set -e

pkg=#PACKAGENAME#
pkg=mindthegap

if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
@@ -11,8 +11,13 @@ if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

cp -a /usr/share/doc/${pkg}/examples/* "${AUTOPKGTEST_TMP}"
cp -r /usr/share/mindthegap/test "${AUTOPKGTEST_TMP}"
cp -r /usr/share/mindthegap/data "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"
cd "${AUTOPKGTEST_TMP}"/test

#do_stuff_to_test_package#
echo "Invoking simple_test.sh:"
bash simple_test.sh
echo "Invoking simple_full_test.sh:"
bash simple_full_test.sh
+3 −16
Original line number Diff line number Diff line
#! /bin/bash

# look for MindTheGap binary. In devel mode, it's in ../build/bin directory.
# In production mode, it's in ../bin directory.
if [ -f "../bin/MindTheGap" ]
then
 bindir="../bin"
elif [ -f "../build/bin/MindTheGap" ]
then
 bindir="../build/bin"
else
 echo "could not find a compiled MindTheGap binary"
 exit 1
fi

RETVAL=0
testDir="test-output"
outputPrefix=$testDir/full-test
@@ -33,7 +20,7 @@ mkdir $testDir
################################################################################
# we launch the find module
################################################################################
${bindir}/MindTheGap find -in ../data/reads_r1.fastq,../data/reads_r2.fastq -ref ../data/reference.fasta -out $outputPrefix >$outputPrefix.out -nb-cores 1 2> /dev/null
MindTheGap find -in ../data/reads_r1.fastq,../data/reads_r2.fastq -ref ../data/reference.fasta -out $outputPrefix >$outputPrefix.out -nb-cores 1 2> /dev/null

################################################################################
# we check the results 
@@ -78,7 +65,7 @@ fi
################################################################################
# we launch the fill module
################################################################################
${bindir}/MindTheGap fill -graph $outputPrefix.h5 -bkpt $outputPrefix.breakpoints -out $outputPrefix -nb-cores 1 >>$outputPrefix.out 2> /dev/null
MindTheGap fill -graph $outputPrefix.h5 -bkpt $outputPrefix.breakpoints -out $outputPrefix -nb-cores 1 >>$outputPrefix.out 2> /dev/null

################################################################################
# we check the results 
@@ -117,7 +104,7 @@ fi
################################################################################
# we launch the fill module in contig mode
################################################################################
${bindir}/MindTheGap fill -in ../data/contig-reads.fasta.gz -contig ../data/contigs.fasta -abundance-min 3 -out $outputPrefix2 -nb-cores 1 >>$outputPrefix2.out 2> /dev/null
MindTheGap fill -in ../data/contig-reads.fasta.gz -contig ../data/contigs.fasta -abundance-min 3 -out $outputPrefix2 -nb-cores 1 >>$outputPrefix2.out 2> /dev/null

################################################################################
# we check the results
Loading