codetest_osbuild.sh 4.2 KB

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