|
1 #!/bin/sh |
|
2 |
|
3 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 # All rights reserved. |
|
5 # This component and the accompanying materials are made available |
|
6 # under the terms of the License "Eclipse Public License v1.0" |
|
7 # which accompanies this distribution, and is available |
|
8 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 # |
|
10 # Initial Contributors: |
|
11 # Nokia Corporation - initial contribution. |
|
12 # |
|
13 # Contributors: |
|
14 # |
|
15 # Description: |
|
16 # Build automation for Symbian OS with Raptor |
|
17 # Author: Timothy N Murphy |
|
18 # |
|
19 # |
|
20 |
|
21 # You can edit these: |
|
22 H=/home/tmurphy |
|
23 export H |
|
24 export EPOCROOT="$H/baselineos" |
|
25 export LOGBASEDIR=~/public_html/buildlogs |
|
26 export BUILDROOT="$H/baselineos" |
|
27 export SOURCEROOT="$H/baselineos/fsupdate" |
|
28 export SYSDEF="$H/baselineos/system_definition_fsupdate.xml" |
|
29 export PREEXPORTSYSDEF="$SBS_HOME/test/envelope/preexport.xml" |
|
30 #export PARALLEL=0 |
|
31 |
|
32 genstats() { |
|
33 if [ "$1.stats" -ot "$1.log" ]; then |
|
34 python "$SBS_HOME/bin/buildstats.py" "$1.log" > "$1.stats" && |
|
35 #python "$SBS_HOME/bin/failedstats.py" -m "$1.log" > "$1.failed"; |
|
36 ( |
|
37 cd $EPOCROOT/epoc32 && find "release" > "$1.release_files" && find "build" > "$1.build_files" && find include > "$1.include_files" |
|
38 ) |
|
39 fi; |
|
40 } |
|
41 |
|
42 cd $BUILDROOT |
|
43 |
|
44 |
|
45 # Don't edit the rest: |
|
46 ################################################### |
|
47 export KEY=`date +%d_%m_%y` |
|
48 export DAILYDIR="$LOGBASEDIR/$KEY" |
|
49 export BUILDNAME="`basename \"$SYSDEF\" | sed 's#\.[^.][^.]*$##'`" |
|
50 export LOGNAME="${BUILDNAME}_${KEY}" |
|
51 export PLATFORM=armv5 |
|
52 export TESTLOG="$DAILYDIR/parallel_speedtest.log" |
|
53 |
|
54 for BUILDNUM in {1..50}; do |
|
55 if [ ! -d "$DAILYDIR/$BUILDNUM" ]; then |
|
56 break |
|
57 fi |
|
58 if [ ! -f "$DAILYDIR/$BUILDNUM/${LOGNAME}_$BUILDNUM.log" ]; then |
|
59 break |
|
60 fi |
|
61 done |
|
62 |
|
63 # make the day's directory |
|
64 mkdir -p "$DAILYDIR" |
|
65 |
|
66 echo "testrun: $TESTLOG, build $BUILDNUM of the day:" |
|
67 echo '<testrun>' > "$TESTLOG" |
|
68 |
|
69 |
|
70 # Loop through different cluster loads |
|
71 #for PARALLEL in 52 48 44 40 36 32 28 24 20 16 8 4; do |
|
72 for PARALLEL in 44 40 36 32 28 24 20 16 8 4; do |
|
73 export PARALLEL i |
|
74 echo "Parallel: $PARALLEL" |
|
75 ( |
|
76 echo "<test type='performance' name='speedtest' >" |
|
77 echo " <parameters parallel='$PARALLEL' start='`date`' />" |
|
78 echo " <logfile>$DAILYDIR/$BUILDNUM/${LOGNAME}_$BUILDNUM.log</logfile>" |
|
79 MAKEFILE=$TESTBASE/test$CODEFACTOR.mk |
|
80 echo "" |
|
81 |
|
82 OUTDIR="$DAILYDIR/$BUILDNUM" |
|
83 TIMELOG="$OUTDIR/${LOGNAME}_$BUILDNUM.time" |
|
84 |
|
85 echo " <build number='$BUILDNUM' of='$KEY' output='$OUTDIR'><![CDATA[" |
|
86 if [ ! -d "$OUTDIR" ]; then |
|
87 mkdir -p "$OUTDIR" || exit 1 |
|
88 fi |
|
89 set -x |
|
90 |
|
91 # Make sure that our "stop signal" is clear |
|
92 SIGNALTOSTOPFILE="$OUTDIR/${LOGNAME}_$BUILDNUM.stop" |
|
93 rm -f "$SIGNALTOSTOPFILE" |
|
94 |
|
95 |
|
96 echo "EPOCROOT is $EPOCROOT" |
|
97 export PATH=$EPOCROOT/epoc32/tools:$PATH |
|
98 |
|
99 ( |
|
100 echo "Annihilating epoc32 tree(s)" |
|
101 # wipe the epoc32 directory first |
|
102 chmod -R u+rw "$EPOCROOT/epoc32" && |
|
103 rm -rf "$EPOCROOT/epoc32" && |
|
104 echo "epoc32 tree withered" |
|
105 ) |
|
106 ( |
|
107 # unzip the pre-prepared epoc32 trees |
|
108 cd $EPOCROOT && |
|
109 ( |
|
110 unzip -o $BUILDROOT/epoc32.zip | grep "epoc32/" | sed 's#.* \(epoc32/.*\)#\1#' | xargs touch && |
|
111 unzip -o $BUILDROOT/variant.zip | grep "epoc32/" | sed 's#.* \(epoc32/.*\)#\1#' | xargs touch |
|
112 ) > "$OUTDIR/unzip" && |
|
113 chmod -R u+rw "$EPOCROOT/epoc32" && |
|
114 echo "unzipped skeleton epoc32 tree" |
|
115 ) && ( |
|
116 echo "Pre-export" |
|
117 $SBS_HOME/bin/sbs -d -k -s "$PREEXPORTSYSDEF" -a "$SOURCEROOT" -c $PLATFORM EXPORT > $OUTDIR/${LOGNAME}_$BUILDNUM.preexport 2>&1 || { |
|
118 echo "Pre-export failed"; |
|
119 exit 1 |
|
120 } |
|
121 ) |
|
122 |
|
123 echo "Prepping makefiles" |
|
124 ( |
|
125 echo "<times>\n" |
|
126 export TIMEFORMAT=$'<time stage='prepmake'>%3R</time>\n' |
|
127 time cp performance_Makefile $EPOCROOT/epoc32/build/Makefile |
|
128 ) > "$TIMELOG" 2>&1 |
|
129 |
|
130 echo "Running Make" |
|
131 ( |
|
132 # The build process |
|
133 export TIMEFORMAT=$'<time stage='make' parallel='$PARALLEL'>%3R</time>\n' |
|
134 |
|
135 time /usr/local/raptor/make-pvm-381/pvmgmake -j$PARALLEL --debug=j -k -f $MAKEFILE > "$OUTDIR/${LOGNAME}_$BUILDNUM.log" 2>&1 |
|
136 touch "$SIGNALTOSTOPFILE" |
|
137 echo "</times>\n" |
|
138 ) >> "$TIMELOG" 2>&1 & |
|
139 ( |
|
140 set +x |
|
141 # Concurrent process to continuously update statistics |
|
142 echo "" |
|
143 |
|
144 while [ 1 -eq 1 ]; do |
|
145 sleep 20 |
|
146 echo -n "." |
|
147 |
|
148 if [ -e "$SIGNALTOSTOPFILE" ]; then |
|
149 rm -f "$SIGNALTOSTOPFILE" |
|
150 break |
|
151 fi |
|
152 done |
|
153 echo "" |
|
154 ) |
|
155 set +x |
|
156 genstats "$OUTDIR/${LOGNAME}_$BUILDNUM" |
|
157 |
|
158 echo " ]]></build>" |
|
159 echo "</test>" |
|
160 ) >> "$TESTLOG" 2>&1 |
|
161 |
|
162 BUILDNUM=$[ $BUILDNUM + 1 ] |
|
163 # use a new output directory |
|
164 done # PARALLEL |
|
165 echo -e "<testrun_stat endtime='`date`'\n />" >> "$TESTLOG" |
|
166 echo "</testrun>" >> "$TESTLOG" |