internal async Task <ExternalProcess> LaunchApplication(string options, CancellationToken cancellationToken) { ExternalProcess logcatProcess = null; if (Options.SaveLogCat != null) { await ClearLogCat(cancellationToken).ConfigureAwait(false); var output = new StreamWriter(Options.SaveLogCat); logcatProcess = await StartLogCat(output, cancellationToken); } var args = new StringBuilder(); args.Append(AdbCommandLine("shell am start -W -S")); args.Append($" -e XAMARIN_ASYNCTESTS_OPTIONS \"'{options}'\" "); var activity = Program.Options.AndroidActivity ?? "com.xamarin.webtests.android/com.xamarin.webtests.android.MainActivity"; args.Append(activity); Program.Debug("Launching apk: {0}", args); var process = await ProcessHelper.StartCommand(Adb, args.ToString(), cancellationToken).ConfigureAwait(false); if (logcatProcess != null) { process.ExitedEvent += (sender, e) => logcatProcess.Dispose(); } return(process); }
internal async Task <ExternalProcess> LaunchApplication(string options, CancellationToken cancellationToken) { ExternalProcess logcatProcess = null; if (Options.SaveLogCat != null) { await ClearLogCat(cancellationToken).ConfigureAwait(false); var output = new StreamWriter(Options.SaveLogCat); logcatProcess = await StartLogCat(output, cancellationToken); } var args = new StringBuilder(); args.Append("shell am start "); args.Append("-W -S "); args.AppendFormat(" -e XAMARIN_ASYNCTESTS_OPTIONS \\'{0}\\' ", options); args.Append(Program.Options.Application); Program.Debug("Launching apk: {0}", args); var process = await ProcessHelper.StartCommand(Adb, args.ToString(), cancellationToken).ConfigureAwait(false); if (logcatProcess != null) { process.ExitedEvent += (sender, e) => logcatProcess.Dispose(); } return(process); }
public override Task <ExternalProcess> LaunchApplication(string options, CancellationToken cancellationToken) { Program.Debug("Launching app: {0}", Program.Options.Application); var psi = new ProcessStartInfo("/usr/bin/open"); psi.UseShellExecute = false; psi.RedirectStandardInput = true; psi.Arguments = "-F -W -n " + Program.Options.Application; psi.EnvironmentVariables.Add("XAMARIN_ASYNCTESTS_OPTIONS", options); return(ProcessHelper.StartCommand(psi, cancellationToken)); }
public override Task <ExternalProcess> LaunchApplication(string options, CancellationToken cancellationToken) { var args = new StringBuilder(); switch (Options.Command) { case Command.Device: args.AppendFormat(" --launchdev={0}", Options.Application); break; case Command.Simulator: args.AppendFormat(" --launchsim={0}", Options.Application); break; case Command.TVOS: args.AppendFormat(" --launchsim={0}", Options.Application); break; default: throw new NotSupportedException(); } args.AppendFormat(" --setenv=\"XAMARIN_ASYNCTESTS_OPTIONS={0}\"", options); if (!string.IsNullOrWhiteSpace(Options.StdOut)) { args.AppendFormat(" --stdout={0}", Options.StdOut); } if (!string.IsNullOrWhiteSpace(Options.StdErr)) { args.AppendFormat(" --stderr={0}", Options.StdErr); } args.AppendFormat(" --sdkroot={0}", Options.SdkRoot); args.AppendFormat(" --device={0}", DeviceName); if (Options.ExtraLauncherArgs != null) { args.Append(" "); args.Append(Options.ExtraLauncherArgs); } return(ProcessHelper.StartCommand(MLaunch, args.ToString(), cancellationToken)); }
internal Task <ExternalProcess> StartLogCat(StreamWriter output, CancellationToken cancellationToken) { var args = AdbCommandLine("logcat"); return(ProcessHelper.StartCommand(Adb, args, output, cancellationToken)); }
internal Task <ExternalProcess> StartLogCat(StreamWriter output, CancellationToken cancellationToken) { return(ProcessHelper.StartCommand(Adb, "logcat", output, cancellationToken)); }