[med-svn] [Git][med-team/mindthegap][master] Autopkgtest now works using pre-existing test scripts

Shayan Doust gitlab at salsa.debian.org
Tue Jul 9 15:18:36 BST 2019



Shayan Doust pushed to branch master at Debian Med / mindthegap


Commits:
da2a7765 by Shayan Doust at 2019-07-09T04:47:07Z
Autopkgtest now works using pre-existing test scripts

- - - - -


6 changed files:

- CMakeLists.txt
- + debian/patches/modify_tests_for_autopkgtest.patch
- debian/patches/series
- debian/tests/run-unit-test
- test/simple_full_test.sh
- test/simple_test.sh


Changes:

=====================================
CMakeLists.txt
=====================================
@@ -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})


=====================================
debian/patches/modify_tests_for_autopkgtest.patch
=====================================
@@ -0,0 +1,92 @@
+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
+ 


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 use_debian_packaged_gatb-core.patch
 remove_unnecessary_installs.patch
+modify_tests_for_autopkgtest.patch


=====================================
debian/tests/run-unit-test
=====================================
@@ -1,7 +1,7 @@
 #!/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


=====================================
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


=====================================
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
 



View it on GitLab: https://salsa.debian.org/med-team/mindthegap/commit/da2a77652843afbd7526dd8230045a4e01f6ec76

-- 
View it on GitLab: https://salsa.debian.org/med-team/mindthegap/commit/da2a77652843afbd7526dd8230045a4e01f6ec76
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190709/2625a694/attachment-0001.html>


More information about the debian-med-commit mailing list