]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ||
3 | ||
4 | function print_example(){ | |
5 | echo "##################################################################" | |
6 | echo "# To set the required parameters as source and the build #" | |
7 | echo "# directory for ctest, the linux flavour and the SIMPATH #" | |
8 | echo "# put the export commands below to a separate file which is read #" | |
9 | echo "# during execution and which is defined on the command line. #" | |
10 | echo "# Set all parameters according to your needs. #" | |
11 | echo "# LINUX_FLAVOUR should be set to the distribution you are using #" | |
12 | echo "# eg Debian, SuSe etc. #" | |
13 | echo "# An additional varibale NCPU can overwrite the default number #" | |
14 | echo "# of parallel processes used to compile the project. #" | |
15 | echo "# This can be usefull if one can use a distributed build system #" | |
16 | echo "# like icecream. #" | |
17 | echo "# For example #" | |
18 | echo "#!/bin/bash #" | |
19 | echo "#export LINUX_FLAVOUR=Ubuntu14.x #" | |
20 | echo "#export ROOTSYS=Path_to_ROOTSYS #" | |
21 | echo "#export ALFAPATH=<path_to_installation_of_external_packages> #" | |
22 | echo "#export BUILDDIR=/tmp/AliceO2/build_cdash #" | |
23 | echo "#export SOURCEDIR=~/AliceO2 #" | |
24 | echo "#export NCPU=8 #" | |
25 | echo "##################################################################" | |
26 | } | |
27 | ||
28 | if [ "$#" -lt "2" ]; then | |
29 | echo "" | |
30 | echo "-- Error -- Please start script with two parameters" | |
31 | echo "-- Error -- The first parameter is the ctest model." | |
32 | echo "-- Error -- Possible arguments are Nightly and Experimental ." | |
33 | echo "-- Error -- The second parameter is the file containg the" | |
34 | echo "-- Error -- Information about the setup at the client" | |
35 | echo "-- Error -- installation (see example below)." | |
36 | echo "" | |
37 | print_example | |
38 | exit 1 | |
39 | fi | |
40 | ||
41 | # test if a ctest model is either Experimantal or Nightly | |
42 | if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" ]; then | |
43 | echo "" | |
44 | else | |
45 | echo "-- Error -- This ctest model is not supported." | |
46 | echo "-- Error -- Possible arguments are Nightly, Experimental or Continuous." | |
47 | exit 1 | |
48 | fi | |
49 | ||
50 | # test if the input file exists and execute it | |
51 | if [ -e "$2" ];then | |
52 | source $2 | |
53 | else | |
54 | echo "-- Error -- Input file does not exist." | |
55 | echo "-- Error -- Please choose existing input file." | |
56 | exit 1 | |
57 | fi | |
58 | ||
59 | # set the ctest model to command line parameter | |
60 | export ctest_model=$1 | |
61 | ||
62 | # test for architecture | |
63 | arch=$(uname -s | tr '[A-Z]' '[a-z]') | |
64 | chip=$(uname -m | tr '[A-Z]' '[a-z]') | |
65 | ||
66 | # extract information about the system and the machine and set | |
67 | # environment variables used by ctest | |
68 | SYSTEM=$arch-$chip | |
69 | if test -z $CXX ; then | |
70 | COMPILER=gcc; | |
71 | GCC_VERSION=$(gcc -dumpversion) | |
72 | else | |
73 | COMPILER=$CXX; | |
74 | GCC_VERSION=$($CXX -dumpversion) | |
75 | fi | |
76 | ||
77 | export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-aliroot_$GIT_BRANCH | |
78 | export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') | |
79 | ||
80 | # get the number of processors | |
81 | # and information about the host | |
82 | if [ "$arch" = "linux" ]; | |
83 | then | |
84 | if [ "$NCPU" != "" ]; | |
85 | then | |
86 | export number_of_processors=$NCPU | |
87 | else | |
88 | export number_of_processors=$(cat /proc/cpuinfo | grep processor | wc -l) | |
89 | fi | |
90 | export SITE=$(hostname -f) | |
91 | elif [ "$arch" = "darwin" ]; | |
92 | then | |
93 | if [ "$NCPU" != "" ]; | |
94 | then | |
95 | export number_of_processors=$NCPU | |
96 | else | |
97 | export number_of_processors=$(sysctl -n hw.ncpu) | |
98 | fi | |
99 | export SITE=$(hostname -s) | |
100 | fi | |
101 | ||
102 | echo "************************" | |
103 | date | |
104 | echo "LABEL: " $LABEL | |
105 | echo "SITE: " $SITE | |
106 | echo "Model: " ${ctest_model} | |
107 | echo "Nr. of processes: " $number_of_processors | |
108 | echo "************************" | |
109 | ||
110 | cd $SOURCEDIR | |
111 | ||
112 | ctest -S $SOURCEDIR/AliRoot_test.cmake -V --VV |