[med-svn] [camitk] 01/02: Prepare packaging for 4.0.2 + improve autopkgtest tests

Emmanuel Promayon promayon-guest at moszumanska.debian.org
Fri Sep 30 07:16:27 UTC 2016


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

promayon-guest pushed a commit to branch master
in repository camitk.

commit 808838351792dec92b11abf2cc950f87ddc5af15
Author: Emmanuel Promayon <Emmanuel.Promayon at imag.fr>
Date:   Fri Sep 30 09:15:08 2016 +0200

    Prepare packaging for 4.0.2 + improve autopkgtest tests
    
    This should package the 4.0.2 upstream tarball.
    While packaging 4.0.2 some bugs were found.
    There were solved directly upstream.
    upstream tarball 4.0.3 packaging in progress
    
    Signed-off-by: Emmanuel Promayon <Emmanuel.Promayon at imag.fr>
---
 debian/changelog     |   9 +
 debian/control       |  18 +-
 debian/rules         |   8 +-
 debian/tests/config  | 281 +++++++++++++++++++-----------
 debian/tests/control |   4 +-
 debian/tests/wizard  | 471 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 679 insertions(+), 112 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 40e2157..9dcb92e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+camitk (4.0.2-1) UNRELEASED; urgency=medium
+
+  * Imported Upstream version 4.0.2
+  * Removed SONAME number in the dev package name
+  * Declares Breaks+Replaces
+    Closes: #836990
+
+ -- Emmanuel Promayon <Emmanuel.Promayon at imag.fr>  Wed, 21 Sep 2016 16:47:44 +0200
+
 camitk (4.0.0~beta-2) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/control b/debian/control
index 78eac31..997522a 100644
--- a/debian/control
+++ b/debian/control
@@ -33,6 +33,8 @@ Architecture: any
 Depends: libqtpropertybrowser4 (= ${binary:Version}),
          ${shlibs:Depends},
          ${misc:Depends}
+Breaks: libcamitk3
+Replaces: libcamitk3
 Description: Computer Assisted Medical Intervention Tool Kit - runtime
  Helps researchers and clinicians to easily and rapidly collaborate in
  order to prototype CAMI applications, that feature medical images,
@@ -40,17 +42,17 @@ Description: Computer Assisted Medical Intervention Tool Kit - runtime
  .
  This package contains the shared libraries needed to run CamiTK applications.
 
-Package: libcamitk4-dev
+Package: libcamitk-dev
 Architecture: any
 Section: libdevel
 Depends: libcamitk4 (= ${binary:Version}),
-         libqtpropertybrowser4-dev,
+         libqtpropertybrowser-dev,
          ${misc:Depends},
          ${shlibs:Depends}
 Recommends: camitk-imp
 Suggests: camitk-actionstatemachine
 Breaks: libcamitk3-dev
-Replaces: libcamitk3-dev
+Replaces: libcamitk3-dev, libcamitk4-dev
 Description: Computer Assisted Medical Intervention Tool Kit - development
  Helps researchers and clinicians to easily and rapidly collaborate in
  order to prototype CAMI applications, that feature medical images,
@@ -64,6 +66,8 @@ Package: libcamitk4-data
 Architecture: all
 Section: doc
 Depends: ${misc:Depends}
+Breaks: libcamitk3-data
+Replaces: libcamitk3-data
 Description: Computer Assisted Medical Intervention Tool Kit - data
  Helps researchers and clinicians to easily and rapidly collaborate in
  order to prototype CAMI applications, that feature medical images,
@@ -75,6 +79,8 @@ Package: libcamitk4-doc
 Architecture: all
 Section: doc
 Depends: ${misc:Depends}
+Breaks: libcamitk3-doc
+Replaces: libcamitk3-doc
 Description: Computer Assisted Medical Intervention Tool Kit - documentation
  Helps researchers and clinicians to easily and rapidly collaborate in
  order to prototype CAMI applications, that feature medical images,
@@ -122,6 +128,8 @@ Package: libqtpropertybrowser4
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends}
+Breaks: libqtpropertybrowser3
+Replaces: libqtpropertybrowser3
 Description: Qt Property Browser Library - runtime
  A framework providing a set of graphical editors for
  Qt properties similar to the one used in Qt Designer.
@@ -129,14 +137,14 @@ Description: Qt Property Browser Library - runtime
  This package contains the shared libraries needed to run applications
  linked against libqtpropertybrowser4.
 
