Reduced some code duplicity.

This commit is contained in:
Tom Hacohen 2013-04-29 17:57:42 +01:00
parent 2a31033738
commit a1b35c44ac
1 changed files with 26 additions and 40 deletions

View File

@ -265,6 +265,12 @@ do_compare () {
DEBUG printf "do_compare()\n"
DEBUG echo orig dir: "$_orig_dir"
DEBUG echo dest dir: "$_dest_dir"
get_test_params "$1"
if [ $? -ne 0 ]; then
return 0;
fi
# This will compare files in 'orig' folder with files in _dest_dir
if [ $comp_unavail -ne 0 ]
then
@ -288,7 +294,7 @@ do_compare () {
fi
local files_list=
for test_name in $*
for test_name in $_test_name
do
rm "$_dest_dir"/comp_"$test_name"_[0-9]*.png &> /dev/null
files_list=( `ls "$_dest_dir"/"$test_name"_[0-9]*.png` )
@ -343,6 +349,22 @@ name_in_args () {
return 0
}
for_test_in_test_file_do () {
while read curline;
do
name_in_args "$curline" $*
_run_test=$(( $? + $_test_all ))
if [ $_run_test -ne 0 ]
then
$1 "$curline"
if [ $? -ne 0 ]
then
(( _n_exe_err++ ))
fi
fi
done < "$_test_file_name"
}
# Script Entry Point
OUR_LIBPATH="@libdir@/exactness"
@ -508,53 +530,17 @@ fi
if [ "$_record" ]
then
while read curline;
do
name_in_args "$curline" $*
_run_test=$(( $? + $_test_all ))
if [ $_run_test -ne 0 ]
then
do_record "$curline"
if [ $? -ne 0 ]
then
(( _n_exe_err++ ))
fi
fi
done < "$_test_file_name"
for_test_in_test_file_do do_record
fi
if [ "$_play" ]
then
while read curline;
do
name_in_args "$curline" $*
_run_test=$(( $? + $_test_all ))
if [ $_run_test -ne 0 ]
then
do_play "$curline"
if [ $? -ne 0 ]
then
(( _n_exe_err++ ))
fi
fi
done < "$_test_file_name"
for_test_in_test_file_do do_play
fi
if [ "$_compare" ]
then
while read curline;
do
name_in_args "$curline" $*
_run_test=$(( $? + $_test_all ))
if [ $_run_test -ne 0 ]
then
get_test_params "$curline"
if [ $? -eq 0 ]
then
do_compare "$_test_name"
fi
fi
done < "$_test_file_name"
for_test_in_test_file_do do_compare
fi
_n_tests_failed=0