[med-svn] [fw4spl] 01/01: add unit tests and patches and fix share of libs

Corentin Desfarges corentin-guest at moszumanska.debian.org
Thu Jan 8 10:12:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

corentin-guest pushed a commit to branch master
in repository fw4spl.

commit b713ebad050ea798e8e57710ae5b212888a48d32
Author: Corentin Desfarges <corentin.desfarges at gmail.com>
Date:   Thu Jan 8 11:09:35 2015 +0100

    add unit tests and patches and fix share of libs
---
 debian/control                           |   5 +-
 debian/copyright                         |   3 +-
 debian/patches/add_easy_launcher.patch   |   8 +
 debian/patches/fix_unit_tests.patch      | 282 +++++++++++++++++++++++++++++++
 debian/patches/series                    |   3 +
 debian/patches/set_media_as_bundle.patch |  10 ++
 debian/rules                             |   7 +-
 7 files changed, 314 insertions(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index 3e8a9ca..2f265f0 100644
--- a/debian/control
+++ b/debian/control
@@ -21,7 +21,10 @@ Build-Depends: debhelper (>= 9),
                libvtkgdcm2-dev,
                libvtk5.8-qt4,
                libvxl1-dev,
-               libcamp0.7-dev
+               libcamp0.7-dev,
+               xvfb,
+               xauth,
+               dbus-x11
 Standards-Version: 3.9.6
 Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/fw4spl.git
 Vcs-Git: git://anonscm.debian.org/debian-med/fw4spl.git
diff --git a/debian/copyright b/debian/copyright
index ae60525..9ce6ba8 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,6 +1,7 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: fw4spl
-Source: https://code.google.com/p/fw4spl/
+Source: https://github.com/corentindesfarges/fw4spl
+Files-Excluded: Apps/VRRender/doc
 
 Files: *
 Copyright: 2009-2013 Johan Moreau <johan.moreau at ircad.fr>
diff --git a/debian/patches/add_easy_launcher.patch b/debian/patches/add_easy_launcher.patch
new file mode 100644
index 0000000..c6a2c3c
--- /dev/null
+++ b/debian/patches/add_easy_launcher.patch
@@ -0,0 +1,8 @@
+--- /dev/null
++++ b/launcher/bin/fw4spl_launcher
+@@ -0,0 +1,5 @@
++#!/bin/bash
++
++bundle=$(ls /usr/share/fw4spl/Bundles/ | grep -i ^$1)
++
++LD_LIBRARY_PATH=/usr/lib/fw4spl /usr/bin/launcher /usr/share/fw4spl/Bundles/$bundle/profile.xml
diff --git a/debian/patches/fix_unit_tests.patch b/debian/patches/fix_unit_tests.patch
new file mode 100644
index 0000000..2f28a10
--- /dev/null
+++ b/debian/patches/fix_unit_tests.patch
@@ -0,0 +1,282 @@
+Index: fw4spl/SrcLib/core/fwRuntime/src/dl/Native.cpp
+===================================================================
+--- fw4spl.orig/SrcLib/core/fwRuntime/src/dl/Native.cpp
++++ fw4spl/SrcLib/core/fwRuntime/src/dl/Native.cpp
+@@ -47,7 +47,11 @@ const ::boost::filesystem::path Native::
+ 
+     //replace usr/share by usr/lib to find .so
+     std::string tmp_result = result.string();
+-    tmp_result.replace(tmp_result.find("/usr/share"),tmp_result.find("/usr/share")+10,"/usr/lib");
++    try{
++        tmp_result.replace(tmp_result.find("/usr/share"),tmp_result.find("/usr/share")+10,"/usr/lib");
++    } catch(std::exception & e){
++        OSLM_INFO("Not find un /usr/share because we are running unit test, not the program");
++    }
+     result = tmp_result;
+ 
+     // Test that the result path exists.
+@@ -85,7 +89,11 @@ const ::boost::filesystem::path Native::
+     
+     std::string sFullModulePath = (m_bundle->getLocation() / m_modulePath).string();
+     //replace usr/share by usr/lib to find .so
+-    sFullModulePath.replace(sFullModulePath.find("/usr/share"),sFullModulePath.find("/usr/share")+10,"/usr/lib");
++    try{
++        sFullModulePath.replace(sFullModulePath.find("/usr/share"),sFullModulePath.find("/usr/share")+10,"/usr/lib");
++    } catch(std::exception & e){
++        OSLM_INFO("Not find un /usr/share because we are running unit test, not the program");
++    }
+ 
+     const ::boost::filesystem::path fullModulePath( sFullModulePath );
+ #if BOOST_FILESYSTEM_VERSION > 2
+Index: fw4spl/SrcLib/core/fwRuntime/src/io/BundleDescriptorReader.cpp
+===================================================================
+--- fw4spl.orig/SrcLib/core/fwRuntime/src/io/BundleDescriptorReader.cpp
++++ fw4spl/SrcLib/core/fwRuntime/src/io/BundleDescriptorReader.cpp
+@@ -91,7 +91,10 @@ const BundleDescriptorReader::BundleCont
+     if(!completeLocation.is_complete())
+     {
+ #ifdef SPECIALINSTALL
+-	completeLocation = BUNDLEPATH / location;
++	completeLocation = SHAREPATH / location;
++	if( ! ::boost::filesystem::exists(::boost::filesystem::path(completeLocation))){
++		completeLocation = "share/fw4spl" / location;
++	}
+ #else
+ 	completeLocation = ::boost::filesystem::current_path() / location;
+ #endif
+@@ -107,6 +110,10 @@ const BundleDescriptorReader::BundleCont
+     std::ostringstream fileLocation;
+ #ifdef SPECIALINSTALL
+ 	fileLocation << SHAREPATH << "fwRuntime_" <<  FWRUNTIME_VER << "/plugin.xsd";
++	if( ! ::boost::filesystem::exists(::boost::filesystem::path(fileLocation.str()))){
++		fileLocation.str("");
++		fileLocation << "share/fw4spl/" << "fwRuntime_" <<  FWRUNTIME_VER << "/plugin.xsd";
++	}
+ 	const ::boost::filesystem::path pluginXSDLocation(fileLocation.str() );
+ #else
+ 	fileLocation << "share/fwRuntime_" <<  FWRUNTIME_VER << "/plugin.xsd";
+@@ -188,9 +195,17 @@ const BundleDescriptorReader::BundleCont
+ 
+     // Validation
+     std::ostringstream fileLocation;
++    ::boost::filesystem::path pluginXSDLocation;
+ #ifdef SPECIALINSTALL
+ 	fileLocation << SHAREPATH << "fwRuntime_" <<  FWRUNTIME_VER << "/plugin.xsd";
+-	const ::boost::filesystem::path pluginXSDLocation(fileLocation.str() );
++	pluginXSDLocation = fileLocation.str();
++
++	if( !boost::filesystem::exists(fileLocation.str())){
++		fileLocation.str("");
++		fileLocation << "share/fw4spl/fwRuntime_" FWRUNTIME_VER  "/plugin.xsd";
++		pluginXSDLocation = fileLocation.str();
++	}
++
+ #else
+ 	fileLocation << "share/fwRuntime_" <<  FWRUNTIME_VER << "/plugin.xsd";
+ 	const ::boost::filesystem::path pluginXSDLocation(::boost::filesystem::current_path() / fileLocation.str() );
+Index: fw4spl/SrcLib/core/fwRuntime/src/io/ProfileReader.cpp
+===================================================================
+--- fw4spl.orig/SrcLib/core/fwRuntime/src/io/ProfileReader.cpp
++++ fw4spl/SrcLib/core/fwRuntime/src/io/ProfileReader.cpp
+@@ -36,7 +36,7 @@ std::string ProfileReader::DIS_EXT
+ 
+ //------------------------------------------------------------------------------
+ 
+-::boost::shared_ptr< ::fwRuntime::profile::Profile > ProfileReader::createProfile( const boost::filesystem::path & path )
++::boost::shared_ptr< ::fwRuntime::profile::Profile > ProfileReader::createProfile( const boost::filesystem::path & path , bool isUnitTest )
+ {
+     // Normalizes the path.
+     boost::filesystem::path normalizedPath(path);
+@@ -51,15 +51,23 @@ std::string ProfileReader::DIS_EXT
+ 
+     // Validation
+     std::ostringstream fileLocation;
++    ::boost::filesystem::path profileXSDLocation;
+ #ifdef SPECIALINSTALL
++	//lancement depuis /usr/... ("mode normal")
+ 	fileLocation << SHAREPATH << "fwRuntime_" <<  FWRUNTIME_VER << "/profile.xsd";
+-	const ::boost::filesystem::path profileXSDLocation(fileLocation.str() );
++	profileXSDLocation = fileLocation.str();
++
++	if( isUnitTest || !boost::filesystem::exists(fileLocation.str())){
++		fileLocation.str("");
++		fileLocation << "share/fw4spl/fwRuntime_" FWRUNTIME_VER  "/profile.xsd";
++		profileXSDLocation = fileLocation.str();
++	}
++
+ #else
+ 	fileLocation << "share/fwRuntime_" <<  FWRUNTIME_VER << "/profile.xsd";
+-	const ::boost::filesystem::path profileXSDLocation(::boost::filesystem::current_path() / fileLocation.str() );
++	profileXSDLocation =::boost::filesystem::current_path() / fileLocation.str();
+ #endif
+ 
+-
+     Validator   validator(profileXSDLocation);
+ 
+     if( validator.validate(normalizedPath) == false )
+Index: fw4spl/CMakeLists.txt
+===================================================================
+--- fw4spl.orig/CMakeLists.txt
++++ fw4spl/CMakeLists.txt
+@@ -9,7 +9,7 @@ include(CheckVariableExists)
+ include(CMakeParseArguments)
+ 
+ option(CLASSIC_INSTALL ON)
+-set(CLASSIC_INSTALL OFF)
++#set(CLASSIC_INSTALL OFF)
+ set( EXTERNAL_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Modules/ )
+ 
+ if(CLASSIC_INSTALL)
+@@ -275,7 +275,7 @@ macro(fwCppunitTest FWPROJECT_NAME)
+         if(${FWPROJECT_NAME}_INSTALL)
+             createResourcesInstallTarget( "${PRJ_SOURCE_DIR}/tu/rc"
+                 "${${FWPROJECT_NAME}_RC_BUILD_DIR}" 
+-                "unittest/tu_exec_${DIRNAME}_${DASH_VERSION}" )
++                "${SHARE_OUTPUT_DIR}/tu_exec_${DIRNAME}_${DASH_VERSION}" )
+         endif()
+     endif()
+ 
+Index: fw4spl/SrcLib/core/fwRuntime/include/fwRuntime/io/ProfileReader.hpp
+===================================================================
+--- fw4spl.orig/SrcLib/core/fwRuntime/include/fwRuntime/io/ProfileReader.hpp
++++ fw4spl/SrcLib/core/fwRuntime/include/fwRuntime/io/ProfileReader.hpp
+@@ -52,7 +52,7 @@ struct ProfileReader
+      *
+      * @param[in]   path    a path to an xml profile file
+      */
+-    FWRUNTIME_API static ::boost::shared_ptr< ::fwRuntime::profile::Profile > createProfile( const boost::filesystem::path & path );
++    FWRUNTIME_API static ::boost::shared_ptr< ::fwRuntime::profile::Profile > createProfile( const boost::filesystem::path & path , bool isUnitTest=false );
+ 
+ 
+ 
+Index: fw4spl/CMake/cppunit/cppunit_main.cpp
+===================================================================
+--- fw4spl.orig/CMake/cppunit/cppunit_main.cpp
++++ fw4spl/CMake/cppunit/cppunit_main.cpp
+@@ -31,11 +31,7 @@ class MiniLauncher
+ public:
+     MiniLauncher( ::boost::filesystem::path profilePath )
+     {
+-	#ifdef SPECIALINSTALL
+-    		::boost::filesystem::path cwd = SHAREPATH;
+-	#else
+-		::boost::filesystem::path cwd = ::boost::filesystem::current_path();
+-	#endif
++	::boost::filesystem::path cwd = ::boost::filesystem::current_path();
+ 
+         ::boost::filesystem::path bundlePath = cwd / "Bundles";
+ 
+@@ -52,7 +48,7 @@ public:
+         }
+ 
+ 
+-        m_profile = ::fwRuntime::io::ProfileReader::createProfile(profilePath);
++        m_profile = ::fwRuntime::io::ProfileReader::createProfile(profilePath,true);
+         ::fwRuntime::profile::setCurrentProfile(m_profile);
+ 
+         m_profile->setParams(0, NULL);
+Index: fw4spl/launcher/src/ProfileRunner.cpp
+===================================================================
+--- fw4spl.orig/launcher/src/ProfileRunner.cpp
++++ fw4spl/launcher/src/ProfileRunner.cpp
+@@ -114,11 +114,17 @@ int main(int argc, char* argv[])
+     PathType profileFile;
+     ::fwRuntime::profile::Profile::ParamsContainer profileArgs;
+ 
++    std::string bundles_p;
++    if(boost::filesystem::exists(BUNDLEPATH))
++	bundles_p = BUNDLEPATH;
++    else
++	bundles_p = "Bundles";
++
+     po::options_description options("Launcher options");
+ #ifdef SPECIALINSTALL
+ 	options.add_options()
+         ("help,h", "Show help message")
+-        ("bundle-path,B", po::value(&bundlePaths)->default_value(PathListType(1,BUNDLEPATH)),
++        ("bundle-path,B", po::value(&bundlePaths)->default_value(PathListType(1,bundles_p)),
+ "Adds a bundle path")
+         ("rwd", po::value(&rwd)->default_value("./"), "Sets runtime working directory")
+         ;
+Index: fw4spl/SrcLib/core/fwActivities/test/tu/src/builder/ActivitySeriesBuilderTest.cpp
+===================================================================
+--- fw4spl.orig/SrcLib/core/fwActivities/test/tu/src/builder/ActivitySeriesBuilderTest.cpp
++++ fw4spl/SrcLib/core/fwActivities/test/tu/src/builder/ActivitySeriesBuilderTest.cpp
+@@ -18,6 +18,9 @@
+ #include <fwActivities/registry/Activities.hpp>
+ #include <fwActivities/IBuilder.hpp>
+ 
++#include <boost/filesystem/path.hpp>
++#include <boost/filesystem/operations.hpp>
++
+ #include "builder/ActivitySeriesBuilderTest.hpp"
+ 
+ 
+@@ -35,9 +38,9 @@ void ActivitySeriesBuilderTest::setUp()
+ {
+     // Set up context before running a test.
+ #ifdef SPECIALINSTALL
+-	::boost::filesystem::path plugin = std::string(SHAREPATH)+"tu_exec_fwActivities_0-0/tu_builder";
++	::boost::filesystem::path plugin = ::boost::filesystem::current_path() / "../share/fw4spl/tu_exec_fwActivities_0-0/tu_builder";
+ #else
+-	::boost::filesystem::path plugin = "share/tu_exec_fwActivities_0-0/tu_builder";
++	::boost::filesystem::path plugin = ::boost::filesystem::current_path() / "share/tu_exec_fwActivities_0-0//tu_builder";
+ #endif
+ 
+     m_bundle = ::fwRuntime::io::BundleDescriptorReader::createBundle(plugin);
+Index: fw4spl/SrcLib/core/fwActivities/test/tu/src/registry/ActivityRegistryTest.cpp
+===================================================================
+--- fw4spl.orig/SrcLib/core/fwActivities/test/tu/src/registry/ActivityRegistryTest.cpp
++++ fw4spl/SrcLib/core/fwActivities/test/tu/src/registry/ActivityRegistryTest.cpp
+@@ -18,6 +18,9 @@
+ 
+ #include <fwActivities/registry/Activities.hpp>
+ 
++#include <boost/filesystem/path.hpp>
++#include <boost/filesystem/operations.hpp>
++
+ #include "registry/ActivityRegistryTest.hpp"
+ 
+ 
+@@ -35,9 +38,9 @@ void ActivityRegistryTest::setUp()
+ {
+ 
+ #ifdef SPECIALINSTALL
+-	::boost::filesystem::path plugin = std::string(SHAREPATH)+"tu_exec_fwActivities_0-0/tu_registry";
++	::boost::filesystem::path plugin = ::boost::filesystem::current_path() / "../share/fw4spl/tu_exec_fwActivities_0-0/tu_registry";
+ #else
+-	::boost::filesystem::path plugin = "share/tu_exec_fwActivities_0-0/tu_registry";
++	::boost::filesystem::path plugin = ::boost::filesystem::current_path() / "share//tu_exec_fwActivities_0-0/tu_registry";
+ #endif
+     m_bundle = ::fwRuntime::io::BundleDescriptorReader::createBundle(plugin);
+ 
+Index: fw4spl/SrcLib/patch/fwMDSemanticPatch/src/fwMDSemanticPatch/PatchLoader.cpp
+===================================================================
+--- fw4spl.orig/SrcLib/patch/fwMDSemanticPatch/src/fwMDSemanticPatch/PatchLoader.cpp
++++ fw4spl/SrcLib/patch/fwMDSemanticPatch/src/fwMDSemanticPatch/PatchLoader.cpp
+@@ -6,6 +6,8 @@
+ 
+ #include <fwAtomsPatch/VersionsManager.hpp>
+ 
++#include <boost/filesystem/operations.hpp>
++
+ #include "fwMDSemanticPatch/PatchLoader.hpp"
+ 
+ namespace fwMDSemanticPatch
+@@ -14,9 +16,14 @@ namespace fwMDSemanticPatch
+ void PatchLoader::loadPatches()
+ {
+     SPTR(::fwAtomsPatch::VersionsManager) versionManager = ::fwAtomsPatch::VersionsManager::getDefault();
++
+     #ifdef SPECIALINSTALL
+-	versionManager->buildVersionTable(SHAREPATH "fwMDSemanticPatch_" FWMDSEMANTICPATCH_VER "/");
+-	versionManager->buildLinkTable(SHAREPATH "fwMDSemanticPatch_" FWMDSEMANTICPATCH_VER "/");
++	std::string location = SHAREPATH;
++	if( !boost::filesystem::exists(location)){
++		location = "share/fw4spl/";
++	}
++	versionManager->buildVersionTable(location + "fwMDSemanticPatch_" FWMDSEMANTICPATCH_VER "/");
++	versionManager->buildLinkTable(location + "fwMDSemanticPatch_" FWMDSEMANTICPATCH_VER "/");
+     #else
+ 	versionManager->buildVersionTable("./share/fwMDSemanticPatch_" FWMDSEMANTICPATCH_VER "/");
+ 	versionManager->buildLinkTable("./share/fwMDSemanticPatch_" FWMDSEMANTICPATCH_VER "/");
diff --git a/debian/patches/series b/debian/patches/series
index 203bf7c..035803e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,4 @@
 remove_fwItkIOTest.patch
+set_media_as_bundle.patch
+add_easy_launcher.patch
+fix_unit_tests.patch
diff --git a/debian/patches/set_media_as_bundle.patch b/debian/patches/set_media_as_bundle.patch
new file mode 100644
index 0000000..1209d97
--- /dev/null
+++ b/debian/patches/set_media_as_bundle.patch
@@ -0,0 +1,10 @@
+--- a/Apps/VRRender/rc/profile.xml
++++ b/Apps/VRRender/rc/profile.xml
+@@ -29,6 +29,7 @@
+     <activate id="memory" version="0-1" />
+     <activate id="monitorQt" version="0-1" />
+ 
++    <activate id="media" version="0-1" />
+ 
+     <activate id="scene2D" version="0-1" />
+ 
diff --git a/debian/rules b/debian/rules
index 0e577a0..e58d183 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,11 +16,12 @@ include /usr/share/dpkg/default.mk
 # package maintainers to append LDFLAGS
 
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-as-needed -Wl,-rpath=/usr/lib/fw4spl -ldl 
+DEB_BUILD_OPTIONS="parallel=8"
 
 # main packaging script based on dh7 syntax
 
 %:
-	dh $@
+	dh $@ --parallel
 
 override_dh_auto_configure:
 	dh_auto_configure || dh_auto_configure
@@ -29,7 +30,9 @@ override_dh_auto_install:
 	dh_auto_install --destdir=debian/fw4spl
 
 override_dh_auto_test:
-	echo "Unit tests disabled"
+	debian/get_data.sh
+	export FWTEST_DATA_DIR=../data
+	xvfb-run dbus-launch dh_auto_test
 
 override_dh_shlibdeps:
 	dh_shlibdeps -v -l/usr/lib:/usr/lib/fw4spl:/usr/lib/fw4spl/Bundles:/usr/lib/fw4spl/Bundles/gui_0-1/:/usr/lib/fw4spl/Bundles:/usr/lib/fw4spl/Bundles/io_0-1/:/usr/lib/fw4spl/Bundles:/usr/lib/fw4spl/Bundles/ctrlSelection_0-1/:/usr/lib/fw4spl/Bundles/ioITK_0-1/

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/fw4spl.git



More information about the debian-med-commit mailing list