OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [testbench/] [test] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 308 markom
#! /bin/sh
2
#
3
# Usage:
4
# test simulator_binary file_to_test
5
echo -n "Testing $2... "
6
 
7 309 markom
# clean . and / characters
8
fn=`echo $2 | sed 's/[\/\.]//g'`
9
temp1="/tmp/${fn}_output_ok"
10
temp2="/tmp/${fn}_output"
11
temp3="/tmp/${fn}_output_tail"
12
temp4="/tmp/${fn}_error"
13 308 markom
 
14 309 markom
# prepare simulator parameters
15
sim_param=
16
cfg_file="$2.cfg"
17
test -f $cfg_file
18
if test $? -eq 0; then
19
  echo "Using configuration file $cfg_file."
20
  # load .cfg file
21
  sim_param="-f $cfg_file";
22
fi
23
 
24
#if simulator not specified, no flags needed
25
if test -z $1; then
26
  sim_param=;
27
fi
28
 
29
echo $sim_param
30
 
31 308 markom
# Last two lines should look like:
32
echo "MTSPR(0x1234, deaddead);" >$temp1
33
echo "syscall exit(0)" >>$temp1
34
 
35
# run the simulator
36 309 markom
echo "$1 $2 $sim_param 2>$temp4 >$temp2"
37
$1 $2 $sim_param 2>$temp4 >$temp2
38 308 markom
simerr=$?
39
tail $temp2 -n 2 >$temp3
40
if cmp -s $temp1 $temp3; then
41
  echo "OK";
42
  rm $temp2
43
  rm $temp4
44
else
45
  echo -e "FAILED\nSee: output '$temp2', error '$temp4'";
46
fi
47
 
48
# cleanup
49
rm $temp1
50
rm $temp3
51
 
52
# exit the test
53
exit $simerr

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.