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