-Package: libqtpropertybrowser4-dev
+Package: libqtpropertybrowser-dev
 Architecture: any
 Section: libdevel
 Depends: libqtpropertybrowser4 (= ${binary:Version}),
          ${misc:Depends},
          ${shlibs:Depends}
 Breaks: libqtpropertybrowser3-dev
-Replaces: libqtpropertybrowser3-dev
+Replaces: libqtpropertybrowser3-dev, libqtpropertybrowser4-dev
 Description: Qt Property Browser Library - development
  A framework providing a set of graphical editors for
  Qt properties similar to the one used in Qt Designer.
diff --git a/debian/rules b/debian/rules
index 68fa5d6..2cb712a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,8 +14,8 @@ VER_SHORT=$(VER_MAJOR).$(VER_MINOR)
 # package aliases (see d/control)
 pkg_lib = libcamitk$(VER_MAJOR)
 pkg_qpb = libqtpropertybrowser$(VER_MAJOR)
-pkg_dev = libcamitk$(VER_MAJOR)-dev
-pkg_qpb_dev = libqtpropertybrowser$(VER_MAJOR)-dev
+pkg_dev = libcamitk-dev
+pkg_qpb_dev = libqtpropertybrowser-dev
 pkg_data = libcamitk$(VER_MAJOR)-data
 pkg_doc = libcamitk$(VER_MAJOR)-doc
 pkg_imp = camitk-imp
@@ -74,7 +74,7 @@ override_dh_auto_test-arch:
 	# Use the CamiTK test suite
 	# Note: all tests require an X server, xvfb-run is needed to have a virtual one
 	# Another way: xvfb-run --auto-servernum $(MAKE) -C camitk-build ARGS="-V" test
