/processing/scripts/postprocess.bat

http://crashrpt.googlecode.com/ · Batch · 77 lines · 54 code · 23 blank · 0 comment · 10 complexity · 7b52b736550d070fb44601955889b4d8 MD5 · raw file

  1. @echo off
  2. rem Process a group of ZIP error report files
  3. set INPUT_DIR="E:\ErrorReports"
  4. set INPUT_FILE_PATTERN="*.zip"
  5. set ACCEPTABLE_APPNAME="CrashRpt Tests"
  6. set ACCEPTABLE_APPVERSION="1.2.0"
  7. set SYM_SEARCH_DIRS="D:\Projects\CrashRpt\CrashRptSaved\1.2.0"
  8. set SAVE_RESULTS_TO_DIR="valid_reports\"
  9. set SAVE_INVALID_REPORTS_TO_DIR="invalid_reports\"
  10. set CRPROBER_PATH="D:\Projects\CrashRpt\bin\crprober.exe"
  11. mkdir %SAVE_RESULTS_TO_DIR%
  12. for /R %INPUT_DIR% %%f in ( %INPUT_FILE_PATTERN% ) do call :process_report "%%f"
  13. erase temp.txt
  14. exit
  15. :process_report
  16. echo Processing file: %1
  17. if %ACCEPTABLE_APPNAME%=="" goto appname_ok
  18. rem Get application name from the crash report file and write it to "temp.txt"
  19. %CRPROBER_PATH% /f %1 /o "temp.txt" /get XmlDescMisc AppName 0
  20. if not %errorlevel%==0 goto failed
  21. set /p app_name=<temp.txt
  22. if "%app_name%"==%ACCEPTABLE_APPNAME% goto appname_ok
  23. goto done
  24. :appname_ok
  25. if %ACCEPTABLE_APPVERSION%=="" goto appversion_ok
  26. rem Get application version from the crash report file and write it to "temp.txt"
  27. %CRPROBER_PATH% /f %1 /o "temp.txt" /get XmlDescMisc AppVersion 0
  28. if not %errorlevel%==0 goto failed
  29. set /p app_version=<temp.txt
  30. if "%app_version%"==%ACCEPTABLE_APPVERSION% goto appversion_ok
  31. goto done
  32. :appversion_ok
  33. set stack_md5=NoExceptionInfo
  34. %CRPROBER_PATH% /f %1 /o "temp.txt" /sym %SYM_SEARCH_DIRS% /get MdmpMisc ExceptionThreadStackMD5 0
  35. if not %errorlevel%==0 goto save_results
  36. set /p stack_md5=<temp.txt
  37. erase temp.txt
  38. if %stack_md5%=="" set stack_md5=NoSymbolsLoaded
  39. :save_results
  40. mkdir %SAVE_RESULTS_TO_DIR%%stack_md5%
  41. rem Process report and write results to text file
  42. %CRPROBER_PATH% /f %1 /o %1.txt /sym %SYM_SEARCH_DIRS%
  43. echo Return code=%errorlevel%
  44. if not %errorlevel%==0 goto failed
  45. :ok
  46. move %1 %SAVE_RESULTS_TO_DIR%%stack_md5%
  47. move %1.txt %SAVE_RESULTS_TO_DIR%%stack_md5%
  48. goto done
  49. :failed
  50. mkdir %SAVE_INVALID_REPORTS_TO_DIR%
  51. move %1 %SAVE_INVALID_REPORTS_TO_DIR%
  52. :done
  53. rem Return from subroutine
  54. goto :eof