Modify

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#12248 closed defect (othersoftware)

Unit test not working on openSUSE

Reported by: stoecker Owned by: team
Priority: minor Milestone:
Component: Core Version:
Keywords: junit linux opensuse Cc:

Description

Since the beginning I couldn't get the unit tests for ant working. I thought that's my old installation, but now I was forced to get a new one and it still does not work. So somehere is an issue and I fail to find the reason.

My setup:

  • openSUSE Leap 42.1
  • ant-1.9.4-8.2.noarch
  • ant-junit-1.9.4-8.3.noarch
  • junit-4.11-5.11.noarch
  • java-1_8_0-openjdk-devel-1.8.0.60-4.11.x86_64

As far as I see all the new style tests fail and the old style succeed. But the installed versions should support new style. There isn't much output telling me any reasons WHY it fails, so I'd like to hear any ideas which can help me debug this issue.

If it's an openSUSE packaging issue I can fix this for next release, but first I need to find the reason.

...
    [junit] Running org.openstreetmap.josm.data.osm.RelationTest
    [junit] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
    [junit] TEST org.openstreetmap.josm.data.osm.RelationTest FAILED
    [junit] Running org.openstreetmap.josm.data.osm.SimplePrimitiveIdTest
    [junit] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.081 sec
    [junit] Running org.openstreetmap.josm.data.osm.WaySegmentTest
    [junit] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
    [junit] TEST org.openstreetmap.josm.data.osm.WaySegmentTest FAILED
...

Attachments (0)

Change History (28)

comment:1 by bastiK, 9 years ago

The files in test/report should contain more details.

comment:2 by Don-vip, 9 years ago

what do you call "new style" vs "old style" ? Can you please share the full log + test output?

comment:3 by Don-vip, 9 years ago

You might want to update package metadata by the way:

Open Street Map editor

JOSM is an editor for OpenStreetMap (http://www.openstreetmap.org) written in Java 1.6.

in reply to:  2 comment:4 by stoecker, 9 years ago

Replying to Don-vip:

what do you call "new style" vs "old style" ? Can you please share the full log + test output?

Using @Test against the old style, where the class needed to be derived from TestCase.

You might want to update package metadata by the way:

Done :-)

comment:5 by Don-vip, 9 years ago

OK JUnit 4 style vs JUnit 3 style :) Do you have more information in test/report?

comment:6 by stoecker, 9 years ago

What's to be expected:

> more test/report/TEST-org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSParserTest.txt
Testsuite: org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSParserTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec

Testcase: warning took 0 sec
        FAILED
No tests found in org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSParserTest
junit.framework.AssertionFailedError: No tests found in org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSParserTest

Somehow I have the feeling that junit 3 code is shipped and executed even if the junit 4 stuff is installed. I will dig deeper into this when I have time - I only hoped someone says "Hey, I also had this and it is solved like ..." :-)

comment:7 by Don-vip, 9 years ago

Keywords: junit linux opensuse added

you can run ant -v test and look for junit jars in classpath...

comment:8 by Don-vip, 9 years ago

Any news?

in reply to:  8 comment:9 by stoecker, 9 years ago

Replying to Don-vip:

Any news?

Will take some time until I look into it deeper. I'm currently scripting automatic key rotation for my DNSSEC-nameserver. And then maybe get Microsoft autodiscover to work for the mail and then ... :-)

comment:10 by bastiK, 9 years ago

Resolution: needinfo
Status: newclosed

comment:11 by stoecker, 9 years ago

Resolution: needinfo
Status: closedreopened

It's more than bad style to close a ticket of the project maintainer in unsolved state with needinfo.

comment:12 by bastiK, 9 years ago

Thought you lost interest in the issue, but I apologize, this was quite rude.

in reply to:  12 comment:13 by stoecker, 9 years ago

Replying to bastiK:

Thought you lost interest in the issue, but I apologize, this was quite rude.

No. I find it very disturbing that as project maintainer I'm not able to run the tests myself. But I already spent some hours debugging it and it seems not so easy and affects all installations and different releases of openSUSE I have. I need to find more time for this issue.

comment:14 by bastiK, 9 years ago

Have you tried this?

ant -lib test/lib/junit/junit-4.12.jar test

IDEs like Eclipse or Netbeans typically have their own version of junit.jar (at least if downloaded from the website and not the repository) so this might work as temporary solution.

comment:15 by stoecker, 9 years ago

