Search in sources :

Example 1 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class AntRunner method runTestsOnEmulator.

public String runTestsOnEmulator() {
    System.out.println("Running tests...");
    RunResult result = RunUtils.execute(generateCommandLine("test"));
    String resultOutput = result.getOutput();
    OutputUtils.checkResult(result);
    return resultOutput;
}
Also used : RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 2 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class Emulator method finishProcess.

//Only for Unix
private static void finishProcess(String processName) {
    if (SystemInfo.isUnix) {
        GeneralCommandLine pidOfProcess = new GeneralCommandLine();
        pidOfProcess.setExePath("pidof");
        pidOfProcess.addParameter(processName);
        RunResult runResult = RunUtils.execute(pidOfProcess);
        String processIdsStr = runResult.getOutput().substring(("pidof " + processName).length());
        List<String> processIds = StringUtil.getWordsIn(processIdsStr);
        for (String pid : processIds) {
            GeneralCommandLine killCommand = new GeneralCommandLine();
            killCommand.setExePath("kill");
            killCommand.addParameter("-s");
            killCommand.addParameter("9");
            killCommand.addParameter(pid);
            RunUtils.execute(killCommand);
        }
    }
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 3 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class Emulator method stopDdmsProcess.

//Only for Unix
private static void stopDdmsProcess() {
    if (SystemInfo.isUnix) {
        GeneralCommandLine listOfEmulatorProcess = new GeneralCommandLine();
        listOfEmulatorProcess.setExePath("sh");
        listOfEmulatorProcess.addParameter("-c");
        listOfEmulatorProcess.addParameter("ps aux | grep emulator");
        RunResult runResult = RunUtils.execute(listOfEmulatorProcess);
        OutputUtils.checkResult(runResult);
        String pidFromPsCommand = OutputUtils.getPidFromPsCommand(runResult.getOutput());
        if (pidFromPsCommand != null) {
            GeneralCommandLine killCommand = new GeneralCommandLine();
            killCommand.setExePath("kill");
            killCommand.addParameter(pidFromPsCommand);
            RunUtils.execute(killCommand);
        }
    }
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 4 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class Emulator method waitEmulatorStart.

public void waitEmulatorStart() {
    System.out.println("Waiting for emulator start...");
    OutputUtils.checkResult(RunUtils.execute(getWaitCommand()));
    GeneralCommandLine bootCheckCommand = createAdbCommand();
    bootCheckCommand.addParameter("shell");
    bootCheckCommand.addParameter("getprop");
    bootCheckCommand.addParameter("sys.boot_completed");
    int counter = 0;
    RunResult execute = RunUtils.execute(bootCheckCommand);
    while (counter < 12) {
        String output = execute.getOutput();
        if (output.trim().endsWith("1")) {
            System.out.println("Emulator fully booted!");
            return;
        }
        System.out.println("Waiting for emulator boot (" + counter + ")...");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        counter++;
        execute = RunUtils.execute(bootCheckCommand);
    }
    Assert.fail("Can't find booted emulator: " + execute.getOutput());
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 5 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class GradleRunner method connectedDebugAndroidTest.

public String connectedDebugAndroidTest() {
    System.out.println("Starting tests...");
    RunResult result = RunUtils.execute(generateCommandLine("connectedAndroidTest"));
    return result.getOutput();
}
Also used : RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Aggregations

RunResult (org.jetbrains.kotlin.android.tests.run.RunResult)13 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)5 Matcher (java.util.regex.Matcher)1