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

Module collision betweeen 1.2.0 and 1.2.1 ceylon.test when running tests JVM tests from 1.2.0 #2425

Open
lukedegruchy opened this issue Nov 8, 2015 · 8 comments
Labels
Milestone

Comments

@lukedegruchy
Copy link

Running 1.2.0 unit tests with either the production 1.2.0 ceylon command or the IDE won't work if any 1.2.1 modules exist in ~/.ceylon/repo. The only way to fix this is to remove all 1.2.1 modules from ~/.ceylon/repo. The only way to fix is to remove all 1.2.1 modules from ~/.ceylon/repo.

This affects both the IDE and the command-line.

I've run ceylon test --verbose=cmr under both cases but unfortunately this offers very little additional insight. For some reason, ceylon attempts to do this, with very little context:

Debug:  Trying repository ~/.ceylon/repo 
Debug:   -> Found at /com/redhat/ceylon/testjvm/1.2.1/com.redhat.ceylon.testjvm-1.2.1.car 

This is the unit test:

import ceylon.test {
    test,
    assertTrue
}

test
void testMe() { assertTrue(true); }

This is the error I see when running the unit test from the IDE:

ceylon.language.Exception "function luke.testMe::testMe should be annotated with test or testSuite"
    at ceylon.test.core.findCandidatesInFunction_.findCandidatesInFunction(DefaultTestRunner.ceylon:215)
    at ceylon.test.core.findCandidatesInFunction_.findCandidatesInFunction(DefaultTestRunner.ceylon:213)
    at ceylon.test.core.findCandidatesInFunctionLiteral_.findCandidatesInFunctionLiteral(DefaultTestRunner.ceylon:313)
    at ceylon.test.core.findCandidatesInTypeLiteral_.findCandidatesInTypeLiteral(DefaultTestRunner.ceylon:246)
    at ceylon.test.core.findCandidates_.findCandidates(DefaultTestRunner.ceylon:184)
    at ceylon.test.core.createExecutors_.createExecutors(DefaultTestRunner.ceylon:85)
    at ceylon.test.core.DefaultTestRunner.initExecutors$priv$(DefaultTestRunner.ceylon:43)
    at ceylon.test.core.DefaultTestRunner.<init>(DefaultTestRunner.ceylon:46)
    at ceylon.test.createTestRunner_.createTestRunner(TestRunner.ceylon:49)
    at ceylon.test.createTestRunner_.createTestRunner(TestRunner.ceylon:48)
    at com.redhat.ceylon.testjvm.Runner.run(tool.ceylon:84)
    at com.redhat.ceylon.testjvm.run_.run(tool.ceylon:36)
    at com.redhat.ceylon.testjvm.run_.main(tool.ceylon)
    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:483)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:75)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:122)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    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:483)
    at org.jboss.modules.Module.run(Module.java:312)
    at org.jboss.modules.Main.main(Main.java:460)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:244)
    at ceylon.modules.bootstrap.CeylonTestTool.run(CeylonTestTool.java:174)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:491)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:380)
    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:483)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:114)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:41)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:34)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:27)

This doesn't seem to be the case for other modules, as I was able to run a ceylon function having imported both ceylon.collection and ceylon.html and both were correctly resolved to 1.2.0 and the function ran both in the command line and IDE.

@lukedegruchy
Copy link
Author

As @jvasileff observed, it seems a lot of modules in 1.2.1 fully or partially identify themselves as "1.2.0" which may be the root cause of this issue.

@jvasileff
Copy link
Member

After deleting repo and rebuilding the latest from github, I have:

$ find ~/.ceylon/repo/ -name 1.2.0
/Users/jvasileff/.ceylon/repo//ceylon/bootstrap/1.2.0
/Users/jvasileff/.ceylon/repo//ceylon/language/1.2.0
/Users/jvasileff/.ceylon/repo//ceylon/runtime/1.2.0
/Users/jvasileff/.ceylon/repo//com/redhat/ceylon/common/1.2.0
/Users/jvasileff/.ceylon/repo//com/redhat/ceylon/compiler/java/1.2.0
/Users/jvasileff/.ceylon/repo//com/redhat/ceylon/compiler/js/1.2.0
/Users/jvasileff/.ceylon/repo//com/redhat/ceylon/model/1.2.0
/Users/jvasileff/.ceylon/repo//com/redhat/ceylon/module-resolver/1.2.0
/Users/jvasileff/.ceylon/repo//com/redhat/ceylon/typechecker/1.2.0

Edit: the commands used for this build were:

pushd ceylon-dist && ant clean-all dist sdk eclipse && popd &&
pushd ceylon.language && ant doc && popd &&
true

@lukedegruchy
Copy link
Author

Confirmed @jvasileff's observations.

@lukedegruchy
Copy link
Author

So I guess the solution to this bug is to ensure the above modules are built as 1.2.1 instead of 1.2.0?