-	(cd camitk-build && xvfb-run --auto-servernum ctest -V --timeout 600)
+	(cd camitk-build && xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" ctest -V --timeout 600)
 
 # make packages
 override_dh_install:
@@ -123,7 +123,7 @@ override_dh_install:
 	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-wizard.1
 	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/applications/camitk-wizard.desktop
 	# not ship anymore (bug? referenced in desktop file)
-	#dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/pixmaps/camitk-wizard.xpm
+	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/share/pixmaps/camitk-wizard.xpm
 	# cepgenerator
 	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/bin/camitk-cepgenerator
 	dh_installman -p$(pkg_dev) debian/tmp/usr/share/man/man1/camitk-cepgenerator.1
diff --git a/debian/tests/config b/debian/tests/config
index d66ae2a..3c8657d 100644
--- a/debian/tests/config
+++ b/debian/tests/config
@@ -2,118 +2,197 @@
 # Testing the installation: the version, paths and number of extensions should be correct
 # This test entirely depends on the CamitK version (version string, number of extensions...)
 # (see the expectedConfigOutput)
-#
-# TODO: add complete library tests using cepgenerator
+# 
+# echo $? get the last returned value of the script
+# a return value of 0 indicates success (by convention)
+# The value return by this script corresponds to the config test that failed
+# (see log for config test id)
+# 
 set -e
-EXPECTED_CONFIG_OUTPUT=$(mktemp)
-CONFIG_OUTPUT=$(mktemp)
-DIFF_OUTPUT=$(mktemp)
-
-# Clean up temporary files
-cleanExit () {
-	echo "Exiting (cleaning up)"
-	rm -f $EXPECTED_CONFIG_OUTPUT $CONFIG_OUTPUT $DIFF_OUTPUT
-	# exit with the given status
-	exit $1
+
+# cleanup on exit
+cleanup() {
+    # backup the current exit status
+    currentExitValue=$?
+    # cleanup current dir
+    rm -rf $workingDir
+    # use the backup value (otherwise the result of the "rm -rf" command above will
+    # be used, and that's probably always 0 !)
+    exit $currentExitValue
 }
 
-# depending on the CamiTK version, the output is different
-expectedConfigOutput () {
-
-  if [ "$1" = "4.0.0" ]; then
-    cat <<EOF > $EXPECTED_CONFIG_OUTPUT
-CamiTK 4.0.0
-- CamiTK version......................... CamiTK 4.0.0
-- CamiTK Short Version................... camitk-4.0
-- CamiTK SO NAME......................... 4
-- CamiTK Global Installation Directory... /usr
-- Component Extension Directories........ /usr/lib/camitk-4.0/components
-- Action Extension Directories........... /usr/lib/camitk-4.0/actions
-- Number of Component Extensions......... 11 (locations: 11 global, 0 local, 0 in working directory, 0 by user)
-- Number of File Extensions Supported.... 35
-- Number of Action Extensions............ 19 (locations: 19 global, 0 local, 0 in working directory, 0 by user)
-- Number of Actions...................... 91
-EOF
-  fi
+# if a problem occurs, call the clean method
+trap "cleanup" 0 INT QUIT ABRT PIPE TERM EXIT
 
-  if [ "$1" = "3.4.0" ]; then
-    cat <<EOF > $EXPECTED_CONFIG_OUTPUT
-CamiTK 3.4.0
-- CamiTK version......................... CamiTK 3.4.0
-- CamiTK Short Version................... camitk-3.4
-- CamiTK SO NAME......................... 3
-- CamiTK Global Installation Directory... /usr
-- Component Extension Directories........ /usr/lib/camitk-3.4/components
-- Action Extension Directories........... /usr/lib/camitk-3.4/actions
-- Number of Component Extensions......... 11 (locations: 11 global, 0 local, 0 in working directory, 0 by user)
-- Number of File Extensions Supported.... 35
-- Number of Action Extensions............ 18 (locations: 18 global, 0 local, 0 in working directory, 0 by user)
-- Number of Actions...................... 81
-EOF
-  fi
+# --------------------------------------------------------------------------
+#
+# Get ready
+#
+# --------------------------------------------------------------------------
+echo "Checking camitk configuration..."
+exitStatus=0 # nothing bad. By convention exit 0 indicates success
 
-  if [ "$1" = "3.3.2" ]; then
-    cat <<EOF > $EXPECTED_CONFIG_OUTPUT
-CamiTK 3.3.2
-- CamiTK version......................... CamiTK 3.3.2
-- CamiTK Short Version................... camitk-3.3
-- CamiTK SO NAME......................... 3
-- CamiTK Global Installation Directory... /usr
-- Component Extension Directories........ /usr/lib/camitk-3.3/components
-- Action Extension Directories........... /usr/lib/camitk-3.3/actions
-- Number of Component Extensions......... 12
-- Number of Action Extensions............ 71
-EOF
-  fi
+echo "- Creating temporary directory"
+workingDir=$(mktemp --tmpdir -d camitk-test-tmp.XXXXXXXXXX)
+cd $workingDir
 
-  if [ "$1" = "3.2.2" ]; then
-    cat <<EOF > $EXPECTED_CONFIG_OUTPUT
-- CamiTK version......................... CamiTK 3.2.2
-- CamiTK Short Version................... camitk-3.2
-- CamiTK SO NAME......................... 3
-- CamiTK Global Installation Directory... /usr
-- Component Extension Directories........ /usr/lib/camitk-3.2/components
-- Action Extension Directories........... /usr/lib/camitk-3.2/actions
-- Number of Component Extensions......... 10
-- Number of Action Extensions............ 65
-- Registered components (G=Global, L=Local, W=Working, U=User):
-EOF
+echo "- Get CamiTK configuration"
+camitkConfig=$(xvfb-run --auto-servernum --server-num=1 camitk-config --config)
+
+# check below the functions for all the tests
+
+# ---------------------- expected value ----------------------
+getExpectedValue() {
+  case "$1" in
+    "CamiTK Short Version")
+      case "$1" in
+        "jessie")
+          echo "camitk-3.3" 
+          ;;    
+        "sid" | *)
+          echo "camitk-4.0"
+          ;;
+      esac
+      ;;
+    "CamiTK Global Installation Directory")
+        # always the same value
+        echo "/usr"
+        ;;
+    "Number of Component Extensions")
+      case "$1" in
+        "jessie")
+          echo "12" 
+          ;;    
+        "sid" | *)
+          echo "11"
+          ;;
+      esac
+      ;;       
+    "Number of Action Extensions")
+      case "$1" in
+        "jessie")
+          echo "71" 
+          ;;    
+        "sid" | *)
+          echo "19"
+          ;;
+      esac
+      ;;
+    "Number of File Extensions Supported")
+      case "$1" in
+        "jessie" | "sid" | *)
+          echo "35"
+          ;;
+      esac
+      ;;
+    "Number of Actions")
+      case "$1" in
+        "jessie")
+          echo "81"
+          ;;
+         "sid" | *)
+          echo "91"
+          ;;
+      esac
+      ;;
+  esac
+}
+
+# ---------------------- installed version ----------------------
+getInstalledVersion() {
+  echo $(echo $camitkConfig | cut -f2 -d" ")
+}
+
+checkInstalledVersion() {
+  case "$1" in
+    "4.0.3")
+      echo "sid"
+      ;;
+    "3.3.2")
+      echo "jessie"
+      ;;
+    *)
+      echo "unknown"
+      ;;
+  esac
+}
+
+# ---------------------- extension count ----------------------
+getExtensionCount() {
+  echo $(echo "$camitkConfig" | grep "\[G\]" | wc -l)
+}
+
+getExpectedExtensionCount() {
+  case "$1" in
+    "jessie")
+      echo "83" 
+      ;;    
+    "sid" | *) 
+      echo "30" 
+      ;;
+  esac
+}
+
+# ---------------------- get config ----------------------
+# get a specific value from config, text to parse from
+# camitk-config --config is the first parameter of the function
+# get the value after the string "... " and before the first space
+getConfigValue() {
+  echo $(echo "$camitkConfig" | grep "$1" | sed 's/^.*\.\.\. //g' | cut -f1 -d" ")
+}
+
+# ---------------------- check value ----------------------
+# use camitk-config to check a value and compare to 
+# expected value
+checkValue() {
+  checkedValue="$1"
+  value=$(getConfigValue "$checkedValue")
+  echo "$checkValueId- $checkedValue: $value"
+  expected=$(getExpectedValue "$checkedValue")
+  if [ "$value" != "$expected" ]; then
+    echo "Error: unexpected $checkedValue ($value != $expected)"
+    exitStatus=$checkValueId
+  else
+    echo "OK"
   fi
+  # increase id
+  checkValueId=$((checkValueId+1))
 }
 
