xenofarm.sh 8.78 KB
Newer Older
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
#!/bin/sh
# Perform a test compilation of the LysKOM server under Xenofarm.
# Copyright (C) 2002  Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
# 
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by 
# the Free Software Foundation; either version 1, or (at your option) 
# any later version.
# 
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING.  If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
# MA 02139, USA.
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.

# To understand this file, you should look at the xenofarm file 
# projects/lyskom-server/source-transform.sh (see <URL:http://cvs.
# lysator.liu.se/viewcvs/viewcvs.cgi/xenofarm/projects/lyskom-server/
# source-transform.sh?cvsroot=xenofarm>).  It will attempt to unpack
# the distribution, configure it, compile, run tests, and collect
# information in the "r" directory.
#
# How can this file unpack the distribution when it is part of the
# distribution?  Read source-transform.sh and find out.
#
# Why is this file present here, and not in the Xenofarm CVS module?
# Because whenever anything here changes, we probably want to re-run
# the tests on the Xenofarm, and committing anything to the
# lyskom-server CVS module will trigger the creation of a source
# distribution.

41
compiler=default
42
compat=false
Per Cederqvist's avatar
Per Cederqvist committed
43
cfgargs=
44
while [ $# -gt 0 ]
45
46
47
do
  case "$1" in
      --compat) compat=true; shift;;
48
      --cfg)    shift; cfgargs="$1"; shift;;
49
50
51
52
53
      *)        compiler="$1"; shift;;
  esac
done

if $compat
54
then :
55
56
57
58
else
    rm -rf r
    mkdir r
    exec > r/shlog.txt 2>&1
59
60
fi

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
VERS=`echo lyskom-server*tar.gz|sed s/lyskom-server-//|sed s/.tar.gz//`
BASE=lyskom-server-$VERS

timeecho () {
    echo `TZ=UTC date|awk '{print $6 "-" $2 "-" $3 " " $4}'\
	|sed -e s/Jan/01/ -e s/Feb/02/ -e s/Mar/03/ -e s/Apr/04/ \
	     -e s/May/05/ -e s/Jun/06/ -e s/Jul/07/ -e s/Aug/08/ \
	     -e s/Sep/09/ -e s/Oct/10/ -e s/Nov/11/ -e s/Dec/12/ `: "$@"
}

log () {
    echo "$@" >> r/mainlog.txt
    date >> r/mainlog.txt
}

dotask() {
    important="$1"
    task="$2"
    cmd="$3"
    if test $status = good
    then
	log Begin $task
        timeecho Begin $task
        if sh -c "$cmd" > r/${task}log.txt 2>&1
        then
	    touch r/$task.pass
        else
	    timeecho FAIL: $task
	    touch r/$task.fail
	    if [ $important = 1 ]
	    then
	        status=${task}-failed
	    fi
        fi
    else
	echo status $status makes it impossible to perform this step \
	    > r/${task}log.txt
    fi
}

pfx=`pwd`/pfx

status=good
104
105
if test $compiler = default
then
Per Cederqvist's avatar
Per Cederqvist committed
106
    :
107
else
Per Cederqvist's avatar
Per Cederqvist committed
108
    cfgargs="$cfgargs CC=$compiler"
109
fi
110
111

case `uname -n` in
Per Cederqvist's avatar
Per Cederqvist committed
112
113
114
115
116
  aristocat.lysator.liu.se)
      # We need dejagnu.
      PATH=$PATH:/sw/dejagnu/bin
      timeecho adjusting path to $PATH for aristocat
      ;;
117
118
119
120
121
122
  moghedien)
      # We presumably need the new makeinfo from /sw/local/bin, 
      # but try without it.  FIXME.
      #cfgargs="$cfgargs MAKEINFO=/sw/local/bin/makeinfo"
      #timeecho adjusting cfg args for moghedien
      # We need runtest.
Per Cederqvist's avatar
Per Cederqvist committed
123
      PATH=$PATH:/sw/dejagnu/bin
124
      timeecho adjusting path to $PATH for moghedien
Per Cederqvist's avatar
Per Cederqvist committed
125
      ;;
126
127
128
129
130
131
  lysator.liu.se)
      if test "$compiler" = cc
      then
	  . /etc/path.sh
	  module add sparcworks
      fi;;
132
133
134
esac

dotask 1 "unzip" "gzip -d $BASE.tar.gz"
Per Cederqvist's avatar
Per Cederqvist committed
135
136
137
138
139
140
141
142

if test $compiler = default
then :
else
    echo old-style compiler spec >> r/unziplog.txt
    touch r/unzip.warn
fi

143
dotask 1 "unpack" "tar xf $BASE.tar"
Per Cederqvist's avatar
Per Cederqvist committed
144
dotask 1 "cfg" "cd $BASE && ./configure -C --prefix=$pfx $cfgargs"
Per Cederqvist's avatar
Per Cederqvist committed
145
146
dotask 0 "id-cc" "cd $BASE && make ident-cc"
dotask 0 "id-tx" "cd $BASE/doc && make ident-makeinfo"
147
148
149
150
151
152
153
dotask 1 "make" "cd $BASE && make"

#
# "make check" requirements
#

checkdocok=true
154
155
pdfok=true
dviok=true
156
157
158
159
160
161
162
checkprgok=true

# We need "python".
if python -c ""
then
    :
else
163
164
    echo python not found >> r/ckdoclog.txt
    echo python not found >> r/ckprglog.txt
165
166
167
168
    checkdocok=false
    checkprgok=false
fi

169
# We need the socket module from "python".
170
if $checkprgok
171
then
172
173
174
175
176
    if python -c "import socket"
    then
        :
    else
        echo python cannot import socket: >> r/ckprglog.txt
177
        python -c "import socket" >> r/ckprglog.txt 2>&1
178
179
        checkprgok=false
    fi
180
181
fi

182
183
184
185
186
# We need "runtest".
if runtest --version
then
    :
else 
187
    echo runtest not found >> r/ckprglog.txt
188
189
190
    checkprgok=false
fi

191
192
193
194
195
196
197
198
199
# We ned "pdftex"
if pdftex --version
then
    :
else 
    echo pdftex not found >> r/pdflog.txt
    pdfok=false
fi

Per Cederqvist's avatar
Per Cederqvist committed
200
201
202
203
204
205
206
207
208
# We ned "texi2dvi"
if texi2dvi --version
then
    :
else 
    echo texi2dvi not found >> r/dvilog.txt
    dviok=false
fi

209
210
211
212
213
214
215
216
217
# We ned "tex"
if tex --version
then
    :
else 
    echo tex not found >> r/dvilog.txt
    dviok=false
fi

218
219
# No use to run pdf and dvi if check-doc fails.
oldstatus=$status
220
221
222

if $checkdocok
then
Per Cederqvist's avatar
Per Cederqvist committed
223
    dotask 1 "ckdoc" "cd $BASE/doc && make check-doc"
224
225
fi

Per Cederqvist's avatar
Per Cederqvist committed
226
if $dviok
227
then
Per Cederqvist's avatar
Per Cederqvist committed
228
    dotask 0 "dvi" "cd $BASE/doc && make dvi"
229
230
fi

Per Cederqvist's avatar
Per Cederqvist committed
231
if $pdfok
232
then
Per Cederqvist's avatar
Per Cederqvist committed
233
    dotask 0 "pdf" "cd $BASE/doc && make pdf"
234
235
fi

236
237
238
# Restore status: check is useful even if check-doc failed.
status=$oldstatus

239
240
if $checkprgok
then
Per Cederqvist's avatar
Per Cederqvist committed
241
    dotask 0 "ckprg" "cd $BASE/src && make check"
242
243
244
245
    if test "`uname -n`" = taylor && test -f r/ckprg.fail
    then
	mv r/ckprg.fail r/ckprg.warn
    fi
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
fi

dotask 1 "install" "cd $BASE && make install"

if [ -f r/install.pass ]
then
    log Xenofarm OK
    find pfx -type f -print | sort > r/installedfiles.txt
fi

# FIXME: run distcheck.
# FIXME: compare the contents of the distcheck-generated tar file
# with the one we distributed.

log Begin response assembly
timeecho Collecting results

263
# Check for warnings
264
265
266
267
268
269
270
271
272
273
274

