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 310

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 310 markom
default_cfg_fn="default.cfg"
10 309 markom
temp1="/tmp/${fn}_output_ok"
11
temp2="/tmp/${fn}_output"
12
temp3="/tmp/${fn}_output_tail"
13
temp4="/tmp/${fn}_error"
14 308 markom
 
15 309 markom
# prepare simulator parameters
16
sim_param=
17
cfg_file="$2.cfg"
18
test -f $cfg_file
19
if test $? -eq 0; then
20 310 markom
  echo -n "(using $cfg_file) "
21 309 markom
  # load .cfg file
22
  sim_param="-f $cfg_file";
23 310 markom
else
24
  sim_param="-f $default_cfg_fn";
25 309 markom
fi
26
 
27
#if simulator not specified, no flags needed
28
if test -z $1; then
29
  sim_param=;
30
fi
31
 
32 308 markom
# Last two lines should look like:
33
echo "MTSPR(0x1234, deaddead);" >$temp1
34
echo "syscall exit(0)" >>$temp1
35
 
36
# run the simulator
37 309 markom
$1 $2 $sim_param 2>$temp4 >$temp2
38 308 markom
simerr=$?
39 310 markom
if test $simerr -eq 0; then
40
  tail $temp2 -n 2 >$temp3
41
  if cmp -s $temp1 $temp3; then
42
    echo "OK";
43
    rm $temp2
44
    rm $temp4
45
  else
46
    simerr=$?
47
    echo -e "FAILED\nSee: '$temp2' and '$temp4'";
48
  fi;
49 308 markom
else
50 310 markom
  echo "Cannot run: '$1 $2 $sim_param 2>$temp4 >$temp2'"
51
  cat $temp4;
52 308 markom
fi
53
 
54
# cleanup
55
rm $temp1
56
rm $temp3
57
 
58
# exit the test
59
exit $simerr

powered by: WebSVN 2.1.0

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