diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-02-21 15:50:21 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-02-21 15:50:21 +0100 |
commit | ba0c589263e612130ccd8ebdee4ddbbbe7f28a2e (patch) | |
tree | 60d04a917cc574fc2eed144c0572bd3e9207558e | |
parent | Fixed python Ice/acm test to wait for connection closure like other mappings ... (diff) | |
download | ice-ba0c589263e612130ccd8ebdee4ddbbbe7f28a2e.tar.bz2 ice-ba0c589263e612130ccd8ebdee4ddbbbe7f28a2e.tar.xz ice-ba0c589263e612130ccd8ebdee4ddbbbe7f28a2e.zip |
Android fixes
- Improved emulator support (no need to specify the AVD name anymore)
- Fixed adapterDeactivation test issue with Android
-rw-r--r-- | csharp/test/Ice/adapterDeactivation/ServantLocatorI.cs | 2 | ||||
-rw-r--r-- | java-compat/android/build.gradle | 3 | ||||
-rw-r--r-- | java-compat/android/gradle.properties | 5 | ||||
-rw-r--r-- | java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java | 2 | ||||
-rwxr-xr-x | java/android/build.gradle | 2 | ||||
-rw-r--r-- | java/android/controller/src/main/java/com/zeroc/testcontroller/ControllerApp.java | 4 | ||||
-rw-r--r-- | java/android/gradle.properties | 5 | ||||
-rw-r--r-- | java/android/gradle/wrapper/gradle-wrapper.properties | 5 | ||||
-rw-r--r-- | java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java | 2 | ||||
-rw-r--r-- | scripts/Util.py | 64 | ||||
-rw-r--r-- | scripts/tests/Ice/ami.py | 14 |
11 files changed, 71 insertions, 37 deletions
diff --git a/csharp/test/Ice/adapterDeactivation/ServantLocatorI.cs b/csharp/test/Ice/adapterDeactivation/ServantLocatorI.cs index fb7ebb2820d..01b9f1c227b 100644 --- a/csharp/test/Ice/adapterDeactivation/ServantLocatorI.cs +++ b/csharp/test/Ice/adapterDeactivation/ServantLocatorI.cs @@ -105,5 +105,5 @@ public sealed class ServantLocatorI : Ice.ServantLocator } private bool _deactivated; - static private RouterI _router = new RouterI(); + private RouterI _router = new RouterI(); } diff --git a/java-compat/android/build.gradle b/java-compat/android/build.gradle index d9cacc2055f..bf07f2a0237 100644 --- a/java-compat/android/build.gradle +++ b/java-compat/android/build.gradle @@ -10,9 +10,10 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' + classpath 'com.android.tools.build:gradle:3.0.1' } } diff --git a/java-compat/android/gradle.properties b/java-compat/android/gradle.properties index f8a1001c7b6..589284cd408 100644 --- a/java-compat/android/gradle.properties +++ b/java-compat/android/gradle.properties @@ -12,11 +12,6 @@ // iceVersion = 3.7.1 -// -// Prefix version -// -prefixVersion = 3.7.0 - // The Android versions used for the Ice build. ice_buildToolsVersion = 27.0.1 ice_compileSdkVersion = 21 diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java index dcd933d76fe..a519c36ccfb 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java @@ -110,5 +110,5 @@ public final class ServantLocatorI implements Ice.ServantLocator } private boolean _deactivated; - static private Ice.Object _router = new RouterI(); + private Ice.Object _router = new RouterI(); } diff --git a/java/android/build.gradle b/java/android/build.gradle index 3d388b310be..3329a7dbf90 100755 --- a/java/android/build.gradle +++ b/java/android/build.gradle @@ -13,7 +13,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' + classpath 'com.android.tools.build:gradle:3.0.1' } } diff --git a/java/android/controller/src/main/java/com/zeroc/testcontroller/ControllerApp.java b/java/android/controller/src/main/java/com/zeroc/testcontroller/ControllerApp.java index 14efc750923..9a25a47df9b 100644 --- a/java/android/controller/src/main/java/com/zeroc/testcontroller/ControllerApp.java +++ b/java/android/controller/src/main/java/com/zeroc/testcontroller/ControllerApp.java @@ -200,8 +200,8 @@ public class ControllerApp extends Application initData.properties = com.zeroc.Ice.Util.createProperties(); initData.properties.setProperty("Ice.ThreadPool.Server.SizeMax", "10"); initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp"); - initData.properties.setProperty("Ice.Trace.Network", "3"); - initData.properties.setProperty("Ice.Trace.Protocol", "1"); + //initData.properties.setProperty("Ice.Trace.Network", "3"); + //initData.properties.setProperty("Ice.Trace.Protocol", "1"); initData.properties.setProperty("ControllerAdapter.AdapterId", java.util.UUID.randomUUID().toString()); initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000"); if(!isEmulator()) diff --git a/java/android/gradle.properties b/java/android/gradle.properties index 4fc42a97087..76cfb822ecd 100644 --- a/java/android/gradle.properties +++ b/java/android/gradle.properties @@ -12,11 +12,6 @@ // iceVersion = 3.7.1 -// -// Prefix version -// -prefixVersion = 3.7.0 - // The Android versions used for the Ice build. ice_buildToolsVersion = 27.0.1 ice_compileSdkVersion = 24 diff --git a/java/android/gradle/wrapper/gradle-wrapper.properties b/java/android/gradle/wrapper/gradle-wrapper.properties index 0721020571e..731147b9379 100644 --- a/java/android/gradle/wrapper/gradle-wrapper.properties +++ b/java/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Nov 08 09:29:47 CET 2017 +distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java b/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java index 529082a7377..e448d369eed 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java @@ -102,5 +102,5 @@ public final class ServantLocatorI implements ServantLocator } private boolean _deactivated; - static private com.zeroc.Ice.Object _router = new RouterI(); + private com.zeroc.Ice.Object _router = new RouterI(); } diff --git a/scripts/Util.py b/scripts/Util.py index 92523c8e5d4..e78c3b38452 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -2163,7 +2163,6 @@ class AndroidProcessController(RemoteProcessController): RemoteProcessController.__init__(self, current, "tcp -h 127.0.0.1 -p 15001" if current.config.androidemulator else None) self.device = current.config.device self.avd = current.config.avd - self.androidemulator = current.config.androidemulator self.emulator = None # Keep a reference to the android emulator process def __str__(self): @@ -2185,13 +2184,14 @@ class AndroidProcessController(RemoteProcessController): if os.path.isfile(os.path.join(d, emu)): return os.path.join(d, emu) - def startEmulator(self, config): + def startEmulator(self, avd): # # First check if the AVD image is available # + print("starting the emulator... ") out = run("{} -list-avds".format(self.emulatorCommand())) - if config.avd not in out: - raise RuntimeError("couldn't find AVD `{}'".format(config.avd)) + if avd not in out: + raise RuntimeError("couldn't find AVD `{}'".format(avd)) # # Find and unused port to run android emulator, between 5554 and 5584 @@ -2206,13 +2206,13 @@ class AndroidProcessController(RemoteProcessController): raise RuntimeError("cannot find free port in range 5554-5584, to run android emulator") self.device = "emulator-{}".format(port) - cmd = "{0} -avd {1} -port {2} -wipe-data".format(self.emulatorCommand(), config.avd, port) + cmd = "{0} -avd {1} -port {2} -noaudio -no-window -no-snapshot".format(self.emulatorCommand(), avd, port) self.emulator = subprocess.Popen(cmd, shell=True) if self.emulator.poll(): - raise RuntimeError("failed to start Android emulator with AVD {} on port {}".format(config.avd, port)) + raise RuntimeError("failed to start the Android emulator `{}' on port {}".format(avd, port)) - self.avd = config.avd + self.avd = avd # # Wait for the device to be ready @@ -2229,13 +2229,26 @@ class AndroidProcessController(RemoteProcessController): # If the emulator doesn't complete boot in 60 seconds give up # if (time.time() - t) > 60: - raise RuntimeError("couldn't start Android emulator with avd {}".format(config.avd)) + raise RuntimeError("couldn't start the Android emulator `{}'".format(avd)) time.sleep(2) print(" ok") def startControllerApp(self, current, ident): if current.config.avd: - self.startEmulator(current.config) + self.startEmulator(current.config.avd) + elif current.config.androidemulator: + # Create Android Virtual Device + sdk = current.testcase.getMapping().getSDKPackage() + try: + run("avdmanager delete avd -n IceTests") # Delete the created device + except: + pass + run("sdkmanager \"{0}\"".format(sdk)) + run("avdmanager create avd -k \"{0}\" -d \"Nexus 6\" -n IceTests".format(sdk)) + self.startEmulator("IceTests") + elif not current.config.device: + raise RuntimeError("no Android device specified to run the controller application") + run("{} install -t -r {}".format(self.adb(), current.config.apk)) run("{} shell am start -n com.zeroc.testcontroller/.ControllerActivity".format(self.adb())) @@ -2252,14 +2265,21 @@ class AndroidProcessController(RemoteProcessController): pass try: - run("adm kill-server") + run("adb kill-server") except: pass + + if self.avd == "IceTests": + try: + run("avdmanager delete avd -n IceTests") # Delete the created device + except: + pass + # # Wait for the emulator to shutdown # if self.emulator: - sys.stdout.write("Wainting for emulator to shutdown..") + sys.stdout.write("Waiting for the emulator to shutdown..") sys.stdout.flush() while True: if self.emulator.poll() != None: @@ -3092,14 +3112,14 @@ class AndroidMapping(JavaMapping): def usage(self): print("") print("Android Mapping options:") - print("--device=<device-id> Id of the emulator or device used to run the tests.") + print("--device=<device-id> ID of the emulator or device used to run the tests.") print("--androidemulator Run tests in emulator as opposed to a real device.") - print("--avd Start emulator image") + print("--avd=<name> Start specific Android Virtual Device") def __init__(self, options=[]): Mapping.Config.__init__(self, options) - parseOptions(self, options, { "device" : "device", "avd" : "avd" }) + parseOptions(self, options) self.androidemulator = self.androidemulator or self.avd self.apk = "controller/build/outputs/apk/debug/testController-debug.apk" @@ -3115,11 +3135,17 @@ class AndroidMapping(JavaMapping): def getTestsPath(self): return os.path.join(self.path, "../test/src/main/java/test") + def getCommonTestsPath(self): + return os.path.join(self.path, "..", "..", "scripts", "tests") + def filterTestSuite(self, testId, config, filters=[], rfilters=[]): if not testId.startswith("Ice/") or testId in Android.getUnsuportedTests(config.protocol): return True return JavaMapping.filterTestSuite(self, testId, config, filters, rfilters) + def getSDKPackage(self): + return "system-images;android-25;google_apis;x86_64" + class AndroidCompatMapping(JavaCompatMapping): class Config(Mapping.Config): @@ -3139,9 +3165,9 @@ class AndroidCompatMapping(JavaCompatMapping): def __init__(self, options=[]): Mapping.Config.__init__(self, options) - parseOptions(self, options, { "device" : "device", "avd" : "avd" }) + parseOptions(self, options) self.androidemulator = self.androidemulator or self.avd - self.apk = "test/controller/build/outputs/apk/testController-debug.apk" + self.apk = "test/controller/build/outputs/apk/debug/testController-debug.apk" def getSSLProps(self, process, current): props = JavaCompatMapping.getSSLProps(self, process, current) @@ -3155,11 +3181,17 @@ class AndroidCompatMapping(JavaCompatMapping): def getTestsPath(self): return os.path.join(self.path, "../test/src/main/java/test") + def getCommonTestsPath(self): + return os.path.join(self.path, "..", "..", "scripts", "tests") + def filterTestSuite(self, testId, config, filters=[], rfilters=[]): if not testId.startswith("Ice/") or testId in Android.getUnsuportedTests(config.protocol): return True return JavaCompatMapping.filterTestSuite(self, testId, config, filters, rfilters) + def getSDKPackage(self): + return "system-images;android-21;google_apis;x86_64" + class CSharpMapping(Mapping): class Config(Mapping.Config): diff --git a/scripts/tests/Ice/ami.py b/scripts/tests/Ice/ami.py index 82ccca1a08a..c89436f0da9 100644 --- a/scripts/tests/Ice/ami.py +++ b/scripts/tests/Ice/ami.py @@ -8,4 +8,16 @@ # # ********************************************************************** -TestSuite(__name__, options = { "compress" : [False], "serialize" : [False] }) +# Enable some tracing to allow investigating test failures +traceProps = { + "Ice.Trace.Network" : 2, + "Ice.Trace.Retry" : 1, + "Ice.Trace.Protocol" : 1 +} + +TestSuite(__name__, + [ + ClientServerTestCase(traceProps=traceProps), + CollocatedTestCase() + ], + options = { "compress" : [False], "serialize" : [False] }) |