Leaked source code of windows server 2003
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.

56 lines
1.4 KiB

  1. @echo off
  2. perl -Sx %0 %*
  3. goto :eof
  4. #!perl
  5. sub runTest {my($tdir, $execname, $testname, $silent) = @_;
  6. #we add one to the error count so that if the test fails to execute then it's counted as an error. The count is decremented when the test passes.
  7. $error = $error + 1;
  8. $silencer = "";
  9. if ($silent == 1) {
  10. $silencer = " > nul";
  11. }
  12. printf("Running tests in $tdir$testname.scr...\n");
  13. unlink("$testname.log");
  14. system("$execname.exe $tdir$testname.scr$silencer");
  15. open(TESTLOG, "$testname.log");
  16. while(<TESTLOG>) {
  17. if (/Variations Passed +(\d+) +(\d+)%$/) {
  18. if ($2 == 100) {
  19. printf("\nAll $1 tests passed in test script.\n");
  20. $error = $error - 1;
  21. } else {
  22. printf("Some tests failed. Please see $testname.log for details.\n");
  23. }
  24. }
  25. }
  26. close(TESTLOG);
  27. }
  28. $silent = 0;
  29. if ($ARGV[0] =~ /[-\/]q/) {$silent = 1;}
  30. open(TESTSINI, "tests.ini");
  31. $error = 0;
  32. $tdir = "";
  33. $execname = "";
  34. while(<TESTSINI>) {
  35. if (/^\[(.+)\]/) {
  36. $execname = $1;
  37. $tdir = "."
  38. } elsif (/^tdir=(.*)$/) {
  39. $tdir = $1;
  40. } else {
  41. chomp;
  42. s/#.*//;
  43. if (length($_) > 0) {
  44. runTest($tdir, $execname, $_, $silent);
  45. }
  46. }
  47. }
  48. close(TESTSINI);
  49. if ($error == 0) {
  50. printf("\nTests completed successfully.");
  51. } else {
  52. printf("\n*** Some tests failed. Do not check in. Please check log file(s) indicated above for details. ***");
  53. }