PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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