Added x86 abi to android tests

This commit is contained in:
Michael Bogdanov
2016-04-22 16:17:22 +03:00
parent fbbb614e80
commit e9a2b8628c
3 changed files with 31 additions and 10 deletions
@@ -175,7 +175,7 @@ public class CodegenTestsOnAndroidRunner {
} }
SDKDownloader downloader = new SDKDownloader(pathManager); SDKDownloader downloader = new SDKDownloader(pathManager);
Emulator emulator = new Emulator(pathManager); Emulator emulator = new Emulator(pathManager, Emulator.X86);
AntRunner antRunner = new AntRunner(pathManager); AntRunner antRunner = new AntRunner(pathManager);
downloader.downloadAll(); downloader.downloadAll();
downloader.unzipAll(); downloader.unzipAll();
@@ -29,7 +29,8 @@ import java.util.zip.ZipInputStream;
public class SDKDownloader { public class SDKDownloader {
private final String platformZipPath; private final String platformZipPath;
private final String systemImages; private final String armImage;
private final String x86Image;
private final String platformToolsZipPath; private final String platformToolsZipPath;
private final String skdToolsZipPath; private final String skdToolsZipPath;
private final String buildToolsZipPath; private final String buildToolsZipPath;
@@ -45,7 +46,8 @@ public class SDKDownloader {
public SDKDownloader(PathManager pathManager) { public SDKDownloader(PathManager pathManager) {
this.pathManager = pathManager; this.pathManager = pathManager;
platformZipPath = pathManager.getRootForDownload() + "/platforms.zip"; platformZipPath = pathManager.getRootForDownload() + "/platforms.zip";
systemImages = pathManager.getRootForDownload() + "/system-images.zip"; armImage = pathManager.getRootForDownload() + "/arm-image.zip";
x86Image = pathManager.getRootForDownload() + "/x86-image.zip";
platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools.zip"; platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools.zip";
skdToolsZipPath = pathManager.getRootForDownload() + "/tools.zip"; skdToolsZipPath = pathManager.getRootForDownload() + "/tools.zip";
buildToolsZipPath = pathManager.getRootForDownload() + "/build-tools.zip"; buildToolsZipPath = pathManager.getRootForDownload() + "/build-tools.zip";
@@ -56,7 +58,8 @@ public class SDKDownloader {
} }
private void downloadAbi() { private void downloadAbi() {
download("http://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-" + ANDROID_VERSION + "_r04.zip", systemImages); //Same for all platforms download("http://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-" + ANDROID_VERSION + "_r04.zip", armImage); //Same for all platforms
download("https://dl.google.com/android/repository/sys-img/android/sysimg_x86-" + ANDROID_VERSION + "_r02.zip", x86Image); //Same for all platforms
} }
public void downloadPlatformTools() { public void downloadPlatformTools() {
@@ -100,9 +103,12 @@ public class SDKDownloader {
public void unzipAll() { public void unzipAll() {
String androidSdkRoot = pathManager.getAndroidSdkRoot(); String androidSdkRoot = pathManager.getAndroidSdkRoot();
unzip(platformZipPath, pathManager.getPlatformFolderInAndroidSdk()); unzip(platformZipPath, pathManager.getPlatformFolderInAndroidSdk());
unzip(systemImages, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/"); unzip(armImage, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/");
unzip(x86Image, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/");
unzip(platformToolsZipPath, androidSdkRoot); unzip(platformToolsZipPath, androidSdkRoot);
unzip(skdToolsZipPath, androidSdkRoot); unzip(skdToolsZipPath, androidSdkRoot);
//BUILD TOOLS
String buildTools = androidSdkRoot + "/build-tools/"; String buildTools = androidSdkRoot + "/build-tools/";
String buildToolsFolder = buildTools + BUILD_TOOLS + "/"; String buildToolsFolder = buildTools + BUILD_TOOLS + "/";
new File(buildToolsFolder).delete(); new File(buildToolsFolder).delete();
@@ -115,6 +121,8 @@ public class SDKDownloader {
delete(platformToolsZipPath); delete(platformToolsZipPath);
delete(skdToolsZipPath); delete(skdToolsZipPath);
delete(buildToolsZipPath); delete(buildToolsZipPath);
delete(armImage);
delete(x86Image);
} }
private static void download(String urlString, String output) { private static void download(String urlString, String output) {
@@ -31,12 +31,17 @@ import java.util.regex.Pattern;
public class Emulator { public class Emulator {
public static final String ARM = "arm";
public static final String X86 = "x86";
private final static Pattern EMULATOR_PATTERN = Pattern.compile("emulator-([0-9])*"); private final static Pattern EMULATOR_PATTERN = Pattern.compile("emulator-([0-9])*");
private final PathManager pathManager; private final PathManager pathManager;
private String platform;
public Emulator(PathManager pathManager) { public Emulator(PathManager pathManager, String platform) {
this.pathManager = pathManager; this.pathManager = pathManager;
this.platform = platform;
} }
private GeneralCommandLine getCreateCommand() { private GeneralCommandLine getCreateCommand() {
@@ -52,9 +57,16 @@ public class Emulator {
commandLine.addParameter(pathManager.getAndroidEmulatorRoot()); commandLine.addParameter(pathManager.getAndroidEmulatorRoot());
commandLine.addParameter("-t"); commandLine.addParameter("-t");
commandLine.addParameter("1"); commandLine.addParameter("1");
commandLine.addParameter("-b");
commandLine.addParameter(getEmulatorAbi());
return commandLine; return commandLine;
} }
private String getEmulatorAbi(){
return platform == X86 ? "x86" : "armeabi-v7a";
}
private GeneralCommandLine getStartCommand() { private GeneralCommandLine getStartCommand() {
GeneralCommandLine commandLine = new GeneralCommandLine(); GeneralCommandLine commandLine = new GeneralCommandLine();
String emulatorCmdName = SystemInfo.isWindows ? "emulator.exe" : "emulator"; String emulatorCmdName = SystemInfo.isWindows ? "emulator.exe" : "emulator";
@@ -83,13 +95,13 @@ public class Emulator {
} }
@Nullable @Nullable
private static GeneralCommandLine getStopCommand() { private GeneralCommandLine getStopCommand() {
if (SystemInfo.isWindows) { if (SystemInfo.isWindows) {
GeneralCommandLine commandLine = new GeneralCommandLine(); GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath("taskkill"); commandLine.setExePath("taskkill");
commandLine.addParameter("/F"); commandLine.addParameter("/F");
commandLine.addParameter("/IM"); commandLine.addParameter("/IM");
commandLine.addParameter("emulator-arm.exe"); commandLine.addParameter("emulator-" + platform + ".exe");
return commandLine; return commandLine;
} }
return null; return null;
@@ -137,7 +149,8 @@ public class Emulator {
if (SystemInfo.isWindows) { if (SystemInfo.isWindows) {
OutputUtils.checkResult(RunUtils.execute(getStopCommand())); OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
} }
finishProcess("emulator-arm"); finishProcess("emulator64-" + platform);
finishProcess("emulator-" + platform);
} }
//Only for Unix //Only for Unix
@@ -207,7 +220,7 @@ public class Emulator {
} }
else { else {
if (!isDdmsStopped && SystemInfo.isUnix) { if (!isDdmsStopped && SystemInfo.isUnix) {
finishProcess("emulator-arm"); stopEmulator();
stopDdmsProcess(); stopDdmsProcess();
isDdmsStopped = true; isDdmsStopped = true;
} }