Commit ad1aa25d authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED checking the right thing (and verifying result properly)

parent 4a591878
......@@ -29,7 +29,7 @@
set -e
#DEBUG
# Uncomment next line to debug
# set -x
#DEBUG
......@@ -101,21 +101,17 @@ cleanup() {
checkcommand() {
# usage: checkcommand name
if [ "$inBuild" == "0" ] ; then
echo "===== Checking $2 (as a command) ====="
# check if current build is on windows debug version
if ! hash ${2} 2>/dev/null; then
echo "===== Not found: $camitkConfig on $osName ====="
false
if ! hash ${1} 2>/dev/null; then
echo "Executable not found"
else
true
echo "[OK]"
fi
else
echo "===== Checking $2 (as a file) ====="
if [ ! -x ${2} ] ; then
echo "===== Not found: $camitkConfig on $osName ====="
false
if [ ! -x ${1} ] ; then
echo "File not found or not executable"
else
true
echo "[OK]"
fi
fi
}
......@@ -172,18 +168,28 @@ init() {
export XAUTHORITY=/dev/null
fi
# Check if current build is on windows debug version
if [ "$(checkcommand $camitkConfig)" != "0" ] ; then
# Checking if current build is on windows debug version
echo "===== Checking $camitkConfig ====="
checkCamiTKConfig=$(checkcommand $camitkConfig)
echo $checkCamiTKConfig
if [ "$checkCamiTKConfig" != "[OK]" ] ; then
if [[ "$osName" == "Windows" ]]; then
camitkConfig=$camitkConfig-debug
checkcommand $camitkConfig
echo "===== Checking $camitkConfig ====="
checkCamiTKConfig=$(checkcommand $camitkConfig)
echo $checkCamiTKConfig
fi
fi
echo "===== Using $camitkConfig on $osName ====="
if [ "$(checkcommand $camitkGenerator)" != "0" ] ; then
echo "===== Checking $camitkGenerator ====="
checkCamiTKGenerator=$(checkcommand $camitkGenerator)
echo $checkCamiTKGenerator
if [ "$checkCamiTKGenerator" != "[OK]" ] ; then
if [[ "$osName" == "Windows" ]]; then
camitkGenerator=$camitkGenerator-debug
checkcommand $camitkGenerator
echo "===== Checking $camitkGenerator ====="
checkCamiTKGenerator=$(checkcommand $camitkGenerator)
echo $checkCamiTKGenerator
fi
fi
echo "===== Using $camitkGenerator on $osName ====="
......
......@@ -20,6 +20,9 @@
set -e
# Uncomment next line to debug
# set -x
# cleanup on exit
cleanup() {
# backup the current exit status
......@@ -41,21 +44,17 @@ cleanup() {
checkcommand() {
# usage: checkcommand name
if [ "$inBuild" == "0" ] ; then
echo "===== Checking $2 (as a command) ====="
# check if current build is on windows debug version
if ! hash ${2} 2>/dev/null; then
echo "===== Not found: $2 on $osName ====="
false
if ! hash ${1} 2>/dev/null; then
echo "Executable not found"
else
true
echo "[OK]"
fi
else
echo "===== Checking $2 (as a file) ====="
if [ ! -x ${2} ] ; then
echo "===== Not found: $2 on $osName ====="
false
if [ ! -x ${1} ] ; then
echo "File not found or not executable"
else
true
echo "[OK]"
fi
fi
}
......@@ -71,12 +70,14 @@ init() {
workingDir=$(mktemp --tmpdir -d camitk-test-tmp.XXXXXXXXXX)
cd $workingDir
echo "===== Temporary directory created $workingDir ====="
camitkConfig="camitk-config"
else
# if -inbuild option is specified, then the next argument should be the build dir (as set by ${PROJECT_BINARY_DIR} by cmake
workingDir=$2
echo "===== Testing in build dir $workingDir ====="
inBuild=1
cd $workingDir
camitkConfig="bin/camitk-config"
fi
echo "===== Check OS ====="
......@@ -98,16 +99,16 @@ init() {
export XAUTHORITY=/dev/null
fi
# Check config executable
if [ "$inBuild" == "0" ] ; then
camitkConfig="camitk-config"
else
camitkConfig="bin/camitk-config"
fi
if [ "$(checkcommand $camitkConfig)" != "0" ] ; then
# Checking config executable
echo "===== Checking $camitkConfig ====="
checkCamiTKConfig=$(checkcommand $camitkConfig)
echo $checkCamiTKConfig
if [ "$checkCamiTKConfig" != "[OK]" ] ; then
if [[ "$osName" == "Windows" ]]; then
camitkConfig=$camitkConfig-debug
checkcommand $camitkConfig
echo "===== Checking ${camitkConfig} ====="
checkCamiTKConfig=$(checkcommand $camitkConfig)
echo $checkCamiTKConfig
fi
fi
}
......
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