create_example_summary()
{
   if [ -f "build.log" ]
   then
      SUM=`expr $SUM + 1`
      if [ $status = 0 ];
      then
          if [ -n "`egrep -i '(segmentation|killed|timeout|file not found|No such file or directory|NoClassDefFoundError|error|cannot find symbol|not found)' ./build.log | grep -v '_Errors=' | grep -v 'Status WARNING: com.windriver.ide.common.core code=0 Package "linux-2.x\(platform/linux/2\.x\.x\)" is not compatible and can.t be used by Wind River Workbench.' | grep -v 'Status INFO:'`" ]
          then
             FAIL=`expr $FAIL + 1`
      
             SEGMENTATIONFAULTS=`grep -ci "segmentation" ./build.log`
             FILENOTFOUND=`grep -ci "file not found" ./build.log`
             NOCLASSDEFFOUND=`grep -ci "NoClassDefFoundError" ./build.log`
             ERROR=`grep -v 'Status ERROR: com.windriver.ide.core code=0 Platform vxworks-6.6 for project' ./build.log | grep -v '_Errors=' | grep -ci "error"`
             CANNOTFINDSYMBOL=`grep -ci "cannot find symbol" ./build.log`
             KILLED=`grep -ci "killed" ./build.log`

             NOTFOUND=`grep -ci "not found" ./build.log`

             echo "$1 BUILD FAILED " >> build.log
             echo "$1 BUILD FAILED " >> $BUILD_RESULTS_LOG
             echo "" >> $BUILD_RESULTS_LOG
             echo "Segmentation Faults       = $SEGMENTATIONFAULTS" >> $BUILD_RESULTS_LOG
             echo "File not found errors     = $FILENOTFOUND" >> $BUILD_RESULTS_LOG
             echo "NoClassDefFound errors    = $NOCLASSDEFFOUND" >> $BUILD_RESULTS_LOG
             echo "Errors                    = $ERROR" >> $BUILD_RESULTS_LOG
             echo "Cannot find symbol errors = $CANNOTFINDSYMBOL" >> $BUILD_RESULTS_LOG
             echo "Killed                    = $KILLED" >> $BUILD_RESULTS_LOG

             echo "Not found                 = $NOTFOUND" >> $BUILD_RESULTS_LOG

             echo ""  >> $BUILD_RESULTS_LOG
             echo "See build_results.txt for full details of failures"  >> $BUILD_RESULTS_LOG
             echo ""  >> $BUILD_RESULTS_LOG
          else
             SUCC=`expr $SUCC + 1`
             echo "$1 BUILD PASSED" >> $BUILD_RESULTS_LOG
             echo "$1 BUILD PASSED" >> build.log
          fi
       else
         FAIL=`expr $FAIL + 1`
         echo "$1 BUILD FAILED " >> build.log
         echo "$1 BUILD FAILED : $status" >> $BUILD_RESULTS_LOG
       fi

      echo " #### Project: Tests End ####" >> build.log

      echo "" >> build.log

      # Add the logging for this example to a file that will contain output from all examples
      cat build.log
   fi
}

create_example_final_summary()
{
   cd "$CUR_PATH"
   
   # Add the summary to the start of the file
   
   echo "" >> $SUMMARY_LOG
   echo "############# Summary of Build ##########" >> $SUMMARY_LOG
   echo "     Examples Built   : $SUM" >> $SUMMARY_LOG
   echo "     Builds passed    : $SUCC" >> $SUMMARY_LOG
   echo "     Builds failed    : $FAIL" >> $SUMMARY_LOG
   echo "#########################################" >> $SUMMARY_LOG
   echo "" >> $SUMMARY_LOG
   
   echo "RESULTS ...." >> $SUMMARY_LOG
   echo ""
   cat $BUILD_RESULTS_LOG >> $SUMMARY_LOG
   
   rm $BUILD_RESULTS_LOG
   
   return $FAIL
}
