Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

320 lines
11 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM AllRel.cmd
  5. REM Check the status of release across release servers
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  10. perl -x "%~f0" %*
  11. goto :EOF
  12. #!perl
  13. use strict;
  14. use lib $ENV{RAZZLETOOLPATH} . "\\sp";
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use ParseArgs;
  17. use GetIniSetting;
  18. sub Usage { print<<USAGE; exit(1) }
  19. allrel [-l: <language> [-n: <build number>] [-b: <branch>] [-a: <arch>]
  20. [-t: <type>] [-s: <server>] [-showlogs]
  21. Check the release servers specified in the .ini file for the state of
  22. the matching release.
  23. lang Language for which to examine the release logs.
  24. Default is 'usa'. Specify 'all' for all langs. Specify
  25. a comma-delimited list to look at multiple langs.
  26. build number Build number for which to examine the release logs.
  27. Default is latest build for each server / flavor.
  28. branch Branch for which to examine the release logs.
  29. Default is %_BuildBranch%.
  30. arch Build architecture for which to examine the release logs.
  31. Default is %_BuildArch%.
  32. type Build architecture for which to examine the release logs.
  33. Default is %_BuildType%.
  34. showlogs Show the log file name being examined on each server.
  35. server Restrict search to a single server
  36. USAGE
  37. my ( $lang, @langs, $build, $branch, @arches, @types);
  38. my ( $server_list, @servers_to_check, $showlogs, $showWarning, @releaseWarning );
  39. parseargs('?' => \&Usage,
  40. 'l:'=> \$lang,
  41. 'n:'=> \$build,
  42. 'b:'=> \$branch,
  43. 'a:'=> \@arches,
  44. 't:'=> \@types,
  45. 's:'=> \$server_list,
  46. 'w' => \$showWarning,
  47. 'showlogs' => \$showlogs);
  48. # USA is our default language
  49. if (!$lang) {$lang='usa'};
  50. # Split out the language and server lists...
  51. @langs = split /,/, $lang;
  52. @servers_to_check = split /,/, $server_list;
  53. # If all, default to the full list
  54. $ENV{lang} = 'usa';
  55. if ($lang =~ /all/i){
  56. @langs = ('usa', 'ger', 'jpn', 'fr', 'kor', 'chs', 'cht', 'chh', 'ara', 'heb', 'es', 'it', 'sv', 'nl', 'br', 'no', 'da', 'fi', 'cs', 'pl', 'hu', 'ru', 'pt', 'tr', 'el');
  57. }
  58. elsif($lang =~ /tier1/i){
  59. @langs = ('usa', 'ger', 'jpn', 'fr', 'kor');
  60. }
  61. elsif($lang =~ /tier2/i){
  62. @langs = ('chs', 'cht', 'ara', 'heb');
  63. }
  64. elsif($lang =~ /tier3/i){
  65. @langs = ('chh', 'es', 'it', 'sv', 'nl', 'br', 'no', 'da', 'fi', 'cs', 'pl', 'hu', 'ru', 'pt', 'tr', 'el');
  66. }
  67. else
  68. {
  69. $ENV{lang} = $langs[0];
  70. }
  71. *GetSettingQuietEx = \&GetIniSetting::GetSetting;
  72. $branch ||= $ENV{_BUILDBRANCH};
  73. if (!@arches) { @arches = ('x86', 'ia64') }
  74. if (!@types) { @types = ('fre', 'chk') }
  75. my @thinServers = split /\s+/,GetSettingQuietEx( "ThinRelease" );
  76. # Loop over langs
  77. for $lang (@langs)
  78. {
  79. if ( @langs > 1 )
  80. {
  81. print "****************************************************************\n";
  82. }
  83. $lang =~ tr/[a-z]/[A-Z]/;
  84. # Loop over archs
  85. for my $arch (@arches)
  86. {
  87. # Loop over debug types
  88. for my $type (@types)
  89. {
  90. my @buildMachines = split /\s+/, GetSettingQuietEx("BuildMachine\:\:$arch\:\:$type\:\:$lang");
  91. my @servers = split /\s+/, GetSettingQuietEx("ReleaseServers\:\:$lang\:\:$arch$type");
  92. # Anything to see here?
  93. if ( !@servers )
  94. {
  95. next;
  96. }
  97. # If asked for specific servers, strip the server list down...
  98. if ( @servers_to_check )
  99. {
  100. # Hunt the list for at least one match...
  101. my @new_server_list;
  102. my $ServerFound = 0;
  103. for my $this_server_to_check (@servers_to_check)
  104. {
  105. for my $known_server (@servers)
  106. {
  107. $known_server =~ tr/[a-z]/[A-Z]/;
  108. $this_server_to_check =~ tr/[a-z]/[A-Z]/;
  109. if ( $this_server_to_check == $known_server )
  110. {
  111. $ServerFound = 1;
  112. push @new_server_list, $this_server_to_check;
  113. }
  114. }
  115. }
  116. # Did we _NOT_ find anything?
  117. if ( !$ServerFound )
  118. {
  119. print " ERROR: No valid servers to check : @servers_to_check\n";
  120. last;
  121. }
  122. # Copy over the trimmed list of servers to check and make it a unique list...
  123. @servers = @new_server_list;
  124. my %seen;
  125. @servers = grep {!$seen{$_}++} @servers;
  126. }
  127. print "\n";
  128. print "[$lang - $arch$type]\n";
  129. for my $bldMachine ( @buildMachines )
  130. {
  131. for my $server (@servers)
  132. {
  133. my $isThinServer = 1 if ( grep { $server eq $_} @thinServers );
  134. my $NoLogFound = 0;
  135. my $FailedToOpenLog = 0;
  136. my $FailedToParseLog = 0;
  137. my $IsReleaseRunning = 0;
  138. my $IsReleaseDone = 0;
  139. my $IsThereAnError = 0;
  140. my $LogFileTime = "[UNKNOWN]";
  141. my $ReleaseLogDir = "[UNKNOWN]";
  142. my $ReleaseLogFile = "[UNKNOWN]";
  143. my $ReleaseErrFile = "[UNKNOWN]";
  144. my @ReleaseErrMsg = "[UNKNOWN]";
  145. # Tell the user what server we're examining
  146. printf( " %-11.11s : $build",$server);
  147. # Find the log files...
  148. my $temp = 'temp$';
  149. my $alt_temp = 'c$\\temp';
  150. for ( my $loop=0; $loop<2; $loop++ )
  151. {
  152. my ( $log_dir, $alt_log_dir, $log_base);
  153. if( $loop == 0 )
  154. {
  155. $log_dir = "\\\\$bldMachine\\$temp";
  156. $alt_log_dir = "\\\\$bldMachine\\$alt_temp";
  157. $log_base = "$alt_log_dir\\$lang";
  158. }
  159. else
  160. {
  161. last if( !$isThinServer );
  162. printf( " Thin release");
  163. $log_dir = "\\\\$server\\$temp";
  164. $alt_log_dir = "\\\\$server\\$alt_temp";
  165. $log_base = "$log_dir\\$lang";
  166. }
  167. # See if share exists, if not use temp$ share instead...
  168. if ( !-e $log_dir && !-e $alt_log_dir)
  169. {
  170. # Nothing found - print nasty errors and continue.
  171. print " : ERROR - No logs found at:\n";
  172. print " $log_dir\n";
  173. print " $alt_log_dir\n";
  174. next;
  175. }
  176. else
  177. {
  178. # Main dir not found and alt dir exists - use alt dir.
  179. $log_dir = $alt_log_dir;
  180. }
  181. my ( $logfile, $errfile );
  182. if( $loop == 0 )
  183. {
  184. $logfile = "$log_base\\propbuild.$build.$arch$type.$server.log";
  185. $errfile = "$log_base\\propbuild.$build.$arch$type.$server.err";
  186. }
  187. else
  188. {
  189. $logfile = "$log_base\\buildslp.$build.$arch$type.log";
  190. $errfile = "$log_base\\buildslp.$build.$arch$type.err";
  191. }
  192. # Save this off for later...
  193. $ReleaseLogDir = $log_base;
  194. $ReleaseLogFile = $logfile;
  195. $ReleaseErrFile = $errfile;
  196. # Look for an error file to see if something has gone awry...
  197. if (-e $errfile and !-z $errfile)
  198. {
  199. # We found an error file. Save that info off.
  200. $IsThereAnError = 1;
  201. $ReleaseErrFile = $errfile;
  202. @ReleaseErrMsg = `tail $errfile`;
  203. }
  204. # Examine the logs for details we care about
  205. if (!-e $logfile)
  206. {
  207. $NoLogFound = 1;
  208. }
  209. else
  210. {
  211. if( !open FILE, $logfile)
  212. {
  213. $FailedToOpenLog = 1;
  214. }
  215. else
  216. {
  217. $LogFileTime = localtime((stat FILE)[9]);
  218. seek(FILE,-100,2);
  219. local $/ = undef;
  220. if (<FILE> =~ /NO ERRORS ENCOUNTERED/)
  221. {
  222. $IsReleaseDone = 1;
  223. }
  224. if ( !$IsReleaseDone )
  225. {
  226. $IsReleaseRunning = 1;
  227. }
  228. close FILE;
  229. @releaseWarning = `findstr /i warning $logfile`;
  230. }
  231. }
  232. # Done gathering info for this server. Print it.
  233. if ( $NoLogFound )
  234. {
  235. print " : NO LOG FOUND\n";
  236. print " $ReleaseLogDir\n";
  237. }
  238. elsif ( $FailedToOpenLog )
  239. {
  240. print " : FAILED TO OPEN LOG\n";
  241. print " $ReleaseLogFile\n";
  242. }
  243. elsif ( $FailedToParseLog )
  244. {
  245. print " : FAILED TO PARSE LOG\n";
  246. print " $ReleaseLogFile\n";
  247. }
  248. else
  249. {
  250. print " : ";
  251. if ( $IsThereAnError )
  252. {
  253. print "ERROR. ";
  254. }
  255. if ( $IsReleaseRunning )
  256. {
  257. print "RUNNING (UPDATED $LogFileTime)\n";
  258. }
  259. elsif ( $IsReleaseDone )
  260. {
  261. print "DONE AT $LogFileTime\n";
  262. }
  263. if ( $IsThereAnError )
  264. {
  265. print " $ReleaseErrFile\n";
  266. print "@ReleaseErrMsg\n";
  267. }
  268. if ( $showlogs )
  269. {
  270. print " $ReleaseLogFile\n";
  271. }
  272. print "@releaseWarning\n" if ( $showWarning );
  273. print "\n" if( $loop );
  274. }
  275. }
  276. }
  277. # Done looking at the current server
  278. }
  279. # Done looking at the build machine
  280. }
  281. }
  282. }