10 my $CompilerFlags = "";
20 my $TestResultsFile = "TestResults.log";
21 my $ExpectedResult="SUCCESS";
22 my @ActualResults = ();
26 my $FilePattern = "*.vb";
32 my $cmdLine = shift(@_);
34 open SAVEOUT, ">&STDOUT";
35 open SAVEERR, ">&STDERR";
40 open STDOUT, ">>$VBLogFile";
41 open STDERR, ">&STDOUT";
44 print $cmdLine . "\n";
52 open STDOUT, ">&SAVEOUT";
53 open STDERR, ">&SAVEERR";
60 my($retVal, $msg) = @_;
62 LogMessage("========================");
64 LogMessage($VBFile . ": OK");
67 LogMessage($VBFile . ": FAILED " . $msg);
81 print TEST_RESULTS_FILE $msg . "\n";
85 print "\nUsage: test-mbas.pl [options]";
86 print "\nTypical Usage: test-mbas.pl --p=Accessibility*.vb --res=test-results.log";
88 print "\n\t--help\t\tprints this help";
89 print "\n\t--verbose\tprints the results on the screen";
90 print "\n\t--compiler\tspecify mbas or vbc";
91 print "\n\t--compilerflags\tuse this to pass additional flags to the compiler";
92 print "\n\t--runtime\tspecify mono or dotnet";
93 print "\n\t--results\tname of the logfile";
94 print "\n\t--pattern\tshell pattern for test case files\n\n";
97 # Process the command line
99 $result = GetOptions( "verbose!"=>\$VerboseMode,
101 "compiler:s"=>\$Compiler,
102 "compilerflags:s"=>\$CompilerFlags,
103 "runtime:s"=>\$Runtime,
104 "results:s"=>\$TestResultsFile,
105 "pattern:s"=>\$FilePattern);
107 if(!$result || $PrintHelp) {
112 # Build the list of tests to run
114 open(TEST_RESULTS_FILE, ">$TestResultsFile");
115 while(defined ($vbFile = glob($FilePattern))) {
117 $VBLogFile = $VBFile . ".log";
119 $CompileCmd = $Compiler . " " . $CompilerFlags . " " . $VBFile;
120 $RetVal = Command($CompileCmd);
122 if($ExpectedResult eq "SUCCESS") {
124 LogResults($RetVal, "COMPILATION");
129 $VBExeFile = $VBFile;
130 $VBExeFile =~ s/\.vb$/\.exe/;
131 $RunCmd = "$Runtime ./$VBExeFile";
132 $RetVal = Command($RunCmd);
133 LogResults($RetVal, "EXECUTION");
136 LogResults($RetVal, "");
145 close TEST_RESULTS_FILE;