From 4cf7474ee63badf2d298e7b700437041c5163758 Mon Sep 17 00:00:00 2001 From: John Yani Date: Sat, 8 Dec 2012 13:16:32 +0200 Subject: [PATCH 1/7] Add Travis CI --- .travis.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..0d86b5db --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +# Copied from https://github.com/leviwilson/android-travis-ci-example +language: java +jdk: + - openjdk6 +before_install: + # download the latest android sdk and unzip + - ifconfig + - export SDK_TAR=android-sdk_r21-linux.tgz + - wget http://dl.google.com/android/$SDK_TAR + - tar -zxf $SDK_TAR + # setup your ANDROID_HOME and PATH environment variables + - export ANDROID_HOME=`pwd`/android-sdk-linux + - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools + # only update the sdk for the platform-tool + # and the api level you are building for. + # run "android list sdk --extended" to get the full list. + # android-14 = 4.0 or API level 14 + - android update sdk --filter sysimg-16,platform-tool,android-14,android-16 --obsolete --no-ui --force +install: echo "Skip install" +before_script: + - echo no | android create avd -n emulator16DE -t android-16 -c 50M --abi x86 --skin WVGA800 --force + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + - sleep 6 # give xvfb some time to start + - emulator -avd emulator16DE -prop persist.sys.language=en -prop persist.sys.country=US -noaudio -no-boot-anim & + - sleep 60 + - adb kill-server + - adb start-server + - adb devices +script: + - mvn clean install +after_script: + - adb kill-server + - killall -r emulator* From c82bdc2eff362b3113dbc098af0a120f047618bb Mon Sep 17 00:00:00 2001 From: John Yani Date: Mon, 10 Dec 2012 20:45:31 +0200 Subject: [PATCH 2/7] Android manifest: fix version, fix lint warnings --- agit-integration-tests/AndroidManifest.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agit-integration-tests/AndroidManifest.xml b/agit-integration-tests/AndroidManifest.xml index e37568d9..07ac5bc4 100644 --- a/agit-integration-tests/AndroidManifest.xml +++ b/agit-integration-tests/AndroidManifest.xml @@ -1,10 +1,11 @@ - + - + + @@ -14,5 +15,4 @@ "adb shell am instrument -w com.example.android.apis.tests/android.test.InstrumentationTestRunner" --> - - \ No newline at end of file + From 3fcae70b47d17826113cc98bad58840c53b73f8d Mon Sep 17 00:00:00 2001 From: John Yani Date: Mon, 10 Dec 2012 02:49:06 +0200 Subject: [PATCH 3/7] Add project.properties file --- agit-integration-tests/project.properties | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 agit-integration-tests/project.properties diff --git a/agit-integration-tests/project.properties b/agit-integration-tests/project.properties new file mode 100644 index 00000000..22d0dca6 --- /dev/null +++ b/agit-integration-tests/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-7 From 56ec2099452559e71276ed5317371ebfdea8436b Mon Sep 17 00:00:00 2001 From: John Yani Date: Mon, 10 Dec 2012 03:29:45 +0200 Subject: [PATCH 4/7] Assert no error --- .../com/madgag/agit/GitAsyncTaskTest.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java b/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java index 49565198..94975dc9 100644 --- a/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java +++ b/agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java @@ -66,6 +66,19 @@ import roboguice.RoboGuice; +class OperationThreadError { + private String error; + public OperationThreadError() { + error = ""; + } + public String get() { + return error; + } + public void set(String newError) { + error = newError; + } +} + public class GitAsyncTaskTest extends ActivityInstrumentationTestCase2 { private static final String TAG = "GitAsyncTaskTest"; @@ -239,7 +252,8 @@ private Repository executeAndWaitFor(final GitOperation operation) throws InterruptedException, IOException { final CountDownLatch latch = new CountDownLatch(1); Log.d(TAG, "About to start " + operation); - new Thread() { + final OperationThreadError operationThreadError = new OperationThreadError(); + Thread operationThread = new Thread() { public void run() { Looper.prepare(); Log.d(TAG, "In run method for " + operation); @@ -253,7 +267,8 @@ public void publish(Progress progress) { } public void error(OpNotification notification) { - Log.i(TAG, "Errored " + operation + " with " + notification); + operationThreadError.set("Errored " + operation + " with " + notification); + Log.i(TAG, operationThreadError.get()); } public void success(OpNotification completionNotification) { @@ -268,7 +283,8 @@ public void completed(OpNotification completionNotification) { Log.d(TAG, "Called execute() on task for " + operation); Looper.loop(); } - }.start(); + }; + operationThread.start(); long startTime = currentTimeMillis(); Log.i(TAG, "Waiting for " + operation + " to complete - currentThread=" + currentThread()); // http://stackoverflow.com/questions/5497324/why-arent-java-util-concurrent-timeunit-types-greater-than @@ -277,6 +293,7 @@ public void completed(OpNotification completionNotification) { long duration = currentTimeMillis() - startTime; Log.i(TAG, "Finished waiting - timeout=" + timeout + " duration=" + duration); assertThat("Timeout for " + operation, timeout, is(false)); + assertEquals("", operationThreadError.get()); return new FileRepository(operation.getGitDir()); } From 9f9a9005c907d7ec64a5e02a65ea41050b9d8db1 Mon Sep 17 00:00:00 2001 From: John Yani Date: Mon, 10 Dec 2012 04:12:35 +0200 Subject: [PATCH 5/7] Add toString for OpNotification --- .../agit/operations/OpNotification.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/agit/src/main/java/com/madgag/agit/operations/OpNotification.java b/agit/src/main/java/com/madgag/agit/operations/OpNotification.java index 817430a8..bdb33a96 100644 --- a/agit/src/main/java/com/madgag/agit/operations/OpNotification.java +++ b/agit/src/main/java/com/madgag/agit/operations/OpNotification.java @@ -26,16 +26,19 @@ public class OpNotification { private final CharSequence tickerText, eventTitle, eventDetail; private final boolean successful; - public OpNotification(int icon, CharSequence tickerText, CharSequence eventDetail) { + public OpNotification(int icon, CharSequence tickerText, + CharSequence eventDetail) { this(icon, tickerText, tickerText, eventDetail, true); } - public OpNotification(int icon, CharSequence tickerText, CharSequence eventTitle, CharSequence eventDetail) { + public OpNotification(int icon, CharSequence tickerText, + CharSequence eventTitle, CharSequence eventDetail) { this(icon, tickerText, eventTitle, eventDetail, true); } - public OpNotification(int icon, CharSequence tickerText, CharSequence eventTitle, CharSequence eventDetail, - boolean successful) { + public OpNotification(int icon, CharSequence tickerText, + CharSequence eventTitle, CharSequence eventDetail, + boolean successful) { this.icon = icon; this.tickerText = tickerText; this.eventTitle = eventTitle; @@ -59,12 +62,25 @@ public CharSequence getEventDetail() { return eventDetail; } - public static OpNotification alert(CharSequence eventTitle, CharSequence eventDetail) { + public String toString() { + String repr = ""; + repr += eventTitle; + repr += ", "; + repr += tickerText; + repr += ", "; + repr += eventDetail; + return repr; + } + + public static OpNotification alert(CharSequence eventTitle, + CharSequence eventDetail) { return alert(eventDetail, eventTitle, eventDetail); } - public static OpNotification alert(CharSequence tickerText, CharSequence eventTitle, CharSequence eventDetail) { - return new OpNotification(stat_sys_warning, tickerText, eventTitle, eventDetail); + public static OpNotification alert(CharSequence tickerText, + CharSequence eventTitle, CharSequence eventDetail) { + return new OpNotification(stat_sys_warning, tickerText, eventTitle, + eventDetail); } } From 752b00d82878acbb575dc6ef6718c5325ea47eb0 Mon Sep 17 00:00:00 2001 From: Vanuan Date: Mon, 10 Dec 2012 16:40:40 +0200 Subject: [PATCH 6/7] Add a comment for scala get ip script --- agit-integration-tests/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agit-integration-tests/pom.xml b/agit-integration-tests/pom.xml index 0e8d54af..0a27d0d3 100644 --- a/agit-integration-tests/pom.xml +++ b/agit-integration-tests/pom.xml @@ -111,6 +111,9 @@ val ipAddresses = java.net.NetworkInterface.getNetworkInterfaces().filter { !_.isLoopback }.flatMap { _.getInetAddresses }.map { _.getHostAddress }.mkString(",") AndroidDebugBridge.init(false) val androidDebugBridge = AndroidDebugBridge.createBridge + // skipping emulator here, + // 10.0.2.2 is used for emulator + // see agit-test-utils/src/main/java/com/madgag/agit/GitTestUtils.java androidDebugBridge.getDevices.filter { !_.isEmulator } foreach { d => val command = "echo gitserver.host.address="+ipAddresses+" > "+d.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE)+"/agit-integration-test.properties" From 3b907be121701bdbfc5611c650fcd4f317f2982b Mon Sep 17 00:00:00 2001 From: John Yani Date: Thu, 18 Apr 2013 22:21:56 +0300 Subject: [PATCH 7/7] Travis: workaround for 64 bit systems --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0d86b5db..6078f28a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,15 @@ language: java jdk: - openjdk6 before_install: + # needed to run SDK on x64 systems + - sudo apt-get update -qq + - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi # download the latest android sdk and unzip - ifconfig - export SDK_TAR=android-sdk_r21-linux.tgz - wget http://dl.google.com/android/$SDK_TAR - tar -zxf $SDK_TAR - # setup your ANDROID_HOME and PATH environment variables + # setup ANDROID_HOME and PATH environment variables - export ANDROID_HOME=`pwd`/android-sdk-linux - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools # only update the sdk for the platform-tool