bp=`basename $0 | sed s/^test_//`
in="$BP_DIR/bp_test/in/$bp.in"
out="$BP_DIR/bp_test/out/$bp.out"
-tmp="$BP_TMP/$bp.out"
-tmp_dir="$BP_TMP/test_tmp"
+tmp="$BP_TMP/$USER.$bp.out"
+tmp_dir="$BP_TMP/$USER.test_tmp"
log_file="$BP_TMP/$USER.test.log"
+# Function to run a given command (verbose).
function run
{
local command=$1
eval $command > /dev/null 2>&1
}
+# Function to run a given command (quiet).
function run_quiet
{
local command=$1
eval $command > /dev/null 2>&1
}
+# Function to assert no difference between
+# two given files.
function assert_no_diff
{
local src=$1
fi
}
+# Function to assert no difference between the content
+# of two given direcories (recursive).
+function assert_no_diff_dir
+{
+ local src_dir=$1
+ local dst_dir=$2
+
+ if [ ! -d $src_dir ]; then
+ echo_red "FAIL"
+ log "FAIL"
+ return
+ fi
+
+ if [ ! -d $dst_dir ]; then
+ echo_red "FAIL"
+ log "FAIL"
+ return
+ fi
+
+ local src_cksum=`find $src_dir -type f | grep -v "\.svn" | sort | xargs cat | cksum`
+ local dst_cksum=`find $dst_dir -type f | grep -v "\.svn" | sort | xargs cat | cksum`
+
+ if [ "$src_cksum" == "$dst_cksum" ]; then
+ echo_green "OK"
+ log "OK"
+ else
+ echo_red "FAIL"
+ log "FAIL"
+ fi
+}
+
+# Function to assert that all given files do exists.
function assert_files_exists
{
error=0
fi
}
+# Function to output a given message to the log file.
function log
{
local msg=$1
echo "$msg" >> $log_file
}
+# Function that renders a given message in ASCII green.
function echo_green
{
local msg=$1
echo -e "\033[32;38m$msg\033[0m"
}
+# Function that renders a given message in ASCII yellow.
function echo_yellow
{
local msg=$1
echo -e "\033[33;38m$msg\033[0m"
}
+# Function that renders a given message in ASCII red.
function echo_red
{
local msg=$1
echo -e "\033[31;38m$msg\033[0m"
}
+# Function to clean the temporary file.
function clean
{
if [ -f "$tmp" ]; then
fi
}
+# Function to test if the required version of Perl is installed.
function test_perl
{
echo -n "Testing Perl version ... "
fi
}
+# Function to test if a given Perl module is installed.
function test_perl_module
{
local module=$1
fi
}
+# Function to test if the required version of Ruby is installed.
function test_ruby
{
echo -n "Testing Ruby version ... "
fi
}
+# Function to test if a given Ruby gem is installed.
function test_ruby_gem
{
local gem=$1
fi
}
+# Function to test is a given auxillary program is in $PATH.
function test_aux_program
{
local program=$1
- echo -n "Checking auxiliary program - \"$program\": "
+ echo -n "Testing auxiliary program - \"$program\": "
if command -v $program >/dev/null; then
echo_green "OK"