You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by tu...@apache.org on 2012/10/09 23:20:16 UTC

svn commit: r1396334 - in /oozie/trunk/bin: test-patch test-patch-20-tests

Author: tucu
Date: Tue Oct  9 21:20:15 2012
New Revision: 1396334

URL: http://svn.apache.org/viewvc?rev=1396334&view=rev
Log:
Improving testpatch test report and color coding in the summary (tucu)

Modified:
    oozie/trunk/bin/test-patch
    oozie/trunk/bin/test-patch-20-tests

Modified: oozie/trunk/bin/test-patch
URL: http://svn.apache.org/viewvc/oozie/trunk/bin/test-patch?rev=1396334&r1=1396333&r2=1396334&view=diff
==============================================================================
--- oozie/trunk/bin/test-patch (original)
+++ oozie/trunk/bin/test-patch Tue Oct  9 21:20:15 2012
@@ -21,7 +21,8 @@ TESTPATCHDIR=${BASEDIR}/test-patch
 TOOLSDIR=${TESTPATCHDIR}/tools
 TEMPDIR=${TESTPATCHDIR}/tmp
 REPORTDIR=${TESTPATCHDIR}/reports
-SUMMARYFILE=${REPORTDIR}/TEST-SUMMARY.txt
+SUMMARYFILE=${REPORTDIR}/TEST-SUMMARY.jira
+SUMMARYFILETXT=${REPORTDIR}/TEST-SUMMARY.txt
 
 JIRAHOST="https://issues.apache.org"
 JIRAURL="${JIRAHOST}/jira"
@@ -380,14 +381,14 @@ echo "" >> ${SUMMARYFILE}
 echo "----------------------------" >> ${SUMMARYFILE}
 MINUSONES=`grep -c "\}\-1" ${SUMMARYFILE}`
 if [[ $MINUSONES == 0 ]]; then
-  echo "{color:green}Overall result: Good!, no -1s{color}" >> ${SUMMARYFILE}
+  echo "{color:green}*+1 Overall result, good!, no -1s*{color}" >> ${SUMMARYFILE}
 else
-  echo "{color:red}Overall result: Please check the reported -1(s){color}" >> ${SUMMARYFILE}
+  echo "{color:red}*-1 Overall result, please check the reported -1(s)*{color}" >> ${SUMMARYFILE}
 fi
 echo "" >> ${SUMMARYFILE}
 WARNINGS=`grep -c "\}WARNING" ${SUMMARYFILE}`
 if [[ $WARNINGS != 0 ]]; then
-  echo "{color:red}There is at least one warning, please check{color}" >> ${SUMMARYFILE}
+  echo "{color:red}.   There is at least one warning, please check{color}" >> ${SUMMARYFILE}
 fi
 echo "" >> ${SUMMARYFILE}
 
@@ -396,13 +397,15 @@ if [ ! -z "${JIRAISSUE}" ]; then
   echo ""  >> ${SUMMARYFILE}
   echo ".   ${BUILD_URL}"  >> ${SUMMARYFILE}
   echo ""  >> ${SUMMARYFILE}
-  cat ${SUMMARYFILE}
 else
-  cat ${SUMMARYFILE}
   echo
   echo "Refer to ${REPORTDIR} for detailed test-patch reports"
   echo
 fi
 
+cat ${SUMMARYFILE} | sed -e 's/{color}//' -e 's/{color:green}//' -e 's/{color:red}//' -e 's/^\.//' -e 's/^\*//' -e 's/\*$//' > ${SUMMARYFILETXT}
+
+cat ${SUMMARYFILETXT}
+
 grep "\-1" ${SUMMARYFILE} &> /dev/null
 cleanupAndExit `expr $? = 0`

Modified: oozie/trunk/bin/test-patch-20-tests
URL: http://svn.apache.org/viewvc/oozie/trunk/bin/test-patch-20-tests?rev=1396334&r1=1396333&r2=1396334&view=diff
==============================================================================
--- oozie/trunk/bin/test-patch-20-tests (original)
+++ oozie/trunk/bin/test-patch-20-tests Tue Oct  9 21:20:15 2012
@@ -103,27 +103,30 @@ case $OP in
     echo "$exitCode" >  ${TEMPDIR}/${TASKNAME}.exitCode
     ;;
   report)
-    failedTests=`find . -name 'TEST*.xml' | xargs grep  -l -E "<failure|<error" | sed -e "s|.*target/surefire-reports/TEST-|          |g" | sed -e "s|\.xml||g"`
-    testsRun=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $3}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print "Tests run: "count}'`
-    testsFailed=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $5}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print "Tests failures: "count}'`
-    testsErrors=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $7}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print "Tests errors: "count}'`
-    hasFailures=`expr $testFailed + $testsErrors`
+    failedTests=` find . -name '*\.txt' | grep target/surefire-reports | xargs grep  "<<< FAILURE" | grep -v "Tests run:" | sed 's/.*\.txt\://' | sed 's/ .*//'`
+    testsRun=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $3}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}'`
+    testsFailed=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $5}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}'`
+    testsErrors=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $7}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}'`
+    hasFailures=`expr $testsFailed + $testsErrors`
     testsExitCode=`cat ${TEMPDIR}/${TASKNAME}.exitCode`
     if [[ $hasFailures != 0 ]] ; then
-      echo "{color:red}-1 ${TASKNAME}{color} - the patch failed the following testcases:" >> $SUMMARYFILE
+      echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+      echo ".    Tests run: $testsRun" >> $SUMMARYFILE
+      echo ".    Tests failed: $testsFailed" >> $SUMMARYFILE
+      echo ".    Tests errors: $testsErrors" >> $SUMMARYFILE
       echo "" >> ${SUMMARYFILE}
-      echo "${failedTests}" >> $SUMMARYFILE
+      echo ".    The patch failed the following testcases:" >> $SUMMARYFILE
+      echo "" >> ${SUMMARYFILE}
+      echo "${failedTests}" | sed 's/^/.      /' >> $SUMMARYFILE
       echo "" >> ${SUMMARYFILE}
     else
       if [[ "$testsExitCode" != "0" ]] ; then
           echo "{color:red}-1 ${TASKNAME}{color} - patch does not compile, cannot run testcases" >> $SUMMARYFILE
       else
         echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+        echo ".    Tests run: $testsRun" >> $SUMMARYFILE
       fi
     fi
-    echo ".   $testsRun" >> $SUMMARYFILE
-    echo ".   $testsFailed" >> $SUMMARYFILE
-    echo ".   $testsErrors" >> $SUMMARYFILE
     ;;
 esac