URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [testbench/] [test] - Rev 1646
Go to most recent revision | Compare with Previous | Blame | View Log
#! /bin/sh
#
# Usage:
# test simulator_binary file_to_test
echo -n "Testing $2... "
# clean . and / characters
fn=`echo $2 | sed 's/[\/\.]//g'`
default_cfg_fn="default.cfg"
pre_sh_file="$2.pre.sh"
post_sh_file="$2.post.sh"
temp1="/tmp/${fn}_output_ok"
temp2="/tmp/${fn}_output"
temp3="/tmp/${fn}_output_tail"
temp4="/tmp/${fn}_error"
# run pre-execution script file
test -f $pre_sh_file
if test $? -eq 0; then
echo -n "(pre-exec $pre_sh_file) "
source $pre_sh_file
fi
# prepare simulator parameters
sim_param=
cfg_file="$2.cfg"
test -f $cfg_file
if test $? -eq 0; then
echo -n "(using $cfg_file) "
# load .cfg file
sim_param="-f $cfg_file";
else
sim_param="-f $default_cfg_fn";
fi
#if simulator not specified, no flags needed
if test -z $1; then
sim_param=;
fi
# Last two lines should look like:
echo "report(0xdeaddead);" >$temp1
echo "exit(0)" >>$temp1
# run the simulator
$1 $2 $sim_param 2>$temp4 >$temp2
simerr=$?
if test $simerr -eq 0; then
tail $temp2 -n 2 >$temp3
if cmp -s $temp1 $temp3; then
echo "OK";
rm $temp2
rm $temp4
else
simerr=$?
echo -e "FAILED\nSee: '$temp2' and '$temp4'";
fi;
else
echo "Cannot run: '$1 $2 $sim_param 2>$temp4 >$temp2'"
cat $temp4;
fi
# run post-execution script file
test -f $post_sh_file
if test $? -eq 0; then
echo "(post-exec $post_sh_file)"
source $post_sh_file
fi
# cleanup
rm $temp1
rm $temp3
# exit the test
exit $simerr
Go to most recent revision | Compare with Previous | Blame | View Log