-# if a problem occurs, call the clean method
-trap cleanExit INT QUIT ABRT TERM PIPE
-
-# First determine CamiTK version
-CAMITK_VERSION=$(xvfb-run --auto-servernum --server-num=1 camitk-config --completeVersion | cut -f2 -d" ")
-echo "Detected CamiTK version is $CAMITK_VERSION"
-
-# build the expected output string
-expectedConfigOutput $CAMITK_VERSION
-
-# run the config diagnosis (skipping the user/path dependent part using sed)
-if [ "$CAMITK_VERSION" = "4.0.0" ]; then
-  xvfb-run --auto-servernum --server-num=1 camitk-config --config | sed -n "1,4p; 9,9p; 13,18p" > $CONFIG_OUTPUT
-elif [ "$CAMITK_VERSION" = "3.4.0" ]; then
-  xvfb-run --auto-servernum --server-num=1 camitk-config --config | sed -n "1,5p; 9,14p" > $CONFIG_OUTPUT
-elif [ "$CAMITK_VERSION" = "3.3.2" ] || [ "$CAMITK_VERSION" = "3.2.2" ]; then
-  # previous version had less information to compare to
-  xvfb-run --auto-servernum --server-num=1 camitk-config --config | sed -n "1,5p; 9,12p" > $CONFIG_OUTPUT
+# --------------------------------------------------------------------------
+#
+# All tests are here
+#
+# --------------------------------------------------------------------------
+
+installedVersion=$(getInstalledVersion)
+echo "1- Detected installed CamiTK version is $installedVersion"
+version=$(checkInstalledVersion $installedVersion)
+if [ "$version" = "unknown" ]; then
+  echo -n "Error: unexpected version "
+  exitStatus=1
 else
-  echo "Can not retrieve any information: unknown CamiTK version (detected version: $CAMITK_VERSION)" > $CONFIG_OUTPUT
+  echo -n "OK "
 fi
+echo "($version)"
 
-# compare output to expected output
-echo "Checking configuration..."
-
-# || true is to ignore the output of the diff (we need to know more, the set -e would stop the execution of the script here
-# if || true was not added and there was a difference between the two files
-diff --context=1 --suppress-common-lines "$CONFIG_OUTPUT" "$EXPECTED_CONFIG_OUTPUT" > $DIFF_OUTPUT || true
-if [ -s $DIFF_OUTPUT ]; then
-    echo "CamiTK $CAMITK_VERSION configuration: Failed"
-    cat $DIFF_OUTPUT
-    false
+value=$(getExtensionCount)
+echo "2- Number of extensions: $value"
+expected=$(getExpectedExtensionCount $version)
+if [ "$value" -ne "$expected" ]; then
+  echo "Error: unexpected number of globally installed extensions ($value != $expected)"
+  exitStatus=1
 else
