summaryrefslogtreecommitdiff
path: root/gcc/testsuite/ada/acats/rtems_generate_acats_email
blob: 95cc37dd84d1e5c3039ce651ce839d0534e55361 (plain)
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
#! /bin/sh
#
#  Generate ACATS Email
#
#  $Id$
#

if [ $# -ne 3 ] ; then
  echo Usage $0: CPU BSP domail
  exit 1
fi

vfile=`dirname $0`/../../../../VERSIONS
if [ ! -r ${vfile} ] ; then
  echo VERSIONS file not found
  exit 1
fi

source ${vfile}
domail=$3
BSP=$2
CPU=$1
rtemsVersion=4.10
Target=${CPU}-rtems${rtemsVersion}

DIR=${GCCDIR}/gcc/testsuite/ada/acats
if [ ! -d ${DIR} ] ; then
  echo "No Ada build directory for the BSP (${DIR})"
  exit 1
fi

cd ${DIR}
if [ ! -d work-${BSP} ] ; then
  echo "Usage No ACATS working directory for the BSP (${BSP})"
  exit 1
fi

f=work-${BSP}/acats.sum
logfile=work-${BSP}/acats.log
if [ ! -r ${f} ] ; then
  echo "Usage No ACATS summary file working directory for the BSP (${BSP})"
  exit 1
fi

${CPU}-rtems${rtemsVersion}-gcc --version >/dev/null 2>&1
if [ ${?} -ne 0 ] ; then
  echo "${CPU}-rtems${rtemsVersion}-gcc not found"
  exit 1
fi

get_count()
{
  fileIn=${1}
  shift
  grep "${*}" <${fileIn}
}


cp /dev/null LOGS.tmp

get_failed()
{
  grep "^${2}" <${1} | while read l
  do
     Test=`echo ${l} | cut -d':' -f2 | tr -d '[:blank:]'`
     LowTest=`echo ${l} | cut -d':' -f2 | tr '[:upper:]' '[:lower:]'`
     Reason=`grep "[${BSP}|all]:${Test}" ${REASONS}`
     if [ $? -eq 0 ] ; then
       Reason=`echo ${Reason} | cut -d':' -f3- | sed -e 's/^ //'`
     else
       grep "Error detected.*${Test}" ${logfile} >/dev/null
       if [ $? -eq 0 ] ; then
         Reason="GNAT BUG DETECTED -- follow up required"
       else
         Reason="unknown reason for failure"
       fi
       #( echo "==================== ${LowTest}.log ====================" ; \
       #  cat `find work-${BSP} -name ${LowTest}.log` ; \
       #  echo "========================================================" \
       #) >> LOGS.tmp
     fi
     echo "${Test} - ${Reason}"
  done 
}

gen_report()
{
  echo
  ${CPU}-rtems${rtemsVersion}-gcc --version | head -1
  echo

  echo "                === acats Summary ==="
  get_count ${f}  '# of expected passes'
  get_count ${f}  '# of unexpected failures'
  get_count ${f}  '# of unsupported tests'

  echo
  get_failed ${f} 'UNSUPPORTED'
  get_failed ${f} 'FAIL'

  echo
  echo "======= Logs for failed tests ======"
  cat LOGS.tmp
}

REASONS=${SCRIPTDIR}/gcc/testsuite/ada/acats/rtems_acats_reasons

if [ ! -r ${REASONS} ] ; then
  echo "Cannot find rtems_acats_reasons (${REASONS})"
  exit 1
fi

if [ ${domail} = "yes" ] ; then
  gccver=`${CPU}-rtems${rtemsVersion}-gcc --version | head -1 | cut -d' ' -f4-`
  gen_report | joelmail \
    -s "ACATS results for ${gccver} on ${CPU}-rtems${rtemsVersion}" \
    gcc-testresults@gcc.gnu.org

else
  gen_report 
fi