URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [or1ksim/] [testbench/] [test] - Rev 1765
Compare with Previous | Blame | View Log
#! /bin/sh## Usage:# test simulator_binary file_to_testecho -n "Testing $2... "# clean . and / charactersfn=`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 filetest -f $pre_sh_fileif test $? -eq 0; thenecho -n "(pre-exec $pre_sh_file) "source $pre_sh_filefi# prepare simulator parameterssim_param=cfg_file="$2.cfg"test -f $cfg_fileif test $? -eq 0; thenecho -n "(using $cfg_file) "# load .cfg filesim_param="-f $cfg_file";elsesim_param="-f $default_cfg_fn";fi#if simulator not specified, no flags neededif test -z $1; thensim_param=;fi# Last two lines should look like:echo "report(0xdeaddead);" >$temp1echo "exit(0)" >>$temp1# run the simulator$1 $2 $sim_param 2>$temp4 >$temp2simerr=$?if test $simerr -eq 0; thentail $temp2 -n 2 >$temp3if cmp -s $temp1 $temp3; thenecho "OK";rm $temp2rm $temp4elsesimerr=$?echo -e "FAILED\nSee: '$temp2' and '$temp4'";fi;elseecho "Cannot run: '$1 $2 $sim_param 2>$temp4 >$temp2'"cat $temp4;fi# run post-execution script filetest -f $post_sh_fileif test $? -eq 0; thenecho "(post-exec $post_sh_file)"source $post_sh_filefi# cleanuprm $temp1rm $temp3# exit the testexit $simerr
