Code is more general (based on cgal_test)

This commit is contained in:
Laurent Saboret 2008-04-22 17:10:32 +00:00
parent 2ea6ea898f
commit bce9c4c7db
1 changed files with 70 additions and 34 deletions

View File

@ -1,42 +1,78 @@
#!/bin/bash #!/bin/bash
# ############################################################
# Test the Poisson Delaunay Reconstruction method with all off models in data folder # This application is a cross-platform version of cgal_test.
# # Applications must be already compiled.
############################################################
ERRORFILE=error.txt
# Find executable name (different on Windows and Unix) # Find executable name (different on Windows and Unix)
[ -f ./VC/debug/poisson_reconstruction_test.exe ] && PARAM_APPLICATION="./VC/debug/poisson_reconstruction_test.exe" find_executable()
[ -f ./VC/release/poisson_reconstruction_test.exe ] && PARAM_APPLICATION="./VC/release/poisson_reconstruction_test.exe" {
[ -f ./VC/x64/debug/poisson_reconstruction_test.exe ] && PARAM_APPLICATION="./VC/x64/debug/poisson_reconstruction_test.exe" PARAM_APPLICATION=""
[ -f ./VC/x64/release/poisson_reconstruction_test.exe ] && PARAM_APPLICATION="./VC/x64/release/poisson_reconstruction_test.exe" [ -f ./VC/debug/$1.exe ] && PARAM_APPLICATION="./VC/debug/$1.exe"
[ -x ./poisson_reconstruction_test ] && PARAM_APPLICATION="./poisson_reconstruction_test" [ -f ./VC/release/$1.exe ] && PARAM_APPLICATION="./VC/release/$1.exe"
if [ -z "$PARAM_APPLICATION" ]; then [ -f ./VC/x64/debug/$1.exe ] && PARAM_APPLICATION="./VC/x64/debug/$1.exe"
echo "Cannot find poisson_reconstruction_test executable" [ -f ./VC/x64/release/$1.exe ] && PARAM_APPLICATION="./VC/x64/release/$1.exe"
[ -x ./$1 ] && PARAM_APPLICATION="./$1"
echo "$PARAM_APPLICATION"
}
# run 1 test
run()
{
# Find exe
COMMAND="`find_executable $1`"
if [ -z "$COMMAND" ]; then
echo "Cannot find $1 executable"
exit 1 exit 1
fi fi
# run test (echo on) # Add params
set -x if [ -f $1.cmd ] ; then
$PARAM_APPLICATION data/*.off 2>&1 COMMAND="$COMMAND `cat $1.cmd`"
set +x fi
if [ -f $1.cin ] ; then
# COMMAND="cat $1.cin | $COMMAND"
# Test the Normal Estimation methods with all xyz models in data folder
#
# Find executable name (different on Windows and Unix)
[ -f ./VC/debug/normal_estimation_test.exe ] && PARAM_APPLICATION="./VC/debug/normal_estimation_test.exe"
[ -f ./VC/release/normal_estimation_test.exe ] && PARAM_APPLICATION="./VC/release/normal_estimation_test.exe"
[ -f ./VC/x64/debug/normal_estimation_test.exe ] && PARAM_APPLICATION="./VC/x64/debug/normal_estimation_test.exe"
[ -f ./VC/x64/release/normal_estimation_test.exe ] && PARAM_APPLICATION="./VC/x64/release/normal_estimation_test.exe"
[ -x ./normal_estimation_test ] && PARAM_APPLICATION="./normal_estimation_test"
if [ -z "$PARAM_APPLICATION" ]; then
echo "Cannot find normal_estimation_test executable"
exit 1
fi fi
# run test (echo on) # Run
set -x echo "------------------------------------------------------------------"
$PARAM_APPLICATION data/*.xyz 2>&1 echo "- Executing $1"
set +x echo "------------------------------------------------------------------"
echo
if eval $COMMAND 2>&1 ; then
echo " succesful execution of $1" >> $ERRORFILE
else
echo " ERROR: execution of $1" >> $ERRORFILE
fi
echo
}
# remove the previous error file
rm -f $ERRORFILE
touch $ERRORFILE
# run the tests
if [ $# -ne 0 ] ; then
for file in $* ; do
run $file
done
else
run analysis_test
run normal_estimation_test
run poisson_reconstruction_test
run smoothing_test
fi
# Recap results
echo "------------------------------------------------------------------"
echo "- Results"
echo "------------------------------------------------------------------"
echo
cat $ERRORFILE
echo
rm -f $ERRORFILE