Commit 90bf371d authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED config test is now only based on the major.minor version number

parent 163a934e
......@@ -4,14 +4,8 @@
# This test entirely depends on the CamitK version (version string, number of extensions...)
# (see the expectedConfigOutput)
#
# For a CamiTK major or minor version update:
# - update getExpectedValue for "sid"
# - update checkInstalledVersion for "sid"
# - update getExpectedExtensionCount for "sid"
#
# For a CamiTK hotfix update:
# - update checkInstalledVersion for "sid"
#
# For a CamiTK major or minor version update the expected number and release date
#
# 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
......@@ -130,19 +124,6 @@ getconfig() {
# ---------------------- expected value ----------------------
getExpectedValue() {
case "$1" in
"CamiTK Short Version")
case "$version" in
"upstream")
echo "camitk-4.1"
;;
"jessie")
echo "camitk-3.3"
;;
"sid" | *)
echo "camitk-4.1"
;;
esac
;;
"Global Installation Directory")
# for package test: it should always be /usr
echo "/usr"
......@@ -152,86 +133,89 @@ getExpectedValue() {
echo $(pwd) | sed -e "s+^/c+C:+"
;;
"Number of Component Extensions")
case "$version" in
"upstream")
case "$shortVersion" in
"4.0" | "4.1" | "4.2")
echo "14" # 11 in sdk, imaging and modeling and 3 in tutorials
;;
"jessie")
"3.3" | *)
echo "12"
;;
"sid" | *)
echo "11"
;;
esac
;;
"Number of Action Extensions")
case "$version" in
"upstream")
case "$shortVersion" in
"4.0" | "4.1" | "4.2")
echo "27" # 19 in sdk, imaging and modeling and 8 in tutorials
;;
"jessie")
echo "71"
;;
"sid" | *)
echo "19"
"3.3" | *)
echo "71"
;;
esac
;;
"Number of File Extensions Supported")
case "$version" in
"upstream")
case "$shortVersion" in
"4.0" | "4.1" | "4.2")
echo "37" # 34 in sdk, imaging and modeling and 3 in tutorials
;;
"jessie")
"3.3" | *)
echo "35"
;;
"sid" | *)
echo "34"
;;
esac
;;
"Number of Actions")
case "$version" in
"upstream")
echo "105" # 92 in sdk, imaging and modeling and 13 in tutorials
case "$shortVersion" in
"4.0" | "4.1" | "4.2")
echo "105" # 92 in sdk, imaging and modeling and 14 in tutorials
;;
"jessie")
"3.3" | *)
echo "81"
;;
"sid" | *)
echo "92"
;;
esac
;;
esac
}
# ---------------------- installed version ----------------------
# ---------------------- getInstalledVersion ----------------------
getInstalledVersion() {
echo $(echo $camitkConfig | head --lines=1 | cut -f5 -d" ")
}
checkInstalledVersion() {
case "$1" in
"4.0.4")
echo "sid"
;;
"3.3.2")
echo "jessie"
;;
*)
# try harder
numberedVersion=$(echo $camitkConfig | head --lines=1 | cut -f5 -d" " | cut -f1-3 -d".")
case "$numberedVersion" in
"4.1.0")
echo "upstream"
# ------------------- getReleaseDate -------------------
getReleaseDate() {
# get the release date of minor version
if [[ $1 =~ .*dev.* ]]; then
echo "not yet released"
else
case "$1" in
"3.0")
echo "7 July 2012"
;;
"3.1")
echo "1 March 2013"
;;
"3.2")
echo "26 June 2013"
;;
"3.3")
echo "4 March 2014"
;;
"3.4")
echo "31 October 2014"
;;
"3.5")
echo "29 January 2016"
;;
"4.0")
echo "22 July 2016"
;;
"4.1")
echo "15 July 2018"
;;
*)
echo "unknown version"
;;
esac
;;
esac
fi
}
# ---------------------- extension count ----------------------
......@@ -241,15 +225,12 @@ getExtensionCount() {
getExpectedExtensionCount() {
case "$1" in
"upstream")
"4.0" | "4.1" | "4.2")
echo "41" # 30 extensions in sdk, imaging and modeling and 11 extensions in tutorials
;;
"jessie")
echo "83"
"3.3" | *)
echo "12"
;;
"sid" | *)
echo "30"
;;
esac
}
......@@ -270,7 +251,7 @@ checkValue() {
echo "===== $checkValueId- $checkedValue: $value ====="
expected=$(getExpectedValue "$checkedValue")
if [ "$value" != "$expected" ]; then
echo "Error: unexpected $checkedValue ($value != $expected)"
echo "Error: unexpected $checkedValue (found $value vs $expected expected)"
exitStatus=$checkValueId
else
echo "OK"
......@@ -291,28 +272,29 @@ trap "cleanup" 0 INT QUIT ABRT PIPE TERM EXIT
init $*
getconfig
installedVersion=$(getInstalledVersion)
echo "===== 1- Detected installed CamiTK version is: [$installedVersion] ====="
version=$(checkInstalledVersion $installedVersion)
if [ "$version" = "unknown version" ]; then
echo -n "Error: unexpected version "
detectedVersion=$(getInstalledVersion)
shortVersion=$(echo $detectedVersion | cut -f1,2 -d".")
echo "===== 1- Detected installed CamiTK version is: [$detectedVersion] aka [$shortVersion] ====="
releaseDate=$(getReleaseDate $shortVersion)
if [ "$releaseDate" = "unknown version" ]; then
echo -n "Error: unknown version "
exitStatus=1
else
echo -n "OK "
fi
echo "($version)"
echo "(release date: $releaseDate)"
if [ "$inBuild" == "0" ] ; then
extensionRepository="G" # check for Globally installed extension
extensionRepository="G" # check for globally installed extension
else
extensionRepository="W" # check extension in current build dir
fi
value=$(getExtensionCount $extensionRepository)
echo "===== 2- Number of extensions: $value ====="
expected=$(getExpectedExtensionCount $version)
expected=$(getExpectedExtensionCount $shortVersion)
if [ "$value" -ne "$expected" ]; then
echo "Error: unexpected number of globally installed extensions ($value != $expected)"
echo "Error: unexpected number of globally installed extensions (found $value vs $expected expected)"
exitStatus=1
else
echo "OK"
......@@ -320,7 +302,6 @@ fi
# init the id (next test is the third test)
checkValueId=3
checkValue "CamiTK Short Version"
if [ "$inBuild" == "0" ] ; then
checkValue "Global Installation Directory"
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment