[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Request for review] assembly-stats



Hi,

Currently assembly-stats fails to cross-build from source because the build forces compilation of test files, while its test dependency libgtest-dev is annotated with <!nocheck>
It also uses DEB_BUILD_GNU_TYPE in d/rules which is wrong. I've attempted a fix, and would really like and appreciate a review before I report a bug and commit this in salsa as well.

Patch is attached with the mail.

-- 
Nilesh

diff --git a/debian/patches/do-not-test-forcefully.patch b/debian/patches/do-not-test-forcefully.patch
new file mode 100644
index 0000000..1fc749f
--- /dev/null
+++ b/debian/patches/do-not-test-forcefully.patch
@@ -0,0 +1,23 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,11 +5,15 @@
+ 
+ file(COPY test_files DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ #add_subdirectory(gtest-1.7.0)
+-enable_testing()
+-include_directories(/usr/include/gtest)
+-add_executable(runUnitTests fasta_unittest.cpp fastq_unittest.cpp filetype_unittest.cpp stats_unittest.cpp)
+-target_link_libraries(runUnitTests gtest gtest_main fasta fastq filetype stats)
+-add_test(runUnitTests runUnitTests)
++option(BUILD_TESTS "Parameter to enable/disable build time tests" ON)
++
++if(BUILD_TESTS)
++	enable_testing()
++	include_directories(/usr/include/gtest)
++	add_executable(runUnitTests fasta_unittest.cpp fastq_unittest.cpp filetype_unittest.cpp stats_unittest.cpp)
++	target_link_libraries(runUnitTests gtest gtest_main fasta fastq filetype stats)
++	add_test(runUnitTests runUnitTests)
++endif()
+ 
+ add_library(fasta fasta.cpp)
+ add_library(fastq fastq.cpp)
diff --git a/debian/patches/series b/debian/patches/series
index 9fc23ad..49aafd6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 use_debian_packages_gtest.patch
+do-not-test-forcefully.patch
diff --git a/debian/rules b/debian/rules
index aae41d2..00ac463 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,5 +11,12 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 %:
 	dh $@
 
+override_dh_auto_configure:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	dh_auto_configure -- -DBUILD_TESTS=ON
+else
+	dh_auto_configure -- -DBUILD_TESTS=OFF
+endif
+
 override_dh_auto_install:
-	dh_install obj-$(DEB_BUILD_GNU_TYPE)/assembly-stats usr/bin
+	dh_install obj-$(DEB_HOST_GNU_TYPE)/assembly-stats usr/bin

Reply to: