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 1765

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 840 ivang
pre_sh_file="$2.pre.sh"
11
post_sh_file="$2.post.sh"
12 309 markom
temp1="/tmp/${fn}_output_ok"
13
temp2="/tmp/${fn}_output"
14
temp3="/tmp/${fn}_output_tail"
15
temp4="/tmp/${fn}_error"
16 308 markom
 
17 840 ivang
# run pre-execution script file
18
test -f $pre_sh_file
19
if test $? -eq 0; then
20
  echo -n "(pre-exec $pre_sh_file) "
21
  source $pre_sh_file
22
fi
23
 
24 309 markom
# prepare simulator parameters
25
sim_param=
26
cfg_file="$2.cfg"
27
test -f $cfg_file
28
if test $? -eq 0; then
29 310 markom
  echo -n "(using $cfg_file) "
30 309 markom
  # load .cfg file
31
  sim_param="-f $cfg_file";
32 310 markom
else
33
  sim_param="-f $default_cfg_fn";
34 309 markom
fi
35
 
36
#if simulator not specified, no flags needed
37
if test -z $1; then
38
  sim_param=;
39
fi
40
 
41 308 markom
# Last two lines should look like:
42 511 markom
echo "report(0xdeaddead);" >$temp1
43 1565 nogj
echo "exit(0)" >>$temp1
44 308 markom
 
45
# run the simulator
46 309 markom
$1 $2 $sim_param 2>$temp4 >$temp2
47 308 markom
simerr=$?
48 310 markom
if test $simerr -eq 0; then
49
  tail $temp2 -n 2 >$temp3
50
  if cmp -s $temp1 $temp3; then
51
    echo "OK";
52
    rm $temp2
53
    rm $temp4
54
  else
55
    simerr=$?
56
    echo -e "FAILED\nSee: '$temp2' and '$temp4'";
57
  fi;
58 308 markom
else
59 310 markom
  echo "Cannot run: '$1 $2 $sim_param 2>$temp4 >$temp2'"
60
  cat $temp4;
61 308 markom
fi
62
 
63 840 ivang
# run post-execution script file
64
test -f $post_sh_file
65
if test $? -eq 0; then
66
  echo "(post-exec $post_sh_file)"
67
  source $post_sh_file
68
fi
69
 
70 308 markom
# cleanup
71
rm $temp1
72
rm $temp3
73
 
74
# exit the test
75
exit $simerr

powered by: WebSVN 2.1.0

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