Skip to content
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

AllTests.java causes all tests to run twice #319

Closed
drywolf opened this issue Jul 27, 2017 · 7 comments
Closed

AllTests.java causes all tests to run twice #319

drywolf opened this issue Jul 27, 2017 · 7 comments

Comments

@drywolf
Copy link
Contributor

drywolf commented Jul 27, 2017

For an upcoming PR of mine I have been writing / rewriting some unit tests, it was then that I realized that just invoking the usual mvn test command runs all J2V8 unit-test twice.
This is happening because AllTests.java does declare a test suite that contains all of the remaining unit tests in the J2V8 code.

This does fully double the time it takes to run the J2V8 unit tests, so if it could have taken 5 minutes it does now always take 10 minutes. I'm feeling this a lot, since for the PR that I am working on I have to sometimes repeatedly run the entire J2V8 build and tests for
all the platforms, all the architectures, all the virtual build environments that I can run on my environment, which are currently about 8 runs of the unit tests if I don't explicitely exclude them for a particular run.

@irbull My question here is, if this is absolutely necessary and done by design or if (as I understand) it just tries to make sure that the V8RuntimeNotLoadedTest is run before any other test in the package. (at least this is what the code comment tells)

// V8RuntimeNotLoadedTest must be run first. This is because we need to test when the natives are not loaded
// and once the V8 class is loaded we cannot unload it.

Because then I think it would just be enough to include only the V8RuntimeNotLoadedTest in the suite and just make sure that the suite runs before any of the other tests (which it seems to reliably do).

@irbull Please let me know what your take is on this ... I would include potential changes to the code to improve this in my upcoming PR then. Thanks 😉

@drywolf drywolf changed the title AllTests.java causes tests to run twice AllTests.java causes all tests to run twice Jul 27, 2017
@irbull
Copy link
Member

irbull commented Jul 27, 2017 via email

@drywolf
Copy link
Contributor Author

drywolf commented Jul 27, 2017

Thanks for the quick reply.
I will look into a solution that can satisfy both needs then and make sure the tests are not run twice needlessly.

On a related note ... the V8RuntimeNotLoadedTest is one of two unit-tests that always fail on Android.
The reason is that URLClassLoader.getSystemClassLoader() on Android does not return a URLClassLoader instance, but a dalvik.system.PathClassLoader instance. Then because this assumption in the test is not valid on Android the test always exits with a ClassCastException.

I was unable to come up with a working alternative implementation of the class-loading part on Android. As a workaround I would instead add some code to skip this test on Android for now if this is ok to you @irbull ?

@irbull
Copy link
Member

irbull commented Jul 27, 2017

Yep, sounds good. Any tests on Android are better than what we have now. V8RuntimeNotLoaded is not really great test anyways. If things are not loaded, we'll know pretty quickly.

@drywolf
Copy link
Contributor Author

drywolf commented Jul 27, 2017

I just downloaded Eclipse Oxygen (4.7.0), and with the code in AllTests.java commented out I was still able to run all unit tests fine ... right-click on src/test/java > Run As > JUnit Test ... same number of tests run and same results, just like when I invoke them from the command line via mvn test

@irbull Is there some alternative integration or additional feature in Eclipse that you are using that still
would require the AllTests.java ?

because I use AllTests in the Eclipse IDE to run all the tests.

@irbull
Copy link
Member

irbull commented Jul 28, 2017

No, I don't think so. I just deleted the AllTests.java and did what you said, and it seems to run fine too (I'm trying to track down some threading issues, so some tests failed, but I don't think that has anything to do with removing AllTests.java). I'm fine with just removing it.

@drywolf
Copy link
Contributor Author

drywolf commented Jul 28, 2017

Ok, I think if we want to keep running V8RuntimeNotLoaded before any other test, this approach is still valid but then it should only include this single test. If it does not make a difference whatsoever, then I will remove it with the PR.

I'm trying to track down some threading issues, so some tests failed

On a related note, I am now investigating the failing Android tests and I just realized that some of the tests are crashing the Android Activity that is used to run the junit tests in the Android emulator. As a result the entire test run was aborted early and did just run a small percentage of the tests up to this point.

The problem seems to happen in tests that are throwing java exceptions for the most part (those result in a crash in the native code)

Also some of the threading / locker tests seem to result in deadlocks and hit the test timeout limit (10 minutes).

I will post some updates about those failed tests a little bit later, right now I'm more focused on getting the last features that I have on my roadmap into a suitable form for the PR.

@irbull
Copy link
Member

irbull commented Jan 11, 2019

All tests has been removed. Closing.

@irbull irbull closed this as completed Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants