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 |
|
15 |
# the modules to test |
16 |
TESTS="escript bruce finley" |
17 |
|
18 |
# the python tests to run |
19 |
#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 |
ESCRIPT_PYTESTS="ImportTest.py BinaryOps.py UnaryOps.py SliceGetting.py SliceSetting.py MiscTests.py newEscriptTests.py DataVariableTests.py test_xml.py" |
22 |
BRUCE_PYTESTS="ImportTest.py BruceTest.py" |
23 |
|
24 |
# use this setting for local developmental builds |
25 |
ENVVARS="DODEBUG=YES" |
26 |
|
27 |
if [ "$2" == "DEBUG" ] |
28 |
then |
29 |
ENVVARS="DODEBUG=YES" |
30 |
fi |
31 |
|
32 |
if [ "$2" == "NODEBUG" ] |
33 |
then |
34 |
ENVVARS="DODEBUG=NO" |
35 |
fi |
36 |
|
37 |
# use this setting for production installs on altix |
38 |
# ** NB: overwrites centrally installed esys libraries on altix *** |
39 |
#ENVVARS="$ENVVARS L_INSTLIB_DIR=/raid2/tools/esys/lib L_PYTH_DIR=/raid2/tools/esys/esys" |
40 |
|
41 |
# ensure required symlinks are setup first |
42 |
(cd esysUtils/inc; if [ ! -h esysUtils ]; then ln -s ../src esysUtils; fi) |
43 |
(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 |
(cd paso/inc; if [ ! -h paso ]; then ln -s ../src paso; fi) |
46 |
(cd bruce/inc; if [ ! -h bruce ]; then ln -s ../src bruce; fi) |
47 |
|
48 |
(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 |
(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 |
(cd paso; if [ ! -h Makefile ]; then ln -s ./paso.mk Makefile; fi) |
54 |
(cd bruce; if [ ! -h Makefile ]; then ln -s ./bruce.mk Makefile; fi) |
55 |
(cd modellib; if [ ! -h Makefile ]; then ln -s ./modellib.mk Makefile; fi) |
56 |
|
57 |
# clean all modules |
58 |
if [ "$1" == "clean" ] |
59 |
then |
60 |
for module in $MODULES ; do |
61 |
(echo Cleaning: $module; cd $module; make clean) |
62 |
done |
63 |
exit 0 |
64 |
fi |
65 |
|
66 |
# uninstall all modules |
67 |
if [ "$1" == "uninstall" ] |
68 |
then |
69 |
for module in $MODULES ; do |
70 |
(echo Cleaning: $module; cd $module; make clean) |
71 |
done |
72 |
for module in $MODULES ; do |
73 |
(echo Uninstalling: $module; cd $module; make uninstall) |
74 |
done |
75 |
exit 0 |
76 |
fi |
77 |
|
78 |
# 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 |
./unit_test |
86 |
if [ $? != 0 ] |
87 |
then |
88 |
echo Unit Testing FAILED for module: $module |
89 |
exit 1 |
90 |
fi |
91 |
done |
92 |
exit 0 |
93 |
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 |
cd $ESYS_ROOT/$module/test/python |
102 |
if [ "$module" == "finley" ] |
103 |
then |
104 |
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 |
done |
114 |
elif [ "$module" == "escript" ] |
115 |
then |
116 |
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 |
fi |
139 |
done |
140 |
exit 0 |
141 |
fi |
142 |
|
143 |
# default case - just build all modules |
144 |
echo "*************** build ************************************" |
145 |
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 |
echo "***************installation ************************************" |
158 |
for module in $MODULES ; do \ |
159 |
echo ENVVARS = $ENVVARS |
160 |
(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 |
(cd esys; touch __init__.py) |
168 |
(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 |
(cd esys/bruce; if [ ! -h brucecpp.so ]; then ln -s ../../lib/libbrucecpp.so brucecpp.so; fi) |
171 |
exit 0 |
172 |
fi |