tasn pushed a commit to branch master.
commit a1b35c44ac738b0703135cf46c3a452410db1428
Author: Tom Hacohen <[email protected]>
Date: Mon Apr 29 17:57:42 2013 +0100
Reduced some code duplicity.
---
src/scripts/exactness.in | 66 +++++++++++++++++++-----------------------------
1 file changed, 26 insertions(+), 40 deletions(-)
diff --git a/src/scripts/exactness.in b/src/scripts/exactness.in
index 85ef78a..fa37e5c 100755
--- a/src/scripts/exactness.in
+++ b/src/scripts/exactness.in
@@ -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
--
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr