xenofarm.sh 7.02 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
43
while [ $# -gt 0 ]
44
45
46
47
48
49
50
51
do
  case "$1" in
      --compat) compat=true; shift;;
      *)        compiler="$1"; shift;;
  esac
done

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

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
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
102
103
104
105
106
107
if test $compiler = default
then
    cfgargs=
else
    cfgargs=CC="$compiler"
fi
108
109

case `uname -n` in
Per Cederqvist's avatar
Per Cederqvist committed
110
111
112
113
114
  aristocat.lysator.liu.se)
      # We need dejagnu.
      PATH=$PATH:/sw/dejagnu/bin
      timeecho adjusting path to $PATH for aristocat
      ;;
115
116
117
  asmodean.lysator.liu.se)
      # We need the new makeinfo from /sw/local/bin, 
      # and want runtest from /sw/dejagnu.
Per Cederqvist's avatar
Per Cederqvist committed
118
      PATH=$PATH:/sw/dejagnu/bin
119
      cfgargs="$cfgargs MAKEINFO=/sw/local/bin/makeinfo"
Per Cederqvist's avatar
Per Cederqvist committed
120
121
      timeecho adjusting path to $PATH for asmodean
      ;;
122
123
  moghedien.lysator.liu.se)
      # We need the new makeinfo from /sw/local/bin.
Per Cederqvist's avatar
Per Cederqvist committed
124
125
126
      PATH=/sw/local/bin:$PATH
      timeecho adjusting path to $PATH for moghedien
      ;;
Per Cederqvist's avatar
Per Cederqvist committed
127
  moria)
128
129
130
      # Do more debugging on moria. Optimization gives a lot of false
      # errors from valgrind.
      cfgargs="$cfgargs CC='gcc -V 3.0.4' --without-optimization --with-valgrind --with-debug-calls --disable-malloc-guards"
Per Cederqvist's avatar
Per Cederqvist committed
131
      ;;
132
133
134
135
esac

dotask 1 "unzip" "gzip -d $BASE.tar.gz"
dotask 1 "unpack" "tar xf $BASE.tar"
Per Cederqvist's avatar
Per Cederqvist committed
136
dotask 1 "cfg" "cd $BASE && ./configure -C --prefix=$pfx $cfgargs"
Per Cederqvist's avatar
Per Cederqvist committed
137
138
dotask 0 "id-cc" "cd $BASE && make ident-cc"
dotask 0 "id-tx" "cd $BASE/doc && make ident-makeinfo"
139
140
141
142
143
144
145
dotask 1 "make" "cd $BASE && make"

#
# "make check" requirements
#

checkdocok=true
146
147
pdfok=true
dviok=true
148
149
150
151
152
153
154
checkprgok=true

# We need "python".
if python -c ""
then
    :
else
155
156
    echo python not found >> r/ckdoclog.txt
    echo python not found >> r/ckprglog.txt
157
158
159
160
    checkdocok=false
    checkprgok=false
fi

161
# We need the socket module from "python".
162
if $checkprgok
163
then
164
165
166
167
168
    if python -c "import socket"
    then
        :
    else
        echo python cannot import socket: >> r/ckprglog.txt
169
        python -c "import socket" >> r/ckprglog.txt 2>&1
170
171
        checkprgok=false
    fi
172
173
fi

174
175
176
177
178
# We need "runtest".
if runtest --version
then
    :
else 
179
    echo runtest not found >> r/ckprglog.txt
180
181
182
    checkprgok=false
fi

183
184
185
186
187
188
189
190
191
# 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
192
193
194
195
196
197
198
199
200
# We ned "texi2dvi"
if texi2dvi --version
then
    :
else 
    echo texi2dvi not found >> r/dvilog.txt
    dviok=false
fi

201
202
203
204
205
206
207
208
209
# We ned "tex"
if tex --version
then
    :
else 
    echo tex not found >> r/dvilog.txt
    dviok=false
fi

210
211
# No use to run pdf and dvi if check-doc fails.
oldstatus=$status
212
213
214

if $checkdocok
then
Per Cederqvist's avatar
Per Cederqvist committed
215
    dotask 1 "ckdoc" "cd $BASE/doc && make check-doc"
216
217
fi

Per Cederqvist's avatar
Per Cederqvist committed
218
if $dviok
219
then
Per Cederqvist's avatar
Per Cederqvist committed
220
    dotask 0 "dvi" "cd $BASE/doc && make dvi"
221
222
fi

Per Cederqvist's avatar
Per Cederqvist committed
223
if $pdfok
224
then
Per Cederqvist's avatar
Per Cederqvist committed
225
    dotask 0 "pdf" "cd $BASE/doc && make pdf"
226
227
fi

228
229
230
# Restore status: check is useful even if check-doc failed.
status=$oldstatus

231
232
if $checkprgok
then
Per Cederqvist's avatar
Per Cederqvist committed
233
    dotask 0 "ckprg" "cd $BASE/src && make check"
234
235
236
237
    if test "`uname -n`" = taylor && test -f r/ckprg.fail
    then
	mv r/ckprg.fail r/ckprg.warn
    fi
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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

255
256
257
# Check for warnings
if test -f r/make.pass
then
258
    egrep -i 'warning|\(w\)' r/makelog.txt \
259
260
261
262
263
264
265
266
    | grep -v regex\\.c \
    > r/makewarn.txt
    if test `wc -l < r/makewarn.txt` -gt 0
    then
	mv r/make.pass r/make.warn
    fi
fi

267
268
269
270
271
272
273
274
275
276
277
278
279
280
cp $BASE/config.cache r/configcache.txt
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

281
282
283
284
285
286
if test $compiler = default
then
    uname -s -r -m > r/machineid.txt
else
    uname -s -r -m $compiler > r/machineid.txt
fi
287
288
289
290
291
292
293
294
295
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

296
297
298
299
300
301
302
if $compat
then :
else
    (cd r && tar cf - *) > xenofarm_result.tar
    gzip -1 xenofarm_result.tar
fi

303
exit 0