@gavinking
Copy link
Member

@lukedegruchy @jvasileff try now.

@jvasileff
Copy link
Member

I'm getting the same error reported by @lukedegruchy on gitter:

eclipse-quick:

build:
  [mvn:mvn] [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
  [mvn:mvn] [main] INFO org.eclipse.tycho.core.resolver.DefaultTychoResolver - Computing target platform for MavenProject: com.redhat.ceylon.eclipse:com.redhat.ceylon.eclipse.ui.jdt.debug.fragment:1.2.1-SNAPSHOT @ /Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui.jdt.debug.fragment/pom.xml
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository file:../ceylon-dist/osgi/build/dist
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository file:../ceylon-sdk/osgi/dist
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository file:../ceylon.formatter/osgi/dist
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository file:../ceylon.tool.converter.java2ceylon/osgi/dist
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository file:../ceylon-ide-common/osgi/dist
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Fetching p2.index from http://download.eclipse.org/releases/kepler/ (0B at 0B/s)
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository http://download.eclipse.org/releases/kepler
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Fetching p2.index from http://download.eclipse.org/releases/kepler/201402280900/ (0B at 0B/s)
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Fetching p2.index from http://download.eclipse.org/releases/kepler/201309270900/ (0B at 0B/s)
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Fetching p2.index from http://download.eclipse.org/releases/kepler/201306260900/ (0B at 0B/s)
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Fetching p2.index from http://download.eclipse.org/technology/epp/packages/kepler/ (0B at 0B/s)
  [mvn:mvn] [main] INFO org.eclipse.tycho.osgi.configuration.MavenContextConfigurator - Adding repository http://download.eclipse.org/technology/swtbot/releases/latest
  [mvn:mvn] [main] INFO org.eclipse.tycho.core.resolver.DefaultTychoResolver - Resolving dependencies of MavenProject: com.redhat.ceylon.eclipse:com.redhat.ceylon.eclipse.ui.jdt.debug.fragment:1.2.1-SNAPSHOT @ /Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui.jdt.debug.fragment/pom.xml
  [mvn:mvn] [main] INFO org.eclipse.tycho.core.resolver.DefaultTychoResolver - Resolving class path of MavenProject: com.redhat.ceylon.eclipse:com.redhat.ceylon.eclipse.ui.jdt.debug.fragment:1.2.1-SNAPSHOT @ /Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui.jdt.debug.fragment/pom.xml
  [mvn:mvn] [main] INFO org.eclipse.tycho.core.resolver.DefaultTychoResolver - Computing target platform for MavenProject: com.redhat.ceylon.eclipse:com.redhat.ceylon.eclipse.ui:1.2.1-SNAPSHOT @ /Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui/pom.xml
  [mvn:mvn] [main] INFO org.eclipse.tycho.core.resolver.DefaultTychoResolver - Resolving dependencies of MavenProject: com.redhat.ceylon.eclipse:com.redhat.ceylon.eclipse.ui:1.2.1-SNAPSHOT @ /Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui/pom.xml
  [mvn:mvn] [main] INFO org.eclipse.tycho.p2.resolver.P2DependencyResolver - {osgi.os=macosx, osgi.ws=cocoa, org.eclipse.update.install.features=true, osgi.arch=x86_64}
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver - Cannot resolve project dependencies:
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver -   Software being installed: com.redhat.ceylon.eclipse.ui 1.2.1.qualifier
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver -   Missing requirement: ceylon.collection 1.2.1.v20151108-2233 requires 'bundle com.redhat.ceylon.dist 1.2.1' but it could not be found
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver -   Cannot satisfy dependency: ceylon.interop.java 1.2.1.v20151108-2233 depends on: bundle ceylon.collection 1.2.1
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver -   Cannot satisfy dependency: ceylon.tool.converter.java2ceylon 1.2.1.v20151108-2234 depends on: bundle ceylon.interop.java 1.2.1
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver -   Cannot satisfy dependency: com.redhat.ceylon.eclipse.ui 1.2.1.qualifier depends on: bundle ceylon.tool.converter.java2ceylon 1.2.1
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver - 
  [mvn:mvn] [main] ERROR org.eclipse.tycho.p2.resolver.P2DependencyResolver - See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - Cannot resolve dependencies of MavenProject: com.redhat.ceylon.eclipse:com.redhat.ceylon.eclipse.ui:1.2.1-SNAPSHOT @ /Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui/pom.xml: See log for details -> [Help 1]
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - 
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - 
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
  [mvn:mvn] [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException

BUILD FAILED
/Users/jvasileff/Dropbox/Repos/ceylon/ceylon-dist/build.xml:1081: The following error occurred while executing this line:
/Users/jvasileff/Dropbox/Repos/ceylon/ceylon-dist/ide-build.xml:58: The following error occurred while executing this line:
/Users/jvasileff/Dropbox/Repos/ceylon/ceylon-ide-eclipse/build.xml:25: Java returned: 1

@lukedegruchy
Copy link
Author

As I post this, at some point during the dist compilation process, running tests on the production command-line results in this error. I get the exact same error running tests in the IDE. Once again, deleting ~/.ceylon/repo fixes the issue.

$ ceylon test  luke.testMe/1.0.0
Exception in thread "main" ceylon.language.AssertionError "Assertion failed
    violated is CeylonModuleLoader loader = ceylonModuleLoader"
    at com.redhat.ceylon.testjvm.Runner.loadModule$priv$(tool.ceylon:129)
    at com.redhat.ceylon.testjvm.Runner.loadModules$priv$(tool.ceylon:124)
    at com.redhat.ceylon.testjvm.Runner.run(tool.ceylon:53)
    at com.redhat.ceylon.testjvm.run_.run(tool.ceylon:36)
    at com.redhat.ceylon.testjvm.run_.main(tool.ceylon)
    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:497)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:75)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:122)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    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:497)
    at org.jboss.modules.Module.run(Module.java:312)
    at org.jboss.modules.Main.main(Main.java:460)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:244)
    at ceylon.modules.bootstrap.CeylonTestTool.run(CeylonTestTool.java:174)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:491)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:380)
    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:497)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:114)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:41)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:34)
    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:497)
    at com.redhat.ceylon.launcher.Bootstrap.run(Bootstrap.java:55)
    at com.redhat.ceylon.launcher.Bootstrap.main(Bootstrap.java:32)

