-
Notifications
You must be signed in to change notification settings - Fork 7.6k
1.x: Run tests on Android! #3519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.x: Run tests on Android! #3519
Conversation
classpath 'com.android.tools.build:gradle:1.3.1' | ||
|
||
// Resolves android-sdk dependencies | ||
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed. .travis.yml
takes care of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for developers, I guess @akarnokd used it without noticing :)
On Fri, Nov 13, 2015, 07:47 Jake Wharton [email protected] wrote:
In android-tests/build.gradle
#3519 (comment):@@ -0,0 +1,61 @@
+buildscript {
- repositories {
jcenter()
- }
- dependencies {
// Android Gradle plugin
classpath 'com.android.tools.build:gradle:1.3.1'
// Resolves android-sdk dependencies
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
Not needed. .travis.yml takes care of this.
—
Reply to this email directly or view it on GitHub
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749555.
@artem_zin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm amazed it even still works.
On Thu, Nov 12, 2015 at 11:51 PM Artem Zinnatullin [email protected]
wrote:
In android-tests/build.gradle
#3519 (comment):@@ -0,0 +1,61 @@
+buildscript {
- repositories {
jcenter()
- }
- dependencies {
// Android Gradle plugin
classpath 'com.android.tools.build:gradle:1.3.1'
// Resolves android-sdk dependencies
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
It's for developers, I guess @akarnokd https://github.com/akarnokd used
it without noticing :)
On Fri, Nov 13, 2015, 07:47 Jake Wharton [email protected]
wrote: In android-tests/build.gradle <#3519 (comment)
https://github.com/ReactiveX/RxJava/pull/3519#discussion_r44749555>: >
@@ -0,0 +1,61 @@ > +buildscript { > + repositories { > + jcenter() > + } >
- dependencies { > + // Android Gradle plugin > + classpath
'com.android.tools.build:gradle:1.3.1' > + > + // Resolves android-sdk
dependencies > + classpath
'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' Not needed. .travis.yml
takes care of this. — Reply to this email directly or view it on GitHub <
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749555>.
-- @artem_zin—
Reply to this email directly or view it on GitHub
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749702.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, would be nice to see new releases! Sometimes it can not handle
support libraries updates. But anyway, great tool.
On Fri, Nov 13, 2015, 07:52 Jake Wharton [email protected] wrote:
In android-tests/build.gradle
#3519 (comment):@@ -0,0 +1,61 @@
+buildscript {
- repositories {
jcenter()
- }
- dependencies {
// Android Gradle plugin
classpath 'com.android.tools.build:gradle:1.3.1'
// Resolves android-sdk dependencies
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
I'm amazed it even still works.
… <#msg-f:1517698800156585010_>
On Thu, Nov 12, 2015 at 11:51 PM Artem Zinnatullin <
[email protected]> wrote: In android-tests/build.gradle <#3519
(comment)
https://github.com/ReactiveX/RxJava/pull/3519#discussion_r44749702>: >
@@ -0,0 +1,61 @@ > +buildscript { > + repositories { > + jcenter() > + } >
- dependencies { > + // Android Gradle plugin > + classpath
'com.android.tools.build:gradle:1.3.1' > + > + // Resolves android-sdk
dependencies > + classpath
'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' It's for developers, I
guess @akarnokd https://github.com/akarnokd https://github.com/akarnokd
used it without noticing :) On Fri, Nov 13, 2015, 07:47 Jake Wharton <
[email protected]> wrote: In android-tests/build.gradle <1.x: Run tests on Android! #3519
1.x: Run tests on Android! #3519 (comment) <1.x: Run tests on Android! #3519 (comment)
https://github.com/ReactiveX/RxJava/pull/3519#discussion_r44749555>>: >
@@ -0,0 +1,61 @@ > +buildscript { > + repositories { > + jcenter() > + } >
- dependencies { > + // Android Gradle plugin > + classpath
'com.android.tools.build:gradle:1.3.1' > + > + // Resolves android-sdk
dependencies > + classpath
'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' Not needed. .travis.yml
takes care of this. — Reply to this email directly or view it on GitHub <
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749555>. --
@artem_zin — Reply to this email directly or view it on GitHub <
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749702>.—
Reply to this email directly or view it on GitHub
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749727.
@artem_zin
Can we do this without moving any files? |
Not sure, unfortunately. Though I'll try it today, if somebody already done this — please comment. |
93e9322
to
f7a1c58
Compare
@akarnokd done! |
f7a1c58
to
2cb70dc
Compare
2cb70dc
to
8fdaf38
Compare
subject.subscribe(); | ||
subject.materialize().toBlocking().first(); | ||
|
||
Thread.sleep(1000); // the uncaught exception comes after the terminal event reaches toBlocking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails for some reason. Maybe the underlying thread dies off?
Could you change the code above to use a ThreadFactory
with newSingleThreadExecutor
and set the uncaught exception handler within the factory?
Generally, I'm not against testing on Android but I'm afraid it will hinder progress on RxJava due to platform nuances. I remember when RxJava had every other Rx language and tool under the same main project and a change for Java caused build failures because something didn't compile in RxScala or some test failed in RxClojure. Would it be possible to have this as a separate project where Gradle/travis checks out the RxJava code from github and runs the tests on the emulator? |
Android is just another Runtime, see it as different JVM (though it's not J-VM, but it does not matter in this case). Scala, Clojure, etc run on the JVM too, so your example is not directly applicable to the intention of running tests on Android. Your example is more about RxAndroid and I agree that it should be separate project and it is in . Thousands of Android apps use RxJava, millions of Android devices run RxJava code every minute. And RxJava has some Platform-dependent code. Would be great to check that it works as expected 😄
It's possible, but it will be very hard since it requires changes of the tests (timeouts, etc). Also, it won't give immediate feedback to PRs in the RxJava. I'm sorry for the delay with this PR, I'm very busy this week, will try to finish it soon. |
With appropriate privileging, a secondary RxJava test runner outside of this repo could still post status checks to PRs -- it probably couldn't easily use Travis, but a custom runner on Jenkins would have enough flexibility to do that. Concerns about changes to tests would still remain. |
I'd still prefer to run tests on Android as part of current RxJava CI, actually there're just few tests fail with timeouts because Android emulator is slow as hell, we can write custom test runner or JUnit rule and add Please feel free (anyone) to work on this, hopefully I'll do it at some point, but I don't have much time right now. |
I'm still not in favor of running the tests for Android in the same CI process. The alternative I see is to somehow package up the unit tests as well and have a separate project run it it, or if a gradle script could be written to checkout the RxJava sources and run the tests in that way. |
Let's close it for now, I have a task to run RxJava tests on Android as part of CI of RxJavaProGuardRules project. Hope I'll find some time to work on it in the summer. |
Closes #3503.
In short:
rxjava
gradle module and movedsrc
torxjava/src
.android-tests
module and configured it to run tests fromrxjava/src/test
on Android.MemoryMXBean
toRuntime
inExecutorSchedulerTest
becauseMemoryMXBean
is not presented on Android.TODO:
@JakeWharton PTAL