@@ -30,88 +30,96 @@ if [ -z ${var+IDEFIX_DIR} ] & [ -d "$IDEFIX_DIR" ] ; then
3030fi
3131
3232export IDEFIX_DIR=$target_dir
33- echo $IDEFIX_DIR
3433
3534set -e
3635options=$@
3736
37+ TMP_DIR=" $( mktemp -d) "
38+ function finish ()
39+ {
40+ echo $1
41+ echo " Cleaning directory $TMP_DIR "
42+ cd $TEST_DIR
43+ rm -rf $TMP_DIR
44+ exit 1
45+ }
46+
3847# High order tests
3948for rep in $rep_list ; do
40- TMP_DIR=" $( mktemp -d) "
4149 cp -R $TEST_DIR /$rep /* $TMP_DIR
4250 cd $TMP_DIR
4351 echo " ***********************************************"
4452 echo " Configuring $rep "
4553 echo " Using $TMP_DIR as working directory"
4654 echo " ***********************************************"
47- rm -f CMakeCache.txt
4855 for order in $order_list ; do
4956
50- cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order || { echo " !!!!$rep with $order failed during configuration" ; exit 1 ; }
57+ cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order || finish " !!!!$rep with $order failed during configuration"
5158 echo " ***********************************************"
5259 echo " Making $rep with $order "
5360 echo " ***********************************************"
54- make clean ; make -j 10 || { echo " !!!! $rep with $order failed during compilation with " ; exit 1 ; }
61+ make -j 8 || finish " !!!! $rep with $order failed during compilation"
5562
5663 ini_files=$( ls * .ini)
5764 for ini in $ini_files ; do
5865 echo " ***********************************************"
5966 echo " Running $rep with $order and $ini "
6067 echo " ***********************************************"
61- ./idefix -i $ini -nolog || { echo " !!!! $rep with $order failed running with $ini " ; exit 1 ; }
68+ ./idefix -i $ini -nolog || finish " !!!! $rep with $order failed running with $ini "
6269
6370 cd python
6471 echo " ***********************************************"
6572 echo " Testing $rep with $order and $ini "
6673 echo " ***********************************************"
67- python3 testidefix.py -noplot || { echo " !!!! $rep with $order failed validation with $ini " ; exit 1 ; }
74+ python3 testidefix.py -noplot || finish " !!!! $rep with $order failed validation with $ini "
6875 cd ..
6976 done
70- make clean
7177 rm -f * .vtk * .dbl * .dmp
7278 done
7379 echo " ***********************************************"
7480 echo " Cleaning $rep in $TMP_DIR "
7581 echo " ***********************************************"
76- rm -rf $TMP_DIR
82+ rm -rf * .vtk * .dbl * .dmp * .ini python CMakeLists.txt
7783done
7884
7985# do it with MPI (only the default .ini files though)
8086# High order tests
8187for rep in $rep_MPI_list ; do
82- TMP_DIR=" $( mktemp -d) "
8388 cp -R $TEST_DIR /$rep /* $TMP_DIR
8489 cd $TMP_DIR
8590 echo " ***********************************************"
8691 echo " Configuring $rep "
8792 echo " Using $TMP_DIR as working directory"
8893 echo " ***********************************************"
89- rm -f CMakeCache.txt
94+
9095 for order in $order_list ; do
9196
92- cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order -DIdefix_MPI=ON || { echo " !!!!$rep with $order failed during configuration" ; exit 1 ; }
97+ cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order -DIdefix_MPI=ON || finish " !!!!$rep with $order failed during configuration"
9398 echo " ***********************************************"
9499 echo " Making $rep with $order "
95100 echo " ***********************************************"
96- make clean ; make -j 10 || { echo " !!!! $rep with $order and MPI failed during compilation with" ; exit 1 ; }
101+ make -j 8 || finish " !!!! $rep with $order and MPI failed during compilation with"
97102
98103 echo " ***********************************************"
99104 echo " Running $rep with $order and MPI"
100105 echo " ***********************************************"
101- mpirun -np 4 ./idefix || { echo " !!!! $rep with $order and MPI failed running " ; exit 1 ; }
106+ mpirun -np 4 ./idefix || finish " !!!! $rep with $order and MPI failed running "
102107
103108 cd python
104109 echo " ***********************************************"
105110 echo " Testing $rep with $order and MPI"
106111 echo " ***********************************************"
107- python3 testidefix.py -noplot || { echo " !!!! $rep with $order and MPI failed validation" ; exit 1 ; }
112+ python3 testidefix.py -noplot || finish " !!!! $rep with $order and MPI failed validation"
108113 cd ..
109114
110- make clean
111115 rm -f * .vtk * .dbl * .dmp
112116 done
113117 echo " ***********************************************"
114118 echo " Cleaning $rep in $TMP_DIR "
115119 echo " ***********************************************"
116- rm -rf $TMP_DIR
120+ rm -rf * .vtk * .dbl * .dmp * .ini python CMakeLists.txt
117121done
122+
123+ echo " Test was successfull"
124+ cd $TEST_DIR
125+ rm -rf $TMP_DIR
0 commit comments