static void CreateDebugHooks(TestCase test, TestDriverSettings settings, string outpath) { if (GlobalOptions.IsNUnitSession) { return; } #if DEBUG if (DebugService.AbcDump) { Dump(outpath); } #endif if (settings.IsCancel) { return; } #if DEBUG test.AvmDump = ""; if (DebugService.AvmDump) { test.AvmDump = AvmShell.Dump(outpath); } #endif string dir = test.Root; //WriteFile(dir, "play.bat", "avmplus.exe -Dinterp -Dverbose %1"); WriteFile(dir, "run.bat", "avmplus.exe -Dinterp test.abc"); WriteFile(dir, "avmdump.bat", "avmplus.exe -Dinterp -Dverbose test.abc > avmdump.txt"); WriteFile(dir, "test.js.html", @"<!DOCTYPE html> <html> <head> <script type=""text/javascript"" src=""test.js""></script> </head> <body> </body> </html> "); }
private static void Execute(TestCase test, TestDriverSettings settings) { if (test.IsBenchmark) { if (settings.IsSWF) { var results = FlashPlayer.Run(test.OutputPath); test.Output2 = results.Output; return; } throw new NotImplementedException(); } int exitCode1 = 0; if (!test.HasOutput) { test.VM = VM.CLR; test.Output1 = CommandPromt.Run(test.ExePath, "", out exitCode1); } else { test.Output1 = test.Output; } int exitCode2; if (settings.IsClrEmulation) { try { var console = new StringWriter(); var vm = new VirtualMachine(console); exitCode2 = vm.Run(test.ExePath, "", new string[0]); test.Output2 = console.ToString(); } catch (Exception e) { exitCode2 = 0; test.Output2 = e.ToString(); } } else if (settings.IsJavaScript) { try { test.Output2 = JsRunner.Run(test.OutputPath, null, out exitCode2); } catch (Exception e) { exitCode2 = 0; test.Output2 = e.ToString(); } } else if (settings.IsABC) { var avmOpts = new AvmShell.Options(); test.Output2 = AvmShell.Run(avmOpts, out exitCode2, test.OutputPath); } else if (settings.IsSWF) { //tc.Output2 = FlashShell.Run(outpath, out exitCode2); FlashPlayer.Path = @"c:\pfx\tools\fp10.exe"; var results = FlashPlayer.Run(test.OutputPath); exitCode2 = results.ExitCode; test.Output2 = results.Output; } else { throw new NotImplementedException(); } CreateDebugHooks(test, settings, test.OutputPath); if (test.CheckExitCode) { if (exitCode2 != 0) { test.Error = string.Format("{0} returned non zero exit code {1}.", test.OutputPath, exitCode2); return; } if (exitCode1 != 0) { test.Error = string.Format("{0} returned non zero exit code {1}.", test.ExePath, exitCode1); return; } } if (test.CompareOutputs) { test.Error = CompareTools.CompareLines(test.Output1, test.Output2, true); } }