]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/CalibMacros/CPass1/validation.sh
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGPP / CalibMacros / CPass1 / validation.sh
1 #!/bin/bash
2
3 FILESTOCHECK="rec_Barrel.log rec_Outer.log calib.log AliESDs_Barrel.root AliESDfriends_v1.root"
4
5 validateout=`dirname $0`
6
7 if [ -z "$validateout" ]; then
8     validateout="."
9 fi
10
11 cd "$validateout"
12 validateworkdir=`pwd`
13
14 (
15 echo "* *****************************************************"
16 echo "* AliRoot Validation Script V2.0                      *"
17 echo "* Time:    `date`"
18 echo "* Dir:     $validateout"
19 echo "* Workdir: $validateworkdir"
20 echo "* ----------------------------------------------------*"
21
22 for subdir in . Barrel OuterDet; do
23     if [ -d "$subdir" ]; then
24         echo "Listing $subdir" 
25         ls -lA "$subdir/"
26         echo ""
27     fi
28 done
29
30 echo "* ----------------------------------------------------*"
31 ) >> stdout
32
33 if [ -f OCDB.generating.job ]; then
34     echo "* This was a special OCDB.root job for which I'll skip the rest of the validation" >> stdout
35
36     mv stdout stdout.ocdb.log 2>/dev/null
37     mv stderr stderr.ocdb.log 2>/dev/null
38     mv rec.log stdrec.ocdb.log 2>/dev/null
39
40     if [ -f OCDB.root ]; then
41         echo "* ODCB.root found" >> stdout.ocdb.log
42         exit 0
43     else
44         echo "* Error: OCDB.root NOT found! Failing validation" >> stdout.ocdb.log
45         exit 1
46     fi
47 fi
48
49 error=0
50
51 for file in $FILESTOCHECK; do
52     if [ ! -f "$file" ]; then
53         error=1
54         echo "* Error: Required file $file not found in the output" >> stdout
55     fi
56 done
57
58 for message in "std::bad_alloc" "Segmentation violation" "Segmentation fault" "Bus error" "Break" "Floating point exception" "Killed" "busy flag cleared"; do
59     found=`grep -i -n -m 1 "$message" *.log`
60     if [ ! -z "$found" ]; then
61         (
62         echo "* Found error message '$message' in the logs:"
63         echo "$found"
64         echo ""
65         ) >> stdout
66
67         error=2
68     fi
69 done
70
71 (
72 if [ $error -eq 0 ]; then
73     echo "* ################   Job validated ####################"
74 else
75     echo "* ################   Job NOT validated, error code $error ################"
76 #    echo "* ########## Removing all ROOT files from the local directory, leaving only the logs ###"
77 #    rm -rf *.root
78 fi
79 ) >> stdout
80
81 mv stdout stdout.log
82 mv stderr stderr.log
83
84 exit $error