static void RunSwf(string path) { if (!Path.IsPathRooted(path)) { path = Path.Combine(Environment.CurrentDirectory, path); } var results = FlashPlayer.Run(path); if (results.Timeout) { Console.WriteLine("TIMEOUT!"); Environment.Exit(-1); } string output = TrimOutput(results.Output); if (XmlConsole) { Console.WriteLine(output); } else { if (string.IsNullOrEmpty(XmlPath)) { XmlPath = Path.ChangeExtension(path, ".xml"); } File.WriteAllText(XmlPath, output); Transform(XmlPath); } }
static void RunPlayer(Test test, string path_swf) { var results = FlashPlayer.Run(path_swf); test.Output = TrimOutput(results.Output); test.Success = results.Success; test.Time = results.Time / 1000.0; test.Executed = !results.NotRun; test.ExitCode = results.ExitCode; }
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); } }