Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public override bool Execute()
Log.LogMessage(MessageImportance.Low, $" {nameof (ProcessId)}: {ProcessId}");

using (var p = Process.GetProcessById (ProcessId)) {
p.Kill ();
if (!p.HasExited)
p.Kill ();
}

return !Log.HasLoggedErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class StartAndroidEmulator : Task
public string Arguments {get; set;}
public string ToolPath {get; set;}
public string ToolExe {get; set;}
public string LogcatFile {get; set;}

public override bool Execute ()
{
Expand Down Expand Up @@ -68,7 +69,7 @@ void Run (string emulator)
return;

var port = string.IsNullOrEmpty (Port) ? "" : $" -port {Port}";
var arguments = $"{Arguments ?? string.Empty} -verbose -no-boot-anim -no-audio -no-snapshot -cache-size 512 -timezone \"Etc/UTC\" -avd {ImageName}{port}";
var arguments = $"{Arguments ?? string.Empty} -verbose -logcat-output \"{LogcatFile}\" -no-boot-anim -no-audio -no-snapshot -cache-size 512 -timezone \"Etc/UTC\" -avd {ImageName}{port}";
Log.LogMessage (MessageImportance.Low, $"Tool {emulator} execution started with arguments: {arguments}");
var psi = new ProcessStartInfo () {
FileName = emulator,
Expand Down
2 changes: 2 additions & 0 deletions build-tools/scripts/TestApks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<AvdLaunchTimeoutMinutes Condition=" '$(AvdLaunchTimeoutMinutes)' == '' ">5</AvdLaunchTimeoutMinutes>
<AvdLaunchTimeoutSeconds>$([MSBuild]::Multiply($(AvdLaunchTimeoutMinutes), 60))</AvdLaunchTimeoutSeconds>
<AvdLaunchTimeoutMS>$([MSBuild]::Multiply($(AvdLaunchTimeoutSeconds), 1000))</AvdLaunchTimeoutMS>
<_LogcatFilename>$(MSBuildThisFileDirectory)..\..\bin\Test$(Configuration)\logcat-$(Configuration)-full.log</_LogcatFilename>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -68,6 +69,7 @@
AvdManagerHome="$(AvdManagerHome)"
Arguments="$(TestEmulatorArguments)"
ImageName="$(TestAvdName)"
LogcatFile="$(_LogcatFilename)"
Port="$(_AdbEmulatorPort)"
ToolExe="$(EmulatorToolExe)"
ToolPath="$(EmulatorToolPath)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static void RestartDevice (string project)
TestContext.Out.WriteLine ($"Trying to restart Emulator");
// shell out to msbuild and start the emulator again
using (var builder = new Builder ()) {
var out1 = RunProcessWithExitCode (builder.BuildTool, $"{project} /restore /t:AcquireAndroidTarget", timeoutInSeconds: 120);
var out1 = RunProcessWithExitCode (builder.BuildTool, $"{(Builder.UseDotNet ? "build" : "")} {project} /restore /t:AcquireAndroidTarget", timeoutInSeconds: 120);
TestContext.Out.WriteLine ($"{out1}");
}
}
Expand Down