if test -f r/cfg.pass
then
    egrep -i 'warning|\(w\)' r/cfglog.txt \
    > r/cfgwarn.txt
    if test `wc -l < r/cfgwarn.txt` -gt 0
    then
	mv r/cfg.pass r/cfg.warn
    fi
fi

275
276
if test -f r/make.pass
then
277
    egrep -i 'warning|\(w\)' r/makelog.txt \
278
279
280
281
282
|grep -v '".*1506-112 .W. Duplicate type qualifier "volatile" ignored.' \
|grep -v '/usr/include/bits/socket.h:.*: warning: cast increases required alignment of target type' \
|grep -v '/usr/include/sys/vnode.h:.*: warning: declaration of .free. shadows global declaration' \
|grep -v 'aux-item-def-scan\.c:.*: warning: .* defined but not used' \
|grep -v 'connections.c:.*: warning: duplicate .volatile.' \
283
|grep -v '"format" is an unrecognized __declspec attribute' \
284
|grep -v 'getopt.[hc]:.*: warning: function declaration isn.t a prototype' \
285
286
|grep -v 'getopt.c:451: warning: .indfound. might be used uninitialized in this function' \
|grep -v 'getopt.c:461: warning: comparison between signed and unsigned' \
287
|grep -v 'getopt1.c:.*: warning: function declaration isn.t a prototype' \
Per Cederqvist's avatar
Per Cederqvist committed
288
289
|grep -v 'ramkomd.c:188: warning: function declaration isn.t a prototype' \
|grep -v 'ramkomd.c:305: warning: function declaration isn.t a prototype' \
290
291
|grep -v 'sigflags.h:3[06]: warning: duplicate .volatile.' \
|grep -v regex\\.c \
292
293
294
295
    > r/makewarn.txt
    if test `wc -l < r/makewarn.txt` -gt 0
    then
	mv r/make.pass r/make.warn
296
297
    else
	rm r/makewarn.txt
298
299
300
    fi
fi

301
302
if test -f r/ckprg.pass
then
303
    egrep -i 'warning|\(w\)|error' r/ckprglog.txt \
304
305
306
307
308
309
|grep -v 'WARNING: Couldn.t find the global config file.' \
|grep -v 'WARNING: Couldn.t find tool init file' \
    > r/ckprgwarn.txt
    if test `wc -l < r/ckprgwarn.txt` -gt 0
    then
	mv r/ckprg.pass r/ckprg.warn
310
311
312
313
314
315
316
317
318
319
	egrep -i 'error' r/ckprgwarn.txt \
	> r/ckprgfail.txt
	if test `wc -l < r/ckprgfail.txt` -gt 0
	then
	    mv r/ckprg.warn r/ckprg.fail
	else
	    rm r/ckprgfail.txt
	fi
    else
	rm r/ckprgwarn.txt
320
321
322
323
324
    fi
fi

# Collect stuff.

325
cp $BASE/config.cache r/configcache.txt
326
327
cp $BASE/config.log r/configlog.txt
cp $BASE/src/libraries/libisc-new/config.log r/iscconfiglog.txt
328
cp $BASE/config.h r/config-h.txt
329
330
331
332
333
334
335
336
337
338
339
340
341
for file in $BASE/src/server/testsuite/*.log
do
  if test -f $file
  then
      cp $file r/`basename $file`.txt
  fi
done
# find $BASE -name core -print
env > r/environ.txt
echo $PATH > r/path.txt
makeinfo --version > r/makeinfo.txt
type makeinfo >> r/makeinfo.txt 2>&1

342
343
344
345
346
347
if test $compiler = default
then
    uname -s -r -m > r/machineid.txt
else
    uname -s -r -m $compiler > r/machineid.txt
fi
348
349
350
351
352
353
354
355
356
uname -n >> r/machineid.txt
cp buildid.txt r/buildid.txt

# FIXME: the next two lines are only here because of the current
# confusion regarding the name of the build id file.  Once we have
# settled on a name, and all clients are updated, it can be removed.
cp export.stamp r/export.stamp
cp exportstamp.txt r/exportstamp.txt

357
358
359
360
361
362
363
if $compat
then :
else
    (cd r && tar cf - *) > xenofarm_result.tar
    gzip -1 xenofarm_result.tar
fi

364
exit 0