xenofarm.sh 6.42 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
42
43
44
45
46
47
compiler=default
if [ $# -gt 1 ]
then
    compiler="$1"
    shift
fi

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
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
91
92
93
94
95
96
if test $compiler = default
then
    cfgargs=
else
    cfgargs=CC="$compiler"
fi
97
98

case `uname -n` in
Per Cederqvist's avatar
Per Cederqvist committed
99
100
101
102
103
  aristocat.lysator.liu.se)
      # We need dejagnu.
      PATH=$PATH:/sw/dejagnu/bin
      timeecho adjusting path to $PATH for aristocat
      ;;
104
105
106
  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
107
      PATH=$PATH:/sw/dejagnu/bin
108
      cfgargs="$cfgargs MAKEINFO=/sw/local/bin/makeinfo"
Per Cederqvist's avatar
Per Cederqvist committed
109
110
      timeecho adjusting path to $PATH for asmodean
      ;;
111
112
  moghedien.lysator.liu.se)
      # We need the new makeinfo from /sw/local/bin.
Per Cederqvist's avatar
Per Cederqvist committed
113
114
115
      PATH=/sw/local/bin:$PATH
      timeecho adjusting path to $PATH for moghedien
      ;;
Per Cederqvist's avatar
Per Cederqvist committed
116
117
  moria)
      # Do more debugging on moria.
118
      cfgargs="$cfgargs --with-valgrind --with-debug-calls --disable-malloc-guards"
Per Cederqvist's avatar
Per Cederqvist committed
119
      ;;
120
121
122
123
esac

dotask 1 "unzip" "gzip -d $BASE.tar.gz"
dotask 1 "unpack" "tar xf $BASE.tar"
Per Cederqvist's avatar
Per Cederqvist committed
124
dotask 1 "cfg" "cd $BASE && ./configure -C --prefix=$pfx $cfgargs"
Per Cederqvist's avatar
Per Cederqvist committed
125
126
dotask 0 "id-cc" "cd $BASE && make ident-cc"
dotask 0 "id-tx" "cd $BASE/doc && make ident-makeinfo"
127
128
129
130
131
132
133
dotask 1 "make" "cd $BASE && make"

#
# "make check" requirements
#

checkdocok=true
134
135
pdfok=true
dviok=true
136
137
138
139
140
141
142
checkprgok=true

# We need "python".
if python -c ""
then
    :
else
143
144
    echo python not found >> r/ckdoclog.txt
    echo python not found >> r/ckprglog.txt
145
146
147
148
    checkdocok=false
    checkprgok=false
fi

149
# We need the socket module from "python".
150
if $checkprgok
151
then
152
153
154
155
156
    if python -c "import socket"
    then
        :
    else
        echo python cannot import socket: >> r/ckprglog.txt
157
        python -c "import socket" >> r/ckprglog.txt 2>&1
158
159
        checkprgok=false
    fi
160
161
fi

162
163
164
165
166
# We need "runtest".
if runtest --version
then
    :
else 
167
    echo runtest not found >> r/ckprglog.txt
168
169
170
    checkprgok=false
fi

171
172
173
174
175
176
177
178
179
# 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
180
181
182
183
184
185
186
187
188
# We ned "texi2dvi"
if texi2dvi --version
then
    :
else 
    echo texi2dvi not found >> r/dvilog.txt
    dviok=false
fi

189
190
191
192
193
194
195
196
197
# We ned "tex"
if tex --version
then
    :
else 
    echo tex not found >> r/dvilog.txt
    dviok=false
fi

198
199
# No use to run pdf and dvi if check-doc fails.
oldstatus=$status
200
201
202

if $checkdocok
then
Per Cederqvist's avatar
Per Cederqvist committed
203
    dotask 1 "ckdoc" "cd $BASE/doc && make check-doc"
204
205
fi

Per Cederqvist's avatar
Per Cederqvist committed
206
if $dviok
207
then
Per Cederqvist's avatar
Per Cederqvist committed
208
    dotask 0 "dvi" "cd $BASE/doc && make dvi"
209
210
fi

Per Cederqvist's avatar
Per Cederqvist committed
211
if $pdfok
212
then
Per Cederqvist's avatar
Per Cederqvist committed
213
    dotask 0 "pdf" "cd $BASE/doc && make pdf"
214
215
fi

216
217
218
# Restore status: check is useful even if check-doc failed.
status=$oldstatus

219
220
if $checkprgok
then
Per Cederqvist's avatar
Per Cederqvist committed
221
    dotask 0 "ckprg" "cd $BASE/src && make check"
222
223
224
225
    if test "`uname -n`" = taylor && test -f r/ckprg.fail
    then
	mv r/ckprg.fail r/ckprg.warn
    fi
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
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

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

257
258
259
260
261
262
if test $compiler = default
then
    uname -s -r -m > r/machineid.txt
else
    uname -s -r -m $compiler > r/machineid.txt
fi
263
264
265
266
267
268
269
270
271
272
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

exit 0