google / j2objc

A Java to iOS Objective-C translation tool and runtime.
http://j2objc.org
Apache License 2.0
5.99k stars 968 forks source link

Several RxJava Tests failing #685

Open ScottPierce opened 8 years ago

ScottPierce commented 8 years ago

I recently started transpiling RxJava so I thought I'd run the RxJava tests and confirm if's safe to use. I had to comment out 3 or 4 tests, because they couldn't compile due to dependencies on System.gc(), and some other stuff. After that, the tests compiled just fine. I'm seeing a lot of tests failing though which makes me question whether or not it's safe to be using this library in a transpiled state.

Modified Sources so that the tests compile: rxjava-src-1.1.0.zip Results from running the tests: rxjava-tests-result.txt

I had found a post where @tomball a few months ago said he was able to get many of the RxJava tests to pass after removing the tests that wouldn't compile (as mentioned above). Some of the tests appear to fail because they don't complete before the timeout, and some appear to fail because of unexpected results or exceptions. I'm not really sure what to do with failing tests. Is that something I can fix?

I'm wondering if:

  1. I'm compiling the sources wrong
  2. These tests were added to rxjava after @tomball had them working, or if the source was modified, causing these issues with j2objc
  3. j2objc is compiling the tests / sources incorrectly

Note: You'll notice in the test results I posted that I ran each test individually. That's because I found if I ran all the tests with a single command, I'd get a segfault error.

tomball commented 8 years ago

"... he was able to get many of the RxJava tests to pass ..."

"Many" does not equal "all" -- like your test log shows, lots of the core tests passed, enough to show that the sources and tests were translated and compiled. Some of the failing tests may indicate j2objc runtime bugs, some may indicate bad tests (since developers tend to write tests after writing code instead of first, and so platform assumptions can be baked into those tests). Some of the test failures are for tests of exception classes, but from an app's perspective the most important issue should be whether the exceptions are thrown, which they appear to be (their details just don't appear correct).

I suggest trying RxJava with your app, and write unit tests for your app's behavior. If one of those tests fail but should pass (remember, no assumption baking :-), then see if it's a JRE emulation issue. If your unit test app is an Xcode target, then debugging it will be much easier.

ScottPierce commented 8 years ago

Sorry, I wrote the issue remembering that you had gotten all of the tests to pass, and then I found your post again and went back and edited the issue changing all to many. I didn't edit all the places I should have in the post.

Some of the tests not passing were worrying me. I'll look through the tests again later today and cite a few examples.

kaylarose commented 7 years ago

@ScottPierce did you ever get a list of all the tests that were failing, and weren't able to find the cause? Also did you ever get them working in a single command?

ScottPierce commented 7 years ago

I never identified the cause. This issue in particular made further investment into j2objc a difficult sell for my team and I.