1#! /bin/sh 2# $Id: check.sh 147909 2008-12-17 15:57:58Z ivanov $ 3# Author: Vladimir Ivanov (ivanov@ncbi.nlm.nih.gov) 4# 5# Check C++ Toolkit in all previously built configurations under Cygwin 6 7 8########### Arguments 9 10script="$0" 11method="$1" 12 13 14########## Functions 15 16error() 17{ 18 echo "[`basename $script`] ERROR: $1" 19 exit 1 20 21} 22 23 24########## Main 25 26NCBI_CHECK_SETLIMITS=0 27export NCBI_CHECK_SETLIMITS 28 29 30# Get build dir 31build_dir=`dirname $script` 32build_dir=`(cd "$build_dir"; pwd)` 33 34res_log="$build_dir/check.sh.log" 35res_concat="$build_dir/check.sh.out" 36res_concat_err="$build_dir/check.sh.out_err" 37 38 39if [ ! -d $build_dir ] ; then 40 error "Build directory $build_dir not found" 41fi 42 43cd $build_dir || error "Cannot change directory" 44 45cfgs="`cat cfgs.log`" 46if [ -z "$cfgs" ] ; then 47 error "Build some configurations first" 48fi 49 50 51case "$method" in 52 run ) 53 rm -f "$res_log" 54 ;; 55 concat ) 56 rm -f "$res_concat" 57 ;; 58 concat_err ) 59 rm -f "$res_concat_err" 60 ;; 61 concat_cfg ) 62 rm -f $res_script.*.log 63 rm -f $res_script.*.out_err 64 ;; 65esac 66 67 68for cfg in $cfgs ; do 69 cd $build_dir/../.. || error "Cannot change directory" 70 71 if [ -z "$cfg" -o ! -d "$cfg" ] ; then 72 error "Build directory for \"$cfg\" configuration not found" 73 fi 74 cd $cfg/build || error "Cannot change build directory" 75 x_cfg=`echo $cfg | sed 's|.*-||'` 76 x_sed="s| -- \[| -- [${x_cfg}/|" 77 78 case "$method" in 79 run ) 80 make check_r RUN_CHECK=Y 81 cat check.sh.log | sed "$x_sed" >> "$res_log" 82 ;; 83 load_to_db ) 84 ./check.sh load_to_db 85 ;; 86 clean ) 87 ./check.sh clean 88 ;; 89 concat ) 90 ./check.sh concat 91 cat check.sh.out | sed "$x_sed" >> "$res_concat" 92 echo >> "$res_concat" 93 ;; 94 concat_err ) 95 ./check.sh concat_err 96 cat check.sh.out_err | sed "$x_sed" >> "$res_concat_err" 97 echo >> "$res_concat_err" 98 ;; 99 concat_cfg ) 100 cp check.sh.log $build_dir/check.sh.${x_cfg}.log 101 cp check.sh.out_err $build_dir/check.sh.${x_cfg}.out_err 102 ;; 103 esac 104done 105 106exit 0 107