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

ant test fails for Ubuntu 14.04 #47

Open
jaimeyu opened this issue Nov 28, 2015 · 11 comments
Open

ant test fails for Ubuntu 14.04 #47

jaimeyu opened this issue Nov 28, 2015 · 11 comments
Assignees

Comments

@jaimeyu
Copy link

jaimeyu commented Nov 28, 2015

Hey, pretty stock ubuntu 14.04 VM with FRC toolchain and I'm trying to build Strongback from scratch. I get test failures (looks like junit is not in the classpath).

Raw logs at https://gist.github.com/jaimeyu/010dc9328c25e1ecb1b3
If you want the VM, let me know, I will privately share it.

(I also get the same issue when I run 'ant test' for newly made strongback.sh projects).

@rhauch
Copy link
Member

rhauch commented Dec 10, 2015

@Zabot, can you try to replicate this on Ubuntu?

@rhauch
Copy link
Member

rhauch commented Oct 28, 2016

This looks similar to the errors reported in #49; I think Travis uses Ubuntu in their images. Funny thing is that our Travis builds are working. Would appreciate anyone on Ubuntu giving this a whirl to see if they can identify the problem or a fix.

@rhauch rhauch added this to the 2.0.0 milestone Oct 28, 2016
@rhauch rhauch modified the milestones: 2017.2.0, 2017.1.0 Jan 3, 2017
@agausmann
Copy link
Member

agausmann commented Jan 17, 2017

This is definitely related to #49 and I am able to reproduce a similar problem. I get a NoClassDefFoundError when it tries to access classes from hamcrest. There must be some inconsistency in how/when dependencies are managed between systems.

Here is my output when running ant test for reference: test.txt

@WawerOS
Copy link

WawerOS commented Jan 17, 2017

I found that adding the jars in libs/test to CLASSPATH fixed the issue. I don't know how to implement it in ant though.

@agausmann
Copy link
Member

That's what I'm assuming. We can probably figure out how to do that in Ant, or have Ant download them to a designated place instead of hosting them in the repository. Alternatively, if we migrate to Maven builds ( #92 ), that will likely also fix our issue.

@rhauch
Copy link
Member

rhauch commented Jan 18, 2017

I found that adding the jars in libs/test to CLASSPATH fixed the issue. I don't know how to implement it in ant though.

The Ant build file is already doing this, or at least it is supposed to be doing this. This currently works on OS X on Ubuntu 12.04 (as evidenced by Travis-CI and, for example, this recent pull request). Note that I and Travis-CI are using Ant 1.10.0 (mostly because of recent fixes to Ant's HTTP GET utility, which we need to download 3rd party libraries).

It works this way: the Ant build file (actually build-common.xml) is defining a classpath named test.class.path at line 46 comprised of the normal compile.class.path (defined on line 37) plus the *.jar files (except *-sources.jar) files in the ${strongback.dir}/libs/test directory or subdirectories, then using this classpath when compiling the tests and running the tests.

Bottom line is that this definitely varies on different systems. @jaimeyu is running Ubuntu 14.04, but what OS are you running, @agausmann and @WawerOS? And what version of Ant are you all running? Do you each have all of the following files are in the lib/test directory?

  • fest-assert-1.4-sources.jar
  • fest-util-1.1.6-sources.jar
  • hamcrest-core-1.3-sources.jar
  • junit-4.11-sources.jar
  • metrics-core-3.1.0-sources.jar
  • fest-assert-1.4.jar
  • fest-util-1.1.6.jar
  • hamcrest-core-1.3.jar
  • junit-4.11.jar
  • metrics-core-3.1.0.jar

Are the permissions okay on that directory and the files inside?

One thing you might try if you haven't already is to run Ant with verbose mode via ant -v clean test.

@rhauch
Copy link
Member

rhauch commented Jan 18, 2017

BTW, #49 had this in the output:

Trying to override old definition of task classloader

@agausmann, you didn't include enough output to see whether you're getting the same thing. And @jaimeyu's file didn't have it either.

@agausmann
Copy link
Member

agausmann commented Jan 18, 2017

I am not getting that message in Strongback itself, but I have seen it in WPILib robot projects that are using Strongback.

Here is ant -v test output from a fresh clone: out.txt

I am running Arch Linux with ant 1.9.7, the latest release for this distro.

@rhauch
Copy link
Member

rhauch commented Jan 18, 2017

Ok, I may have found the problem but I'd like someone to try a potential fix first. Here's ine 93-96 of build-common.xml:

        <classpath refid="test.class.path" />
        <classpath> 
            <pathelement location="${project.test.output.dir}"/>
        </classpath>

Note how there are two <classpath> elements? I think these lines should be changed to:

        <classpath> 
            <path refid="test.class.path" />
            <pathelement location="${project.test.output.dir}"/>
        </classpath>

@agausmann, @WawerOS, or @jaimeyu, would one of you be willing to make this change locally and try it? If that works, can you submit a PR? It's not clear from the Ant documentation or other sites whether this is valid, so we might have to try some alternatives, like maybe inserting the following lines just before the <javac element on line 87:

      <path id="test.run.class.path">
        <path refid="test.class.path" />
        <pathelement location="${project.test.output.dir}"/>
      </path>

to define a path named test.run.class.path and then changing lines 93-96 to be:

        <classpath refid="test.run.class.path" /> 

@agausmann
Copy link
Member

agausmann commented Jan 18, 2017

Just tried, and it didn't work. Got the exact same results.

@WawerOS
Copy link

WawerOS commented Jan 19, 2017

I am running Xubuntu version 16.10 and ant version 1.10, here is the log from the ant -v test. I tried both variations of the build file and they didn't work.

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

No branches or pull requests

5 participants