Android tests: finish all processes
This commit is contained in:
+20
-14
@@ -190,23 +190,29 @@ public class CodegenTestsOnAndroidRunner {
|
||||
|
||||
antRunner.packLibraries();
|
||||
|
||||
emulator.createEmulator();
|
||||
emulator.startEmulator();
|
||||
try {
|
||||
emulator.waitEmulatorStart();
|
||||
antRunner.cleanOutput();
|
||||
antRunner.compileSources();
|
||||
antRunner.installApplicationOnEmulator();
|
||||
return antRunner.runTestsOnEmulator();
|
||||
emulator.createEmulator();
|
||||
emulator.startEmulator();
|
||||
|
||||
try {
|
||||
emulator.waitEmulatorStart();
|
||||
antRunner.cleanOutput();
|
||||
antRunner.compileSources();
|
||||
antRunner.installApplicationOnEmulator();
|
||||
return antRunner.runTestsOnEmulator();
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
emulator.stopEmulator();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
System.err.println("Exception during stopping emulator:");
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
emulator.stopEmulator();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
System.err.println("Exception during stopping emulator:");
|
||||
t.printStackTrace();
|
||||
}
|
||||
emulator.finishEmulatorProcesses();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ public class Emulator {
|
||||
|
||||
public void startEmulator() {
|
||||
System.out.println("Starting emulator...");
|
||||
stopRedundantEmulators(pathManager);
|
||||
OutputUtils.checkResult(RunUtils.executeOnSeparateThread(getStartCommand(), false));
|
||||
}
|
||||
|
||||
@@ -123,12 +122,8 @@ public class Emulator {
|
||||
public void stopEmulator() {
|
||||
System.out.println("Stopping emulator...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
|
||||
System.out.println("Stopping adb...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommandForAdb()));
|
||||
if (SystemInfo.isUnix) {
|
||||
finishProcess("emulator-arm");
|
||||
finishProcess("adb");
|
||||
stopDdmsProcess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +144,15 @@ public class Emulator {
|
||||
}
|
||||
}
|
||||
|
||||
public void finishEmulatorProcesses() {
|
||||
System.out.println("Stopping adb...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommandForAdb()));
|
||||
if (SystemInfo.isUnix) {
|
||||
finishProcess("adb");
|
||||
stopDdmsProcess();
|
||||
}
|
||||
}
|
||||
|
||||
//Only for Unix
|
||||
private void finishProcess(String processName) {
|
||||
GeneralCommandLine pidOfProcess = new GeneralCommandLine();
|
||||
|
||||
@@ -70,7 +70,7 @@ public class RunUtils {
|
||||
|
||||
if (waitForEnd) {
|
||||
try {
|
||||
t.wait(300000);
|
||||
t.wait(600000);
|
||||
return resultRef.get();
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
|
||||
Reference in New Issue
Block a user