Hmm, that fails as well. Get's stranger and stranger.

comment:17 by Don-vip, 9 years ago

Can you please post the complete output of ant -v test + contents of test/report? I'm glad to help to close this ticket but I need more information :)

comment:18 by Don-vip, 9 years ago

Also, are you running tests from SVN source, or do you have openSUSE-specific patches? In that case I'd need them too.

comment:19 by stoecker, 9 years ago

Following is a workaround. Your stackoverflow link brought me to this. But it's no solution.

It seems /usr/share/java/ant/ant-junit.jar is bundled directly with JUnit 3 and only when you load /usr/share/java/ant/ant-junit4.jar explicitely, then you really get Junit4.

Index: build.xml
===================================================================
--- build.xml   (Revision 9470)
+++ build.xml   (Arbeitskopie)
@@ -379,6 +379,7 @@
                     <sysproperty key="java.awt.headless" value="true"/>
                     <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
                     <classpath>
+                        <pathelement location="/usr/share/java/ant/ant-junit4.jar"/>
                         <path refid="test.classpath"/>
                         <pathelement path="${test.dir}/build/unit"/>
                         <pathelement path="${test.dir}/build/@{testfamily}"/>

How's that on your systems? Maybe openSUSE package needs to be fixed?

comment:20 by bastiK, 9 years ago

Looks like this:

$ ll /usr/share/ant/lib/*junit*
lrwxrwxrwx 1 root root 31 Apr  8  2014 /usr/share/ant/lib/ant-junit4.jar -> ../../java/ant-junit4-1.9.3.jar
lrwxrwxrwx 1 root root 30 Apr  8  2014 /usr/share/ant/lib/ant-junit.jar -> ../../java/ant-junit-1.9.3.jar
lrwxrwxrwx 1 root root 20 Mai 18  2012 /usr/share/ant/lib/junit.jar -> ../../java/junit.jar
$ readlink /usr/share/java/junit.jar 
junit-3.8.2.jar

comment:21 by stoecker, 9 years ago

Can you also give the file sizes?

comment:22 by bastiK, 9 years ago

yes:

$ ll /usr/share/java/*junit*.jar
-rw-r--r-- 1 root root 113K Apr  8  2014 /usr/share/java/ant-junit-1.9.3.jar
-rw-r--r-- 1 root root  13K Apr  8  2014 /usr/share/java/ant-junit4-1.9.3.jar
lrwxrwxrwx 1 root root   20 Apr  8  2014 /usr/share/java/ant-junit4.jar -> ant-junit4-1.9.3.jar
lrwxrwxrwx 1 root root   19 Apr  8  2014 /usr/share/java/ant-junit.jar -> ant-junit-1.9.3.jar
-rw-r--r-- 1 root root 107K Mai 18  2012 /usr/share/java/junit-3.8.2.jar
-rw-r--r-- 1 root root 241K Mai 23  2013 /usr/share/java/junit4-4.11.jar
lrwxrwxrwx 1 root root   15 Mai 23  2013 /usr/share/java/junit4.jar -> junit4-4.11.jar
lrwxrwxrwx 1 root root   15 Mai 18  2012 /usr/share/java/junit.jar -> junit-3.8.2.jar

comment:23 by stoecker, 9 years ago

I have in /usr/share/java/

-rw-r--r-- 1 root root  13416 25. Sep 2014  ant/ant-junit4.jar
-rw-r--r-- 1 root root 118109 25. Sep 2014  ant/ant-junit.jar
lrwxrwxrwx 1 root root      9  2. Jan 19:30 junit4.jar -> junit.jar
-rw-r--r-- 1 root root 289633 15. Okt 2014  junit.jar

so there is not even a junit 3 installation (but the 100K of ant-junit seem to include a junit3 on both systems). Aaargh. Why does it work for you, but not for me?

comment:25 by stoecker, 9 years ago

Oh thanks. That's easy fixable... :-)

comment:26 by stoecker, 9 years ago

Resolution: fixed
Status: reopenedclosed

I submitted a fix for the package. Let's see when they react. It's not a good sign that the Java:Packages maintainers did not react to a bug report for a year.

comment:27 by Don-vip, 9 years ago

Resolution: fixedothersoftware

This does not concern josm ;)

comment:28 by holgermappt, 8 years ago

One year later the issue is still not fixed.

Solution for reference:
as root: echo junit4 ant/ant-junit4>/etc/ant.d/junit4

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.