Unable to run Robolectric 3.2 under Windows #2814

Closed
Teka101 opened this Issue Jan 5, 2017 · 23 comments

Projects

None yet

5 participants

@Teka101
Teka101 commented Jan 5, 2017 edited

My tests stop working with Robolectric 3.2 and with Gradle 2.1.3 / 2.2.0 / 2.2.3

Internal Error occured.
java.lang.IllegalArgumentException: failed to configure myapp.MainActivityTest.testMe: Unexpected internal error near index 1
\
 ^
	at org.robolectric.RobolectricTestRunner.getChildren(RobolectricTestRunner.java:230)
	at org.junit.runners.ParentRunner.getFilteredChildren(ParentRunner.java:426)
	at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:351)
	at com.intellij.junit4.JUnit4IdeaTestRunner.getDescription(JUnit4IdeaTestRunner.java:123)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:99)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
	at java.util.regex.Pattern.error(Pattern.java:1955)
	at java.util.regex.Pattern.compile(Pattern.java:1702)
	at java.util.regex.Pattern.<init>(Pattern.java:1351)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at java.lang.String.split(String.java:2380)
	at java.lang.String.split(String.java:2422)
	at org.robolectric.res.FileFsFile.from(FileFsFile.java:177)
	at org.robolectric.internal.GradleManifestFactory.identify(GradleManifestFactory.java:34)
	at org.robolectric.RobolectricTestRunner.getAppManifest(RobolectricTestRunner.java:398)
	at org.robolectric.RobolectricTestRunner.getChildren(RobolectricTestRunner.java:217)
	... 12 more

The bug is in "FileFsFile" with try to split with "" (Windows path separator) but without escape "" character...

@Kisty
Kisty commented Jan 5, 2017 edited

Ah that's what's happening. @xian, does the code use File.separator to reference the file separator in the regex?

@Kisty
Kisty commented Jan 5, 2017

Ah, yes it does, ignore that comment. I'll see if I can fix it.

@Teka101
Teka101 commented Jan 5, 2017

Thanks 👍

@Kisty
Kisty commented Jan 5, 2017

I've tried to build the project in Windows but I can't. The install-dependencies.rb script assumes we're in Unix-land and failing. Installing Windows 10 Linux subsystem instead but may take some time to rebuild. I think I can see what to do and going to try and make some test cases for it.

@ravpacheco

I have the same problem!

@xian xian added this to the 3.2.1 milestone Jan 5, 2017
@xian xian added the defect label Jan 5, 2017
@SUPERCILEX

Same here!

@xian
Member
xian commented Jan 6, 2017 edited

Anyone with a Windows box want to help me test a fix?

@SUPERCILEX

@xian, sure but the jitpack builds keep failing and 3.2.1-SNAPSHOT doesn't exist yet on sonatype so could you provide an aar?

@xian xian closed this in #2821 Jan 6, 2017
@xian xian reopened this Jan 6, 2017
@xian
Member
xian commented Jan 6, 2017

@SUPERCILEX I'll get snapshotting fixed, hang tight :-)

@SUPERCILEX
SUPERCILEX commented Jan 6, 2017 edited

@xian Just ping me when you have it ready! 😄

@xian
Member
xian commented Jan 6, 2017
@SUPERCILEX

@xian it works! When can we expect 3.2.1 to come out?

image

@xian
Member
xian commented Jan 6, 2017

@SUPERCILEX awesome! There are a couple other small fixes I'm gonna pull in and I'll push 3.2.1 out tomorrow. Thanks for your help!

@xian xian closed this Jan 6, 2017
@SUPERCILEX

@xian awesome!

@Kisty
Kisty commented Jan 6, 2017

After doing a clean build and pointing to robolectric and robolectric-shadows-support-v4 3.2.1-SNAPSHOT, I get the same error, unfortunately.

@xian
Member
xian commented Jan 6, 2017

@kisty same stack trace?

@Kisty
Kisty commented Jan 6, 2017

@xian yup

@xian
Member
xian commented Jan 6, 2017

Identical line numbers and everything? Sounds like you're not actually getting the SNAPSHOT build somehow... FileFsFile.from() calls String.split() at line 184 now...?

@Kisty
Kisty commented Jan 6, 2017

Hmm, am still getting call to split at line 177. Trying build with gradlew --refresh-dependencies now.

java.lang.IllegalArgumentException: failed to configure uk.co.imagitech.learn2.hp.AppHazardQuestionEntryTest.canBeParcelled: Unexpected internal error near index 1
\
 ^
	at org.robolectric.RobolectricTestRunner.getChildren(RobolectricTestRunner.java:230)
	at org.junit.runners.ParentRunner.getFilteredChildren(ParentRunner.java:426)
	at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:351)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:359)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
	at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
	at java.util.regex.Pattern.error(Pattern.java:1955)
	at java.util.regex.Pattern.compile(Pattern.java:1702)
	at java.util.regex.Pattern.<init>(Pattern.java:1351)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at java.lang.String.split(String.java:2380)
	at java.lang.String.split(String.java:2422)
	at org.robolectric.res.FileFsFile.from(FileFsFile.java:177)
	at org.robolectric.internal.GradleManifestFactory.identify(GradleManifestFactory.java:34)
	at org.robolectric.RobolectricTestRunner.getAppManifest(RobolectricTestRunner.java:398)
	at org.robolectric.RobolectricTestRunner.getChildren(RobolectricTestRunner.java:217)
	... 29 more
@Kisty
Kisty commented Jan 6, 2017 edited

Ah, wait. I think it's getting the snapshot I compiled when I was trying to build Robolectric locally so deleted the local snapshot versions and it's all good now.

Yup, no exception thrown now 👍. Still have workaround for #2692. Thought the Matrix fix in 3.2 was related but apparently not. Thanks, @xian!

@xian
Member
xian commented Jan 6, 2017

@Kisty awesome! #2692 is closed -- is it still broken?

@Kisty
Kisty commented Jan 6, 2017

I think so. #2692 was dupe as was #1932 and merged into #2566.

@xian
Member
xian commented Jan 6, 2017

Ah gotcha, yep that's on our backlog. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment