CE-cms-analysis 1.72 KB
Newer Older
Stefano Belforte's avatar
Stefano Belforte committed
1
#!/bin/sh
2

Stefano Belforte's avatar
Stefano Belforte committed
3
4
shopt -s expand_aliases

5
err=0
Stefano Belforte's avatar
Stefano Belforte committed
6
7
8
warn=0

# Source the CMS environment
Andrea Sciaba's avatar
Andrea Sciaba committed
9
10
11
if [ -n "$OSG_GRID" ] ; then
    [ -f $OSG_GRID/setup.sh ] && source $OSG_GRID/setup.sh
    if [ -d $OSG_APP/cmssoft/cms ] ;then
Andrea Sciaba's avatar
Andrea Sciaba committed
12
	SW_DIR=$OSG_APP/cmssoft/cms
Andrea Sciaba's avatar
Andrea Sciaba committed
13
    elif [ -d $CVMFS/cms.cern.ch ] ; then
Andrea Sciaba's avatar
Andrea Sciaba committed
14
	SW_DIR=$CVMFS/cms.cern.ch
Andrea Sciaba's avatar
Andrea Sciaba committed
15
    elif [ -d /cvmfs/cms.cern.ch ] ; then
Andrea Sciaba's avatar
Andrea Sciaba committed
16
	SW_DIR=/cvmfs/cms.cern.ch
Andrea Sciaba's avatar
Andrea Sciaba committed
17
    else
Andrea Sciaba's avatar
Andrea Sciaba committed
18
19
20
        echo "ERROR: Cannot find CMS software in OSG node"
	echo "summary: SW_DIR_UNDEF"
	exit $SAME_ERROR
Andrea Sciaba's avatar
Andrea Sciaba committed
21
    fi
Stefano Belforte's avatar
Stefano Belforte committed
22
23
elif [ -n "$VO_CMS_SW_DIR" ] ; then
    SW_DIR=$VO_CMS_SW_DIR
Stefano Belforte's avatar
Stefano Belforte committed
24
else
25
    SW_DIR=/cvmfs/cms.cern.ch
Stefano Belforte's avatar
Stefano Belforte committed
26
fi
27

Stefano Belforte's avatar
Stefano Belforte committed
28
29
30
tmpfile=`mktemp /tmp/tmp.XXXXXXXXXX`
source $SW_DIR/cmsset_default.sh > $tmpfile 2>&1
result=$?
Andrea Sciaba's avatar
Andrea Sciaba committed
31
32
33
34
35
if [ $result != 0 ]; then
    cat $tmpfile
    rm -f $tmpfile
    echo "ERROR: CMS software initialisation script cmsset_default.sh failed"
    echo "summary: NO_SETUP_SCRIPT"
Stefano Belforte's avatar
Stefano Belforte committed
36
37
    exit $SAME_ERROR
fi
Andrea Sciaba's avatar
Andrea Sciaba committed
38
rm -f $tmpfile
Stefano Belforte's avatar
Stefano Belforte committed
39

40
41
42
43
44
45
46
47
48
49
50
51
arch=`cmsos`
if [[ $arch == slc6* ]]; then
    export SCRAM_ARCH=slc6_amd64_gcc530
elif [[ $arch == slc7* ]] ; then
    export SCRAM_ARCH=slc7_amd64_gcc530
else
    echo "ERROR: unknown OS"
    echo "summary: UNKN_OS"
    exit $SAME_ERROR
fi
export BUILD_ARCH=$SCRAM_ARCH

52
# Execute main test scripts
Andrea Sciaba's avatar
Andrea Sciaba committed
53
54
55
echo
echo "Test analysis of data from /store/data..."
echo
Stefano Belforte's avatar
Stefano Belforte committed
56
AnalysisTestWorkDir=`mktemp -d AnalysisTestWorkDir.XXXXXXXXXX`
57
pushd . > /dev/null
Stefano Belforte's avatar
Stefano Belforte committed
58
cd $AnalysisTestWorkDir
Andrea Sciaba's avatar
Andrea Sciaba committed
59
$SAME_SENSOR_HOME/tests/AnalysisTest.sh > AnalysisTest.out 2>&1
Stefano Belforte's avatar
Stefano Belforte committed
60
result=$?
Andrea Sciaba's avatar
Andrea Sciaba committed
61
cat AnalysisTest.out
62
popd > /dev/null
63

Andrea Sciaba's avatar
Andrea Sciaba committed
64
if [ $result == "$SAME_WARNING" ] ; then
65
66
67
  warn=1
fi

Andrea Sciaba's avatar
Andrea Sciaba committed
68
if [ $result == "$SAME_ERROR" ] ; then
69
70
71
  err=1
fi

Andrea Sciaba's avatar
Andrea Sciaba committed
72
if [ $result != "$SAME_OK" ] ; then
Stefano Belforte's avatar
Stefano Belforte committed
73
74
75
  warn=1
fi

76
if [ $err == 1 ] ; then
77
    exit $SAME_ERROR
Stefano Belforte's avatar
Stefano Belforte committed
78
79
80
81
82
83
84
fi

if [ $warn == 1 ] ; then
    exit $SAME_WARNING
fi

exit $SAME_OK