This time I even get issues running JS tests as well. In the command-line I get an error. In the IDE the test takes forever to complete eventually resulting in an error. Again, this is with the production 1.2.0 tools.

Command-line error:

$ ceylon test-js  luke.testMe/1.0.0
NODE_PATH=/usr/local/Cellar/ceylon/1.2.0/libexec/repo:${ECLIPSE_WORKSPACE}/CrossPlatformWithTests/modules:/Users/luke/.ceylon/repo:/Users/luke/.ceylon/cache:[Maven] Aether:${ECLIPSE_WORKSPACE}/CrossPlatformWithTests/modules
~/.ceylon/repo/com/redhat/ceylon/testjs/1.2.1/com.redhat.ceylon.testjs-1.2.1.js:180
m$1.asrt$((m$1.nn$(($4ys=m$1.modules$meta().find($4yr.$_get(0),$4yr.$_get(1))))),"Assertion failed: \'exists m = modules.find(moduleNameAndVersion[0], moduleNameAndVersion[1])\' at tool.ceylon (99:19-99:93)",'99:12-99:94','tool.ceylon');
                                                      ^

TypeError: $4yr.$_get is not a function
    at run (~/.ceylon/repo/com/redhat/ceylon/testjs/1.2.1/com.redhat.ceylon.testjs-1.2.1.js:180:55)
    at [eval]:1:336
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:435:26)
    at node.js:576:27
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)
ceylon test-js: Node process exited with non-zero exit code: 1

IDE error:

NODE_PATH=${ECLIPSE_PATH}/Eclipse.app/Contents/Eclipse/plugins/com.redhat.ceylon.dist.repo_1.2.0.v20151028-2216/repo:${ECLIPSE_WORKSPACE}//CrossPlatformWithTests/modules:/Users/luke/.ceylon/repo:/Users/luke/.ceylon/cache:[Maven] Aether:${ECLIPSE_WORKSPACE}/CrossPlatformWithTests/modules

<--- Last few GCs --->

   37404 ms: Scavenge 1395.3 (1457.2) -> 1395.3 (1457.2) MB, 1.2 / 0 ms (+ 1.9 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
   38767 ms: Mark-sweep 1395.3 (1457.2) -> 1395.3 (1457.2) MB, 1362.9 / 0 ms (+ 2.2 ms in 2 steps since start of marking, biggest step 1.9 ms) [last resort gc].
   40251 ms: Mark-sweep 1395.3 (1457.2) -> 1395.3 (1457.2) MB, 1484.2 / 0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1863bc637399 <JS Object>
    1: findCandidatesInPackage$core(aka findCandidatesInPackage$core) [/Users/luke/.ceylon/repo/ceylon/test/1.2.1/ceylon.test-1.2.1.js:~1057] [pc=0x2f103193b8fa] (this=0x1863bc604131 <undefined>,$3dn=0x33093dbb58a9 <JS Object>,$3do=0x33093dbb5941 <JS Object>)
    2: findCandidatesInModule$core(aka findCandidatesInModule$core) [/Users/luke/.ceylon/repo/ceylon/test/1.2.1/ceylon.test-1.2.1.js:1054...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
ceylon test-js: Node process exited with non-zero exit code: 134

@gavinking
Copy link
Member

Is it fixed now, guys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants