Dart.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/bin/bash
  2. function print_example(){
  3. echo "##################################################################"
  4. echo "# To set the required parameters as source and the build #"
  5. echo "# directory for ctest, the linux flavour and the SIMPATH #"
  6. echo "# put the export commands below to a separate file which is read #"
  7. echo "# during execution and which is defined on the command line. #"
  8. echo "# Set all parameters according to your needs. #"
  9. echo "# LINUX_FLAVOUR should be set to the distribution you are using #"
  10. echo "# eg Debian, SuSe etc. #"
  11. echo "# For example #"
  12. echo "#!/bin/bash #"
  13. echo "#export LINUX_FLAVOUR=Etch32 #"
  14. echo "#export FAIRSOFT_VERSION=mar08 #"
  15. echo "#export SIMPATH=<path_to_installation_of_external_packages> #"
  16. echo "#export BUILDDIR=/tmp/fairroot/build_cbm_\${FAIRSOFT_VERSION} #"
  17. echo "#export SOURCEDIR=/misc/uhlig/SVN/ctest/cbmroot #"
  18. echo "##################################################################"
  19. }
  20. #if test "x$SIMPATH" = "x" ; then
  21. # echo ""
  22. # echo "-- Error -- You don't set the needed variables in this shell script."
  23. # echo "-- Error -- Please edit the script and do so."
  24. # echo ""
  25. # exit 1
  26. #fi
  27. if [ "$#" -lt "1" ]; then
  28. echo ""
  29. echo "-- Error -- Please start script with one,two,three, four or five parameters:"
  30. echo "-- Error -- 1st parameter - Nightly or Experimental "
  31. echo "-- Error -- 2nd parameter - path to your *.cmake files (trunk)"
  32. echo "-- Error -- 3rd parameter - CDash_Env_MpdRoot.sh (default)"
  33. echo "-- Error -- 4th parameter - path to your config.sh (build)"
  34. echo "-- Error -- 5th parameter - fairsoft: jul09(default), jan10, or jun11"
  35. echo ""
  36. print_example
  37. exit 1
  38. fi
  39. # test if a ctest model is either Experimantal or Nightly
  40. if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" ]; then
  41. echo ""
  42. else
  43. echo "-- Error -- This ctest model is not supported."
  44. echo "-- Error -- Possible arguments are Nightly, Experimental or Continuous."
  45. exit 1
  46. fi
  47. # test if the input file exists and execute it
  48. # if [ "$#" -gt "2" ]; then
  49. if [ -e "$2" ]; then
  50. cd $2
  51. if [ "$#" -gt "4" ]; then
  52. sleep 2
  53. source $3 $2 $4 $5
  54. else
  55. if [ -e "$4" ]; then
  56. sleep 2
  57. source $3 $2 $4
  58. else
  59. if [ -e "$3" ]; then
  60. sleep 2
  61. source $3 $2
  62. else
  63. sleep 2
  64. source CDash_Env_MpdRoot.sh $2
  65. fi
  66. fi
  67. fi
  68. else
  69. if [ "$#" -gt "1" ]; then
  70. cd $2
  71. sleep 2
  72. source CDash_Env_MpdRoot.sh $2
  73. else
  74. sleep 2
  75. source CDash_Env_MpdRoot.sh $(pwd)
  76. fi
  77. fi
  78. # set the ctest model to command line parameter
  79. export ctest_model=$1
  80. # test for architecture
  81. arch=$(uname -s | tr '[A-Z]' '[a-z]')
  82. chip=$(uname -m | tr '[A-Z]' '[a-z]')
  83. # extract information about the system and the machine and set
  84. # environment variables used by ctest
  85. SYSTEM=$arch-$chip
  86. if test -z $CXX ; then
  87. COMPILER=gcc;
  88. GCC_VERSION=$(gcc -dumpversion)
  89. else
  90. COMPILER=$CXX;
  91. GCC_VERSION=$($CXX -dumpversion)
  92. fi
  93. export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-fairsoft_$FAIRSOFT_VERSION
  94. export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g')
  95. # get the number of processors
  96. # and information about the host
  97. if [ "$arch" = "linux" ];
  98. then
  99. if [ "$NCPU" != "" ];
  100. then
  101. export number_of_processors=$NCPU
  102. else
  103. export number_of_processors=$(cat /proc/cpuinfo | grep processor | wc -l)
  104. fi
  105. export SITE=$(hostname -f)
  106. elif [ "$arch" = "darwin" ];
  107. then
  108. if [ "$NCPU" != "" ];
  109. then
  110. export number_of_processors=$NCPU
  111. else
  112. export number_of_processors=$(sysctl -n hw.ncpu)
  113. fi
  114. export SITE=$(hostname -s)
  115. fi
  116. echo "************************"
  117. date
  118. echo "LABEL: " $LABEL
  119. echo "SITE: " $SITE
  120. echo "Model: " ${ctest_model}
  121. echo "Nr. of processes: " $number_of_processors
  122. echo "************************"
  123. cd $SOURCEDIR
  124. # cd $BUILDDIR
  125. ctest -S $SOURCEDIR/MpdRoot_test.cmake -V --VV
  126. echo "******************* end of Dart.sh *****"