summaryrefslogtreecommitdiff
path: root/scripts/kissme-mauve
blob: 8a6ee22db66ae134794934affeeea8c18bd2ae0c (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#!/bin/sh

CLASSPATH_CVS=~/mauve/classpath
CLASSPATH_PREFIX=~/mauve/root/classpath
MAUVE_CVS=~/mauve/mauve
KISSME_CVS=~/mauve/kissme
KISSME_PREFIX=~/mauve/root/kissme
KISSME_BIN=~/mauve/kissme/useful_scripts/kissme
LOG=/tmp/mauve.log
RESULTS=/tmp/kissme-mauve.txt
REPORT=/tmp/kissme-mauve-report.txt
TIMEOUT=30

rm -f ${LOG} > /dev/null 2>&1
rm -f ${RESULTS} > /dev/null 2>&1
today=`date`
echo "${today}" > ${LOG}
touch ${RESULTS}


_aclocal ()
{
  aclocal "$@" >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error running aclocal"
    exit 1
  fi
}

_autoheader ()
{
  autoheader "$@" >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error running autoheader"
    exit 1
  fi
}

_automake ()
{
  automake "$@" >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error running automake"
    exit 1
  fi
}

_autoconf ()
{
  autoconf "$@" >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error running autoconf"
    exit 1
  fi
}

classpath_checkout ()
{
  if [ ! -d "${CLASSPATH_CVS}" ]; then
    mkdir --parents ${CLASSPATH_CVS}
    local dir=`dirname "${CLASSPATH_CVS}"`
    cd "${dir}"
    cvs -z3 -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/classpath co classpath >> ${LOG} 2>/dev/null
    if [ $? -ne 0 ]; then
      echo "Error checking out classpath"
      exit 1
    fi
  fi
}

classpath_update ()
{
  cd "${CLASSPATH_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null
  if [ $? -ne 0 ]; then
    echo "Error checking out classpath"
    exit 1
  fi
}

classpath_clean ()
{
  if [ -d "${CLASSPATH_CVS}/build" ]; then
    rm -rf "${CLASSPATH_CVS}/build"
  fi
  if [ -d "${CLASSPATH_PREFIX}" ]; then
    rm -rf "${CLASSPATH_PREFIX}"
  fi
  mkdir --parents "${CLASSPATH_CVS}/build"
  mkdir --parents "${CLASSPATH_PREFIX}"
}

classpath_configure ()
{
  cd "${CLASSPATH_CVS}"

  _aclocal
  _autoheader
  _automake
  _autoconf

  cd "${CLASSPATH_CVS}/build" && ../configure --prefix=${CLASSPATH_PREFIX} --with-gcj --enable-jni >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error configuring"
    exit 1
  fi
}

classpath_build ()
{
  cd "${CLASSPATH_CVS}/build" && make >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error during make"
    exit 1
  fi
}

classpath_install ()
{
  cd "${CLASSPATH_CVS}/build" && make install >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error during make"
    exit 1
  fi
}

kissme_checkout ()
{
  if [ ! -d "${KISSME_CVS}" ]; then
    mkdir --parents ${KISSME_CVS}
    local dir=`dirname "${KISSME_CVS}"`
    cd "${KISSME_CVS}"
    cvs -z3 -d :pserver:anonymous@cvs.kissme.sourceforge.net:/cvsroot/kissme co . >> ${LOG} 2>/dev/null
    if [ $? -ne 0 ]; then
      echo "Error checking out kissme"
      exit 1
    fi
  fi
}

kissme_update ()
{
  cd "${KISSME_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null
  if [ $? -ne 0 ]; then
    echo "Error checking out kissme"
    exit 1
  fi
}

kissme_clean ()
{
  if [ -d "${KISSME_CVS}/build" ]; then
    rm -rf "${KISSME_CVS}/build"
  fi
  if [ -d "${KISSME_PREFIX}" ]; then
    rm -rf "${KISSME_PREFIX}"
  fi
  mkdir --parents "${KISSME_CVS}/build"
  mkdir --parents "${KISSME_PREFIX}"
}

kissme_configure ()
{
  cd "${KISSME_CVS}"
  
  _aclocal
  _autoheader
  _automake -a
  _autoconf

  cd "${KISSME_CVS}" && ./configure --prefix=${KISSME_PREFIX} \
    --enable-use-zips --with-gnu-classpath=${CLASSPATH_CVS} \
    --with-gnu-classpath-build=${CLASSPATH_CVS}/build \
    --with-classpath-install-dir=${CLASSPATH_PREFIX} >> ${LOG} 2>&1

  if [ $? -ne 0 ]; then
    echo "Error configuring"
    exit 1
  fi
}

kissme_build ()
{
  cd "${KISSME_CVS}" && make >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error during make"
    exit 1
  fi
}

kissme_install ()
{
  cd "${KISSME_CVS}" && make install >> ${LOG} 2>&1
  if [ $? -ne 0 ]; then
    echo "Error during make"
    exit 1
  fi
}

mauve_checkout ()
{
  if [ ! -d "${MAUVE_CVS}" ]; then
    mkdir --parents ${MAUVE_CVS}
    local dir=`dirname "${MAUVE_CVS}"`
    cd "${dir}"
    cvs -z3 -d :pserver:anoncvs@sources.redhat.com:/cvs/mauve co mauve >> ${LOG} 2>/dev/null
    if [ $? -ne 0 ]; then
      echo "Error checking out mauve"
      exit 1
    fi
  fi
}

mauve_update ()
{
  cd "${MAUVE_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null
  if [ $? -ne 0 ]; then
    echo "Error checking out mauve"
    exit 1
  fi
}

kissme_mauve ()
{
  export JAVAC="jikes -bootclasspath ${CLASSPATH_PREFIX}/share/classpath/glibj.zip"
  export JAVA="${KISSME_BIN}"

#  if [ -f "${KISSME_CVS}/useful_scripts/mauve-kissme" ]; then
#    cp -f "${KISSME_CVS}/useful_scripts/mauve-kissme" "${MAUVE_CVS}"
#  fi

  if [ -f "${CLASSPATH_CVS}/mauve-classpath" ]; then
    cp -f "${CLASSPATH_CVS}/mauve-classpath" "${MAUVE_CVS}"
  fi

  cd "${MAUVE_CVS}"
  if [ $? -ne 0 ]; then
    echo "Error configuring mauve"
    exit 1
  fi

  _aclocal
  _automake
  _autoconf

  ./configure >> "${LOG}" 2>&1
  if [ $? -ne 0 ]; then
    echo "Error configuring mauve"
    exit 1
  fi

  # create class choices from key file
  if [ -f classes ]; then 
    rm -f classes 2>/dev/null
  fi
  if [ -f choices ]; then
    rm -f choices 2>/dev/null
  fi
  /bin/sh choose "${MAUVE_CVS}" classpath
  if [ $? -ne 0 ]; then
    echo "Error during choose for mauve"
    exit 1
  fi

  # compile classes
  compile=`cat "${MAUVE_CVS}/classes" | tr '.' '/' | awk '{print $1".java"}' | xargs`
  ${JAVAC} -classpath "${MAUVE_CVS}" -d "${MAUVE_CVS}" ${compile} >> "${LOG}" 2>&1
  if [ $? -ne 0 ]; then
    echo "Error during compile for mauve"
    exit 1
  fi

  set -m
  for i in `cat "${MAUVE_CVS}/classes"`; do
    echo "$i" | ${JAVA} gnu.testlet.SimpleTestHarness -verbose >> "${RESULTS}" 2>&1 &

    vm_pid=$!
    sleep ${TIMEOUT} && kill -9 $vm_pid > /dev/null 2>&1 && echo "FAIL: $i execution aborted" >> "${RESULTS}" &
    kill_pid=$!
    fg %- 2>/dev/null
    kill -9 $kill_pid >/dev/null 2>&1 # && echo Test did not time out
  done
}

mauve_summary ()
{
  if [ ! -f "${RESULTS}" ]; then
    echo "Error creating summary"
    exit 1
  fi

  pass_cnt=`grep PASS "${RESULTS}" | wc -l`
  fail_cnt=`grep FAIL "${RESULTS}" | wc -l`
  total_cnt=`expr $pass_cnt + $fail_cnt`

  today=`date`
  echo "Mauve test results for Kissme" > "${REPORT}"
  echo "Report generated on ${today}" >> "${REPORT}"
  echo "" >> "${REPORT}"
  echo "${fail_cnt} of ${total_cnt} tests failed." >> "${REPORT}"
  echo "" >> "${REPORT}"
  cat "${RESULTS}" >> "${REPORT}"
}

#--------------------------------------------------------------------
# Update Classpath CVS
#--------------------------------------------------------------------
classpath_checkout
classpath_update

#--------------------------------------------------------------------
# Build Classpath with GCJ 3.2
#--------------------------------------------------------------------
classpath_clean
classpath_configure
classpath_build
classpath_install

#--------------------------------------------------------------------
# Update Kissme CVS
#--------------------------------------------------------------------
kissme_checkout
kissme_update

#--------------------------------------------------------------------
# Build Kissme
#--------------------------------------------------------------------
kissme_clean
kissme_configure
kissme_build
#kissme_install

#--------------------------------------------------------------------
# Update Mauve CVS
#--------------------------------------------------------------------
mauve_checkout
mauve_update

#--------------------------------------------------------------------
# Execute Mauve
#--------------------------------------------------------------------
kissme_mauve

#--------------------------------------------------------------------
# Create report
#--------------------------------------------------------------------
mauve_summary