1 |
jgs |
116 |
#!/bin/bash |
2 |
|
|
|
3 |
jgs |
82 |
# $Id$ |
4 |
jgs |
116 |
# An explicit building script for esys |
5 |
jgs |
82 |
|
6 |
jgs |
122 |
#********************************************************************** |
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 |
jgs |
150 |
MODULES="tools/CppUnitTest tools/mmio esysUtils escript paso finley bruce modellib" |
14 |
jgs |
82 |
|
15 |
jgs |
149 |
# the modules to test |
16 |
jgs |
154 |
TESTS="escript bruce finley" |
17 |
jgs |
122 |
|
18 |
jgs |
149 |
# the python tests to run |
19 |
svn |
163 |
#FINLEY_PYTESTS="ImportTest.py SimpleSolve.py GradTest.py test_linearPDEsOnFinley.py test_generators.py test_visualization_interface.py" |
20 |
|
|
FINLEY_PYTESTS="ImportTest.py SimpleSolve.py GradTest.py" |
21 |
jgs |
154 |
ESCRIPT_PYTESTS="ImportTest.py BinaryOps.py UnaryOps.py SliceGetting.py SliceSetting.py MiscTests.py newEscriptTests.py DataVariableTests.py test_xml.py" |
22 |
jgs |
153 |
BRUCE_PYTESTS="ImportTest.py BruceTest.py" |
23 |
jgs |
149 |
|
24 |
jgs |
122 |
# use this setting for local developmental builds |
25 |
jgs |
149 |
ENVVARS="DODEBUG=YES" |
26 |
jgs |
120 |
|
27 |
jgs |
147 |
if [ "$2" == "DEBUG" ] |
28 |
jgs |
125 |
then |
29 |
|
|
ENVVARS="DODEBUG=YES" |
30 |
|
|
fi |
31 |
|
|
|
32 |
jgs |
147 |
if [ "$2" == "NODEBUG" ] |
33 |
jgs |
123 |
then |
34 |
|
|
ENVVARS="DODEBUG=NO" |
35 |
|
|
fi |
36 |
|
|
|
37 |
jgs |
122 |
# use this setting for production installs on altix |
38 |
|
|
# ** NB: overwrites centrally installed esys libraries on altix *** |
39 |
jgs |
147 |
#ENVVARS="$ENVVARS L_INSTLIB_DIR=/raid2/tools/esys/lib L_PYTH_DIR=/raid2/tools/esys/esys" |
40 |
jgs |
120 |
|
41 |
jgs |
122 |
# ensure required symlinks are setup first |
42 |
jgs |
149 |
(cd esysUtils/inc; if [ ! -h esysUtils ]; then ln -s ../src esysUtils; fi) |
43 |
jgs |
122 |
(cd escript/inc; if [ ! -h escript ]; then ln -s ../src escript; fi) |
44 |
|
|
(cd finley/inc; if [ ! -h finley ]; then ln -s ../src finley; fi) |
45 |
jgs |
150 |
(cd paso/inc; if [ ! -h paso ]; then ln -s ../src paso; fi) |
46 |
jgs |
149 |
(cd bruce/inc; if [ ! -h bruce ]; then ln -s ../src bruce; fi) |
47 |
jgs |
122 |
|
48 |
jgs |
149 |
(cd tools/mmio; if [ ! -h Makefile ]; then ln -s ./mmio.mk Makefile; fi) |
49 |
|
|
(cd tools/CppUnitTest; if [ ! -h Makefile ]; then ln -s ./CppUnitTest.mk Makefile; fi) |
50 |
|
|
(cd esysUtils; if [ ! -h Makefile ]; then ln -s ./esysUtils.mk Makefile; fi) |
51 |
jgs |
122 |
(cd escript; if [ ! -h Makefile ]; then ln -s ./escript.mk Makefile; fi) |
52 |
|
|
(cd finley; if [ ! -h Makefile ]; then ln -s ./finley.mk Makefile; fi) |
53 |
jgs |
150 |
(cd paso; if [ ! -h Makefile ]; then ln -s ./paso.mk Makefile; fi) |
54 |
jgs |
149 |
(cd bruce; if [ ! -h Makefile ]; then ln -s ./bruce.mk Makefile; fi) |
55 |
jgs |
136 |
(cd modellib; if [ ! -h Makefile ]; then ln -s ./modellib.mk Makefile; fi) |
56 |
jgs |
122 |
|
57 |
|
|
# clean all modules |
58 |
jgs |
147 |
if [ "$1" == "clean" ] |
59 |
jgs |
116 |
then |
60 |
jgs |
147 |
for module in $MODULES ; do |
61 |
|
|
(echo Cleaning: $module; cd $module; make clean) |
62 |
jgs |
116 |
done |
63 |
jgs |
147 |
exit 0 |
64 |
jgs |
116 |
fi |
65 |
|
|
|
66 |
jgs |
122 |
# uninstall all modules |
67 |
jgs |
147 |
if [ "$1" == "uninstall" ] |
68 |
jgs |
122 |
then |
69 |
jgs |
147 |
for module in $MODULES ; do |
70 |
jgs |
149 |
(echo Cleaning: $module; cd $module; make clean) |
71 |
jgs |
122 |
done |
72 |
jgs |
149 |
for module in $MODULES ; do |
73 |
|
|
(echo Uninstalling: $module; cd $module; make uninstall) |
74 |
|
|
done |
75 |
jgs |
147 |
exit 0 |
76 |
jgs |
122 |
fi |
77 |
jgs |
82 |
|
78 |
jgs |
122 |
# run the unit tests |
79 |
|
|
if [ "$1" == "unit_test" ] |
80 |
|
|
then |
81 |
|
|
for module in $TESTS |
82 |
|
|
do |
83 |
|
|
echo "Running unit tests for: $module" |
84 |
|
|
cd $ESYS_ROOT/$module/test |
85 |
jgs |
147 |
./unit_test |
86 |
|
|
if [ $? != 0 ] |
87 |
|
|
then |
88 |
|
|
echo Unit Testing FAILED for module: $module |
89 |
|
|
exit 1 |
90 |
|
|
fi |
91 |
jgs |
122 |
done |
92 |
jgs |
147 |
exit 0 |
93 |
jgs |
122 |
fi |
94 |
|
|
|
95 |
|
|
# run the python tests |
96 |
|
|
if [ "$1" == "py_test" ] |
97 |
|
|
then |
98 |
|
|
for module in $TESTS |
99 |
|
|
do |
100 |
|
|
echo "Running python tests for: $module" |
101 |
jgs |
149 |
cd $ESYS_ROOT/$module/test/python |
102 |
jgs |
122 |
if [ "$module" == "finley" ] |
103 |
|
|
then |
104 |
jgs |
149 |
for pytest in $FINLEY_PYTESTS |
105 |
|
|
do |
106 |
|
|
echo "Running python test: $pytest" |
107 |
|
|
python $pytest |
108 |
|
|
if [ $? != 0 ] |
109 |
|
|
then |
110 |
|
|
echo Python Testing FAILED for $pytest in module $module |
111 |
|
|
exit 1 |
112 |
|
|
fi |
113 |
jgs |
150 |
done |
114 |
jgs |
122 |
elif [ "$module" == "escript" ] |
115 |
|
|
then |
116 |
jgs |
149 |
for pytest in $ESCRIPT_PYTESTS |
117 |
|
|
do |
118 |
|
|
echo "Running python test: $pytest" |
119 |
|
|
python $pytest |
120 |
|
|
if [ $? != 0 ] |
121 |
|
|
then |
122 |
|
|
echo Python Testing FAILED for $pytest in module $module |
123 |
|
|
exit 1 |
124 |
|
|
fi |
125 |
|
|
done |
126 |
|
|
elif [ "$module" == "bruce" ] |
127 |
|
|
then |
128 |
|
|
for pytest in $BRUCE_PYTESTS |
129 |
|
|
do |
130 |
|
|
echo "Running python test: $pytest" |
131 |
|
|
python $pytest |
132 |
|
|
if [ $? != 0 ] |
133 |
|
|
then |
134 |
|
|
echo Python Testing FAILED for $pytest in module $module |
135 |
|
|
exit 1 |
136 |
|
|
fi |
137 |
|
|
done |
138 |
jgs |
122 |
fi |
139 |
|
|
done |
140 |
jgs |
147 |
exit 0 |
141 |
jgs |
122 |
fi |
142 |
jgs |
147 |
|
143 |
|
|
# default case - just build all modules |
144 |
jgs |
149 |
echo "*************** build ************************************" |
145 |
jgs |
147 |
for module in $MODULES ; do |
146 |
|
|
(echo Building: $module; cd $module; env $ENVVARS make -j 10) |
147 |
|
|
if [ $? != 0 ] |
148 |
|
|
then |
149 |
|
|
echo Build FAILED for module: $module |
150 |
|
|
exit 1 |
151 |
|
|
fi |
152 |
|
|
done |
153 |
|
|
|
154 |
|
|
# install all modules |
155 |
|
|
if [ "$1" == "install" ] |
156 |
|
|
then |
157 |
jgs |
149 |
echo "***************installation ************************************" |
158 |
jgs |
147 |
for module in $MODULES ; do \ |
159 |
jgs |
149 |
echo ENVVARS = $ENVVARS |
160 |
jgs |
147 |
(echo Installing: $module; cd $module; env $ENVVARS make install) |
161 |
|
|
if [ $? != 0 ] |
162 |
|
|
then |
163 |
|
|
echo Installation FAILED for module: $module |
164 |
|
|
exit 1 |
165 |
|
|
fi |
166 |
|
|
done |
167 |
jgs |
149 |
(cd esys; touch __init__.py) |
168 |
jgs |
147 |
(cd esys/escript; if [ ! -h escriptcpp.so ]; then ln -s ../../lib/libescriptcpp.so escriptcpp.so; fi) |
169 |
|
|
(cd esys/finley; if [ ! -h finleycpp.so ]; then ln -s ../../lib/libfinleycpp.so finleycpp.so; fi) |
170 |
jgs |
149 |
(cd esys/bruce; if [ ! -h brucecpp.so ]; then ln -s ../../lib/libbrucecpp.so brucecpp.so; fi) |
171 |
jgs |
147 |
exit 0 |
172 |
|
|
fi |