-    echo "CamiTK $CAMITK_VERSION configuration: OK"
-    true
+  echo "OK"
 fi
+
+# init the id (next test is the third test)
+checkValueId=3
+checkValue "CamiTK Short Version"
+checkValue "CamiTK Global Installation Directory"
+checkValue "Number of Component Extensions"
+checkValue "Number of Action Extensions"
+checkValue "Number of File Extensions Supported"
+checkValue "Number of Actions"
+
+exit $exitStatus
diff --git a/debian/tests/control b/debian/tests/control
index 550f505..3b55a26 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,2 @@
-Tests: config
-Depends: libcamitk4 (>=4.0.0), xvfb, xauth
+Tests: config wizard
+Depends: libcamitk4-dev (>=4.0.0), xvfb, xauth
\ No newline at end of file
diff --git a/debian/tests/wizard b/debian/tests/wizard
new file mode 100644
index 0000000..b686822
--- /dev/null
+++ b/debian/tests/wizard
@@ -0,0 +1,471 @@
+#!/bin/sh
+# Testing the installation of the dev tools
+# cepgenerator and devtools
+# 
+# echo $? get the last returned value of the script
+# 
+# TODO check control file syntax (to be able to put two test, cf libxml2)
+#
+# TODO add complete library tests using cepgenerator
+# This can be done using exampleLibraryAction.xml 
+# + adding a real action in there 
+# + adding a component
+# + adding a test file
+# + adding source code files :
+#   ActionDoSomething.cpp in 
+#   EmptyComponent.cpp to use the library
+#   EmptyLibrary.h EmptyLibrary.cpp
+# + add "echo "#include "ActionDoSomething.cpp"" >> actions/emptyaction/Action.cpp"
+# and compile only then
+# @see the shaker lib turorial
+# 
+#
+# TODO add a complete example with all the possible Property types
+# @see the property tutorial
+#
+# TODO add another family of test using testaction and testcomponent on cepgenerated action/components
+# 
+
+set -e
+
+# To test with different library values uncomment this:
+# CMAKE_OPTIONS="-DVTK_DIR:PATH=/opt/vtk6/lib/cmake/vtk-6.3 -DITK_DIR:PATH=/opt/vtk6/lib/cmake/ITK-4.9 -DGDCM_DIR:PATH=/opt/vtk6/lib/gdcm-2.6"
+
+# cleanup on exit
+cleanup() {
+    # backup the current exit status
+    currentExitValue=$?
+    # cleanup current dir
+    rm -rf $workingDir
+    # use the backup value (otherwise the result of the "rm -rf" command above will
+    # be used, and that's probably always 0 !)
+    exit $currentExitValue
+}
+
+# if a problem occurs, call the clean method
+trap "cleanup" 0 INT QUIT ABRT PIPE TERM EXIT
+
+# --------------------------------------------------------------------------
+#
+# Get ready
+#
+# --------------------------------------------------------------------------
+
+echo "Checking camitk-dev installation..."
+exitStatus=0 # nothing bad. By convention exit 0 indicates success
+checkValueId=1 # test id starts at 1
+
+# create working directory
+workingDir=$(mktemp --tmpdir -d camitk-test-tmp.XXXXXXXXXX)
+
+getWorkingDirExtensionCount() {
+  echo $(xvfb-run --auto-servernum --server-num=1 camitk-config --config | grep "\[W\]" | wc -l)
+}
+
+
+# --------------------------------------------------------------------------
+
+cd $workingDir
+
+
+# ---------------------- exampleComponents.xml ----------------------
+# Example taken from distributed source ./sdk/applications/cepgenerator/testdata/exampleComponents.xml
+cat <<EOF > exampleComponents.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<cep
+    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xmlns='http://camitk.imag.fr/cepcoreschema'
+    xsi:schemaLocation='http://camitk.imag.fr/cepcoreschema ../Cep.xsd'>
+    <name>Example Of Tinman With Components</name>
+    <contact>
+        <email>Celine.Fouard at imag.fr</email>
+    </contact>
+    <description>Tinman Test file containing several kinds of Component Extensions.</description>
+    <copyright><![CDATA[/* ****************************************************************************
+$USERDEF_LICENCE_BEGIN$
+CamiTK - Computer Assisted Medical Intervention ToolKit
+(c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
+        
+Visit http://camitk.imag.fr for more information
+        
+This file is part of CamiTK.
+        
+$CEP_NAME$ is under the following licence:
+A specific private licence, just to test Tinman licence managing
+        
+$USERDEF_LICENCE_END$
+*************************************************************************** */
+    ]]></copyright>
+    
+    <componentExtensions>
+        <componentExtension>
+            <name>Example with no file suffix</name>
+            <description>
+                This component tests the ability of Tinman to create and make 
+                compilable and executable component extensions which do not
+                handle any file suffix (components should then be created from actions).
+            </description>
+            <components>
+                <component>
+                    <name>my own cube</name>
+                    <description>A Mesh Cube</description>
+                    <representation>Mesh</representation>
+                    <properties>
+                        <parameter name="size"  type="int" defaultValue="5" description="An integer."/>
+                        <parameter name="color" type="QColor" description="A QColor."/>
+                    </properties>
+                </component>
+            </components>
+        </componentExtension>
+        <componentExtension>
+            <name>Example with one file suffix</name>
+            <description>Simple Mixed component extension handling .example files</description>
+            <components>
+                <component>
+                    <name>Tinman Example File</name>
+                    <description>
+                        Simple component handling .example files with no representation.
+                    </description>
+                    <representation>None</representation>
+                    <fileSuffix>example</fileSuffix>
+                </component>
+            </components>
+        </componentExtension>
+
+        <componentExtension>
+            <name>Example with several file suffixes</name>
+            <description>Simple Mixed component extension handling .example files</description>
+            <components>
+                <component>
+                    <name>Tinman A File</name>
+                    <description>
+                        Simple component handling .a files with an image representation.
+                    </description>
+                    <representation>Image</representation>
+                    <properties>
+                        <parameter name="aa"  type="int" defaultValue="2" description="An integer."/>
+                    </properties>
+                    <fileSuffix>a</fileSuffix>
+                </component>
+                <component>
+                    <name>Tinman B File</name>
+                    <description>
+                        Simple component handling .b files with a Mesh representation.
+                    </description>
+                    <representation>Image</representation>
+                    <properties>
+                        <parameter name="bb"  type="bool" description="A boolean."/>
+                    </properties>
+                    <fileSuffix>b</fileSuffix>
+                </component>
+                <component>
+                    <name>Tinman C File</name>
+                    <description>
+                        Simple component handling .c files with no representation.
+                    </description>
+                    <representation>None</representation>
+                    <properties>
+                        <parameter name="cc"  type="double" defaultValue="3.8" description="A double."/>
+                    </properties>
+                    <fileSuffix>c</fileSuffix>
+                </component>
+            </components>
+        </componentExtension>
+    </componentExtensions>
+</cep>
+EOF
+
+
+# ---------------------- actionsExamplesLicence.xml ----------------------
+# Example taken from distributed source ./sdk/applications/cepgenerator/testdata/actionsExamplesLicence.xml
+cat <<EOF > actionsExamplesLicence.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<cep    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns="http://camitk.imag.fr/cepcoreschema"
+        xsi:schemaLocation="http://camitk.imag.fr/cepcoreschema ../cep.xsd">
+    <name>CEP created by Wizard</name>
+    <contact>
+        <email>Celine.Fouard at imag.fr</email> 
+    </contact>
+    <description>Example of empty CEP</description>
+    <copyright><![CDATA[/*****************************************************************************
+$USERDEF_LICENCE_BEGIN$
+CamiTK - Computer Assisted Medical Intervention ToolKit
+(c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
+        
+Visit http://camitk.imag.fr for more information
+        
+This file is part of CamiTK.
+        
+$CEP_NAME$ is under the following licence:
+A specific private licence
+$USERDEF_LICENCE_END$
+****************************************************************************/
+    ]]></copyright>
+    <actionExtensions>
+        <actionExtension>
+            <name>Wizard created image actions</name>
+            <description>This action extension proposes several actions on image components</description>
+            <!-- <directoryName>imagewizardactions</directoryName> -->
+            <actions>
+                <action>
+                    <name>Example of Image Action</name>
+                    <description>Example of simple action on image component.</description>
+                    <component>ImageComponent</component>
+                    <classification>
+                        <family>CreatedByWizard</family>
+                        <tag>Image</tag>
+                    </classification>
+                    <parameters>
+                        <parameter name="alpha" type="int" description="An integer."/>
+                        <parameter name="beta"  type="bool" description="A boolean."/>
+                    </parameters>
+                </action>
+                <action>
+                    <name>Example of Image ITK Filter</name>
+                    <description>Example of an itk image action.</description>
+                    <component>ImageComponent</component>
+                    <classification>
+                        <family>CreatedByWizard</family>
+                        <tag>Image</tag>
+                        <tag>itk</tag>
+                        <itkFilter outputType="Same as Input"/>
+                    </classification>
+                    <parameters>
+                        <parameter name="gamma" type="QDate" description="A QDate."/>
+                        <parameter name="phi"  type="double" description="A double."/>
+                    </parameters>
+                </action>
+            </actions>
+            <dependencies>
+                <dependency type="library" name="itk"/>
+            </dependencies>
+        </actionExtension>
+        <actionExtension>
+            <name>Wizard created mesh actions</name>
+            <description>This action extension proposes an action on mesh components</description>
+            <actions>
+                <action>
+                    <name>Example of Mesh Action</name>
+                    <description>Example of action on a mesh.</description>
+                    <component>MeshComponent</component>
+                    <classification>
+                        <family>CreatedByWizard</family>
+                        <tag>Mesh</tag>
+                        <tag>Example</tag>
+                    </classification>
+                    <parameters>
+                        <parameter name="A long parameter name" type="QColor" description="A QColor."/>
+                    </parameters>
+                </action>
+            </actions>
+        </actionExtension>
+    </actionExtensions>
+    
+</cep>
+EOF
+
+
+# ---------------------- actionsExamplesNoLicence.xml ----------------------
+# Example taken from distributed source ./sdk/applications/cepgenerator/testdata/actionsExamplesNoLicence.xml
+cat <<EOF > actionsExamplesNoLicence.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<cep xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns="http://camitk.imag.fr/cepcoreschema"
+    xsi:schemaLocation="http://camitk.imag.fr/cepcoreschema ../cep.xsd">
+    <name>CEP created by Wizard</name>
+    <contact>
+        <email>Celine.Fouard at imag.fr</email> 
+    </contact>
+    <description>Example of empty CEP</description>
+    <actionExtensions>
+        <actionExtension>
+            <name>Wizard created image actions</name>
+            <description>This action extension proposes several actions on image components</description>
+            <!-- <directoryName>imagewizardactions</directoryName> -->
+            <actions>
+                <action>
+                    <name>Example of Image Action</name>
+                    <description>Example of simple action on image component.</description>
+                    <component>ImageComponent</component>
+                    <classification>
+                        <family>CreatedByWizard</family>
+                        <tag>Image</tag>
+                    </classification>
+                    <parameters>
+                        <parameter name="alpha" type="int" description="An integer."/>
+                        <parameter name="beta"  type="bool" description="A boolean parameter."/>
+                    </parameters>
+                </action>
+                <action>
+                    <name>Example of Image ITK Filter</name>
+                    <description>Example of an itk image action.</description>
+                    <component>ImageComponent</component>
+                    <classification>
+                        <family>CreatedByWizard</family>
+                        <tag>Image</tag>
+                        <tag>itk</tag>
+                        <itkFilter outputType="Same as Input"/>
+                    </classification>
+                    <parameters>
+                        <parameter name="gamma" type="QDate" description="Using class QDate as parameter type"/>
+                        <parameter name="phi"  type="double" description="Phi is <i>another parameter</i>" />
+                    </parameters>
+                </action>
+            </actions>
+            <dependencies>
+                <dependency type="library" name="itk"/>
+            </dependencies>
+        </actionExtension>
+        <actionExtension>
+            <name>Wizard created mesh actions</name>
+            <description>This action extension proposes an action on mesh components</description>
+            <actions>
+                <action>
+                    <name>Example of Mesh Action</name>
+                    <description>Example of action on a mesh.</description>
+                    <component>MeshComponent</component>
+                    <classification>
+                        <family>CreatedByWizard</family>
+                        <tag>Mesh</tag>
+                        <tag>Example</tag>
+                    </classification>
+                    <parameters>
+                        <parameter name="A long parameter name" type="QColor" description="This is a very long description<br/>(for a very long parameter name)"/>
+                    </parameters>
+                </action>
+            </actions>
+        </actionExtension>
+    </actionExtensions>
+    
+</cep>
+EOF
+
+
+# ---------------------- actionAndComponent.xml ----------------------
+# Example taken from distributed source ./sdk/applications/cepgenerator/testdata/actionAndComponent.xml
+cat <<EOF > actionAndComponent.xml
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<cep xmlns="http://camitk.imag.fr/cepcoreschema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://camitk.imag.fr/cepcoreschema Cep.xsd">
+  <name>Yet another example of CEP</name>
+  <contact>
+    <email>Emmanuel.Promayon at imag.fr</email>
+  </contact>
+  <description>This CEP contains a new type of component and an action that can do something with it.
+This test the link between an action and a component defined in the same CEP.</description>
+  <actionExtensions>
+    <actionExtension>
+      <name>Another Example Of An Action Extension</name>
+      <description>This extension description is really useless.</description>
+      <actions>
+        <action>
+          <name>DoSomethingOnSpecific</name>
+          <description>This description is void.</description>
+          <component>SpecificMeshBasedComponent</component>
+          <classification>
+            <family>Testing CepGenerator</family>
+          </classification>
+          <parameters>
+            <parameter defaultValue="100.0" description="Testing double" editable="true" name="testDouble" type="double" unit=""/>
+          </parameters>
+        </action>
+      </actions>
+      <dependencies>
+        <dependency name="specificcomponent" type="component"/>
+      </dependencies>
+    </actionExtension>
+  </actionExtensions>
+  <componentExtensions>
+    <componentExtension>
+      <name>Specific component</name>
+      <description>This extension description a new / specific component</description>
+      <components>
+        <component>
+          <name>SpecificMeshBasedComponent</name>
+          <description>My description is useless...</description>
+          <representation>Mesh</representation>
+          <properties>
+            <parameter defaultValue="false" description="Testing bools" editable="true" name="testBool" type="bool" unit=""/>
+            <parameter defaultValue="QColor(255, 255, 255, 255)" description="Testing color" editable="true" name="testColor" type="QColor" unit=""/>
+            <parameter defaultValue="QVector3D(0.0, 0.0, 0.0)" description="test 3D vector" editable="true" name="testVector3D" type="QVector3D" unit=""/>
+          </properties>
+          <fileSuffix>specific</fileSuffix>
+        </component>
+      </components>
+    </componentExtension>
+  </componentExtensions>
+</cep>
+EOF
+
+# ---------------------- empty.xml ----------------------
+# Example taken from distributed source ./sdk/applications/cepgenerator/testdata/empty.xml
+cat <<EOF > empty.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<cep xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns="http://camitk.imag.fr/cepcoreschema"
+        xsi:schemaLocation="http://camitk.imag.fr/cepcoreschema ../cep.xsd">
+    <name>empty</name>
+    <contact>
+        <email>Celine.Fouard at imag.fr</email> 
+        <email>Emmanuel.Promayon at imag.fr</email>
+    </contact>
+    <description>Example of empty CEP</description>    
+</cep>
+EOF
+
+# ---------------------- generateConfigureAndMake ----------------------
+generateConfigureAndMake() {
+  # generate
+  testDirName=$(basename $1 .xml)
+  cd $workingDir
+  rm -rf $testDirName
+  mkdir $testDirName
+  camitk-cepgenerator -f $1 -d $testDirName
+  cd $testDirName
+  # get the created dir name
+  srcDirName=$(ls)
+  # configure
+  mkdir build
+  cd build
+  cmake $CMAKE_OPTIONS ../$srcDirName 
+  # build (parallel)
+  make -j9
+}
+
+# ---------------------- testcepfile ----------------------
+# @param xmlfile
+# @param expected number of created extensions
+testcepfile() {
+  generateConfigureAndMake $1
+  expectedValue="$2"
+
+  # check if everything is compiled and can be loaded
+  value=$(getWorkingDirExtensionCount)
+  echo "$checkValueId- Check Number of extensions for $1: $value"
+  echo "$(xvfb-run --auto-servernum --server-num=1 camitk-config --config | grep "\[W\]")"
+  if [ "$value" -ne "$expectedValue" ]; then
+    echo "Error: unexpected number of extensions installed in the working directory ($value != $expectedValue)"
+    exitStatus=$checkValueId
+  else
+    echo "OK"
+  fi
+  # increase id
+  checkValueId=$((checkValueId+1))
+}
+
+# --------------------------------------------------------------------------
+#
+# All tests are here
+#
+# --------------------------------------------------------------------------
+
+# --------------------------------------------------------------------------
+
+# testcepfile cep.xml nrOfExcpectedNewExtensions
+testcepfile exampleComponents.xml 2
+testcepfile actionsExamplesLicence.xml 2
+testcepfile actionsExamplesNoLicence.xml 2
+testcepfile actionAndComponent.xml 2
+testcepfile empty.xml 0
+
+exit $exitStatus
\ No newline at end of file

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



More information about the debian-med-commit mailing list