URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 308 |
Rev 309 |
#! /bin/sh
|
#! /bin/sh
|
#
|
#
|
# Usage:
|
# Usage:
|
# test simulator_binary file_to_test
|
# test simulator_binary file_to_test
|
echo -n "Testing $2... "
|
echo -n "Testing $2... "
|
|
|
temp1="/tmp/$2_output_ok"
|
# clean . and / characters
|
temp2="/tmp/$2_output"
|
fn=`echo $2 | sed 's/[\/\.]//g'`
|
temp3="/tmp/$2_output_tail"
|
temp1="/tmp/${fn}_output_ok"
|
temp4="/tmp/$2_error"
|
temp2="/tmp/${fn}_output"
|
|
temp3="/tmp/${fn}_output_tail"
|
|
temp4="/tmp/${fn}_error"
|
|
|
|
# prepare simulator parameters
|
|
sim_param=
|
|
cfg_file="$2.cfg"
|
|
test -f $cfg_file
|
|
if test $? -eq 0; then
|
|
echo "Using configuration file $cfg_file."
|
|
# load .cfg file
|
|
sim_param="-f $cfg_file";
|
|
fi
|
|
|
|
#if simulator not specified, no flags needed
|
|
if test -z $1; then
|
|
sim_param=;
|
|
fi
|
|
|
|
echo $sim_param
|
|
|
# Last two lines should look like:
|
# Last two lines should look like:
|
echo "MTSPR(0x1234, deaddead);" >$temp1
|
echo "MTSPR(0x1234, deaddead);" >$temp1
|
echo "syscall exit(0)" >>$temp1
|
echo "syscall exit(0)" >>$temp1
|
|
|
# run the simulator
|
# run the simulator
|
$1 $2 2>$temp4 >$temp2
|
echo "$1 $2 $sim_param 2>$temp4 >$temp2"
|
|
$1 $2 $sim_param 2>$temp4 >$temp2
|
simerr=$?
|
simerr=$?
|
tail $temp2 -n 2 >$temp3
|
tail $temp2 -n 2 >$temp3
|
if cmp -s $temp1 $temp3; then
|
if cmp -s $temp1 $temp3; then
|
echo "OK";
|
echo "OK";
|
rm $temp2
|
rm $temp2
|
rm $temp4
|
rm $temp4
|
else
|
else
|
echo -e "FAILED\nSee: output '$temp2', error '$temp4'";
|
echo -e "FAILED\nSee: output '$temp2', error '$temp4'";
|
fi
|
fi
|
|
|
# cleanup
|
# cleanup
|
rm $temp1
|
rm $temp1
|
rm $temp3
|
rm $temp3
|
|
|
# exit the test
|
# exit the test
|
exit $simerr
|
exit $simerr
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.