1 |
#!/bin/bash |
2 |
|
3 |
# $Id$ |
4 |
# An explicit building script for esys |
5 |
|
6 |
#********************************************************************** |
7 |
# NB: this script is setup to perform default developmental builds |
8 |
# change any settings you require, but PLEASE do not check any changes |
9 |
# to this script back into the repository - talk to Jon first |
10 |
#********************************************************************** |
11 |
|
12 |
# the modules to make |
13 |
MODULES="tools/CppUnitTest tools/mmio esysUtils escript finley modellib" |
14 |
|
15 |
# the tests to run |
16 |
TESTS="escript finley" |
17 |
|
18 |
# use this setting for local developmental builds |
19 |
#ENVVARS="DODEBUG=YES" |
20 |
|
21 |
if [ "$2" == "DEBUG" ] |
22 |
then |
23 |
ENVVARS="DODEBUG=YES" |
24 |
fi |
25 |
|
26 |
if [ "$2" == "NODEBUG" ] |
27 |
then |
28 |
ENVVARS="DODEBUG=NO" |
29 |
fi |
30 |
|
31 |
# use this setting for production installs on altix |
32 |
# ** NB: overwrites centrally installed esys libraries on altix *** |
33 |
#ENVVARS="$ENVVARS L_INSTLIB_DIR=/raid2/tools/esys/lib L_PYTH_DIR=/raid2/tools/esys/esys" |
34 |
|
35 |
# ensure required symlinks are setup first |
36 |
(cd escript/inc; if [ ! -h escript ]; then ln -s ../src escript; fi) |
37 |
(cd esysUtils/inc; if [ ! -h esysUtils ]; then ln -s ../src esysUtils; fi) |
38 |
(cd finley/inc; if [ ! -h finley ]; then ln -s ../src finley; fi) |
39 |
|
40 |
(cd escript; if [ ! -h Makefile ]; then ln -s ./escript.mk Makefile; fi) |
41 |
(cd esysUtils; if [ ! -h Makefile ]; then ln -s ./esysUtils.mk Makefile; fi) |
42 |
(cd finley; if [ ! -h Makefile ]; then ln -s ./finley.mk Makefile; fi) |
43 |
(cd tools/mmio; if [ ! -h Makefile ]; then ln -s ./mmio.mk Makefile; fi) |
44 |
(cd tools/CppUnitTest; if [ ! -h Makefile ]; then ln -s ./CppUnitTest.mk Makefile; fi) |
45 |
(cd modellib; if [ ! -h Makefile ]; then ln -s ./modellib.mk Makefile; fi) |
46 |
|
47 |
# clean all modules |
48 |
if [ "$1" == "clean" ] |
49 |
then |
50 |
for module in $MODULES ; do |
51 |
(echo Cleaning: $module; cd $module; make clean) |
52 |
done |
53 |
exit 0 |
54 |
fi |
55 |
|
56 |
# uninstall all modules |
57 |
if [ "$1" == "uninstall" ] |
58 |
then |
59 |
for module in $MODULES ; do |
60 |
(echo Uninstalling: $module; cd $module; gmake uninstall) |
61 |
done |
62 |
exit 0 |
63 |
fi |
64 |
|
65 |
# run the unit tests |
66 |
if [ "$1" == "unit_test" ] |
67 |
then |
68 |
for module in $TESTS |
69 |
do |
70 |
echo "Running unit tests for: $module" |
71 |
cd $ESYS_ROOT/$module/test |
72 |
./unit_test |
73 |
if [ $? != 0 ] |
74 |
then |
75 |
echo Unit Testing FAILED for module: $module |
76 |
exit 1 |
77 |
fi |
78 |
done |
79 |
exit 0 |
80 |
fi |
81 |
|
82 |
# run the python tests |
83 |
if [ "$1" == "py_test" ] |
84 |
then |
85 |
for module in $TESTS |
86 |
do |
87 |
echo "Running python tests for: $module" |
88 |
if [ "$module" == "finley" ] |
89 |
then |
90 |
cd $ESYS_ROOT/$module/test/python |
91 |
python ImportTest.py |
92 |
if [ $? != 0 ] |
93 |
then |
94 |
echo Python Testing FAILED for module: $module |
95 |
exit 1 |
96 |
fi |
97 |
python SimpleSolve.py |
98 |
if [ $? != 0 ] |
99 |
then |
100 |
echo Python Testing FAILED for module: $module |
101 |
exit 1 |
102 |
fi |
103 |
python GradTest.py |
104 |
if [ $? != 0 ] |
105 |
then |
106 |
echo Python Testing FAILED for module: $module |
107 |
exit 1 |
108 |
fi |
109 |
elif [ "$module" == "escript" ] |
110 |
then |
111 |
cd $ESYS_ROOT/$module/test/python |
112 |
python ImportTest.py |
113 |
if [ $? != 0 ] |
114 |
then |
115 |
echo Python Testing FAILED for module: $module |
116 |
exit 1 |
117 |
fi |
118 |
python BinaryOps.py |
119 |
if [ $? != 0 ] |
120 |
then |
121 |
echo Python Testing FAILED for module: $module |
122 |
exit 1 |
123 |
fi |
124 |
python UnaryOps.py |
125 |
if [ $? != 0 ] |
126 |
then |
127 |
echo Python Testing FAILED for module: $module |
128 |
exit 1 |
129 |
fi |
130 |
python SliceGetting.py |
131 |
if [ $? != 0 ] |
132 |
then |
133 |
echo Python Testing FAILED for module: $module |
134 |
exit 1 |
135 |
fi |
136 |
python SliceSetting.py |
137 |
if [ $? != 0 ] |
138 |
then |
139 |
echo Python Testing FAILED for module: $module |
140 |
exit 1 |
141 |
fi |
142 |
python MiscTests.py |
143 |
if [ $? != 0 ] |
144 |
then |
145 |
echo Python Testing FAILED for module: $module |
146 |
exit 1 |
147 |
fi |
148 |
python newEscriptTests.py |
149 |
if [ $? != 0 ] |
150 |
then |
151 |
echo Python Testing FAILED for module: $module |
152 |
exit 1 |
153 |
fi |
154 |
python escriptTest.py |
155 |
if [ $? != 0 ] |
156 |
then |
157 |
echo Python Testing FAILED for module: $module |
158 |
exit 1 |
159 |
fi |
160 |
python DataVariableTests.py |
161 |
if [ $? != 0 ] |
162 |
then |
163 |
echo Python Testing FAILED for module: $module |
164 |
exit 1 |
165 |
fi |
166 |
python test_xml.py |
167 |
if [ $? != 0 ] |
168 |
then |
169 |
echo Python Testing FAILED for module: $module |
170 |
exit 1 |
171 |
fi |
172 |
python pdetoolsTest.py |
173 |
if [ $? != 0 ] |
174 |
then |
175 |
echo Python Testing FAILED for module: $module |
176 |
exit 1 |
177 |
fi |
178 |
python TimingTests.py |
179 |
if [ $? != 0 ] |
180 |
then |
181 |
echo Python Testing FAILED for module: $module |
182 |
exit 1 |
183 |
fi |
184 |
fi |
185 |
done |
186 |
exit 0 |
187 |
fi |
188 |
|
189 |
# default case - just build all modules |
190 |
for module in $MODULES ; do |
191 |
(echo Building: $module; cd $module; env $ENVVARS make -j 10) |
192 |
if [ $? != 0 ] |
193 |
then |
194 |
echo Build FAILED for module: $module |
195 |
exit 1 |
196 |
fi |
197 |
done |
198 |
|
199 |
# install all modules |
200 |
if [ "$1" == "install" ] |
201 |
then |
202 |
for module in $MODULES ; do \ |
203 |
echo ENVARS = $ENVVARS |
204 |
(echo Installing: $module; cd $module; env $ENVVARS make install) |
205 |
if [ $? != 0 ] |
206 |
then |
207 |
echo Installation FAILED for module: $module |
208 |
exit 1 |
209 |
fi |
210 |
done |
211 |
(cd esys/escript; if [ ! -h escriptcpp.so ]; then ln -s ../../lib/libescriptcpp.so escriptcpp.so; fi) |
212 |
(cd esys/finley; if [ ! -h finleycpp.so ]; then ln -s ../../lib/libfinleycpp.so finleycpp.so; fi) |
213 |
exit 0 |
214 |
fi |