summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/psim/tools/runtest-bottom
blob: 990d879bb33d62ecfabb57ddea31c00399c50de7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#
# Run the tests
#

tests="$args"
if [ ! "$tests" ]
then
     set -- `echo *.exe`
     tests="$*"
fi

[ -d $logdir ] ||
  mkdir $logdir || fatal "could not create log directory ($logdir)"

# where the tmp files go
trap "test_exit" 1 2 3 13 14 15

for tfile in $tests
do
   echo $tfile | grep "exe$" >/dev/null
   if [ $? -eq 0 ] ; then
     ext=.exe
   else
     ext=.ralf
   fi
   tname=`basename $tfile ${ext}`
   cpus="1"
   TEST_TYPE="single"

   case $tname in
       # size is no longer interactive.
       capture* | monitor* | termios* | fileio* | pppd*)
            warn "Skipping $tname; it is interactive"
            continue
            ;;
       *-node2*)
           warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
           continue;;
       *-node1*)
           warn "Running both nodes associated with $tname"
           variant=`echo $tname | sed 's/.*-node[12]//' | sed 's/\.exe//'`
           tname=`echo $tname | sed 's/-node.*//'`
           TEST_TYPE="mp"
           ;;
       minimum*|stackchk*|*fatal*|termio*)
           continue           ;;
   esac

   if [ $TEST_TYPE = "mp" ]
   then
       cpus="1 2"

       logfile1=$logdir/${tname}_1${variant}
       logfile2=$logdir/${tname}_2${variant}
       infofile1=$logfile1.info
       infofile2=$logfile2.info

       rm -f ${logfile1} ${logfile2}

       date=`date`
       echo "Starting $tname at $date"

       # XXX -c ${instruction_limit} 

       runone ${tname}-node1${variant}.${ext} ${max_run_time} | \
         sed -e 's/^M//' -e '/^$/d' > ${logfile1} &
       runone ${tname}-node2${variant}.${ext} ${max_run_time} | \
         sed -e 's/^M//' -e '/^$/d' > ${logfile2} &
       wait

   fi

   if [ $TEST_TYPE = "single" ]
   then
     logfile=$logdir/${tname}_1
     infofile=$logfile.info

     rm -f ${logfile}.tmp*

     date=`date`
     echo "Starting $tname at $date"

     # Spin off the simulator in the background
     #   -c could be used to set an instruction limit
     runone ${tfile} ${max_run_time} | \
       sed -e 's/^M//' -e '/^$/d' > ${logfile}
   fi

   # Create the info files
   for cpu in $cpus
   do
   {
       echo "$date"
       echo "Test run on: `uname -n`"
       echo "Host Information:"
       echo `uname -a`
       echo

       cat ${logdir}/${tname}_${cpu}

       if [ "$ran_too_long" = "yes" ]
       then
         echo "Test did NOT finish normally; killed after $max_run_time seconds"
       fi

       echo
       date;
   } > ${logdir}/${tname}_${cpu}.info
   done

   if [ "$cpus" = "1" ]
   then
        mv ${infofile} $logdir/${tname}.info
        mv ${logfile}  $logdir/${tname}
   fi

done

echo "Tests completed at " `date`
test_exit 0

# Local Variables: ***
# mode:ksh ***
# End: ***