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