unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#28250] slf4j-api: enable tests
@ 2017-08-27 11:31 Julien Lepiller
  2017-09-08 16:05 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Lepiller @ 2017-08-27 11:31 UTC (permalink / raw)
  To: 28250

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

Hi,

I found what prevented the tests to pass in slf4j-api. In
slf4j-api/pom.xml, the jar file is created with all classes, except
those in impl/.

I did the same with a new pase where I delete the impl/ directory and
regenerate the jar file. Maybe I should fix teh build.xml file instead?

Then, tests pass except for one file. This file is an abstract class
meant to be extended by other test cases, but it's not a test case in
itself, hence the failure. This time, I implemented another phase where
I fix the build.xml file to exclude this file from testing.

I'm working on other packages, and it's not the first time I see some
tests I need to disable because they shouldn't be run. Maybe I could
add arguments to the ant build system, such as #:test-include and
#:test-exclude, defaulting to '("**/*.java") and '() respectively?

Thank you :)

[-- Attachment #2: 0001-gnu-java-slf4j-api-Fix-tests.patch --]
[-- Type: text/x-patch, Size: 2169 bytes --]

From 2a9b0420c249b4b896f5980a55be8ae5595bd96b Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sun, 27 Aug 2017 13:19:31 +0200
Subject: [PATCH] gnu: java-slf4j-api: Fix tests.

* gnu/packages/java.scm (java-slf4j-api)[arguments]: Enable tests
Adjust the jar content to prevent a test failure.
---
 gnu/packages/java.scm | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index da68487b0..caa76f335 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -4170,12 +4170,26 @@ more efficient storage-wise than an uncompressed bitmap (as implemented in the
                   #t))))
     (build-system ant-build-system)
     (arguments
-     ;; FIXME: org.slf4j.NoBindingTest fails with the ominous "This code
-     ;; should have never made it into slf4j-api.jar".
-     `(#:tests? #f
-       #:jar-name "slf4j-api.jar"
+     `(#:jar-name "slf4j-api.jar"
        #:source-dir "slf4j-api/src/main"
-       #:test-dir "slf4j-api/src/test"))
+       #:test-dir "slf4j-api/src/test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'regenerate-jar
+           (lambda _
+             ;; pom.xml ignores these files in the jar creation process. If we don't,
+             ;; we get the error "This code should have never made it into slf4j-api.jar"
+             (delete-file-recursively "build/classes/org/slf4j/impl")
+             (zero? (system* "jar" "-cf" "build/jar/slf4j-api.jar" "-C"
+                             "build/classes" "."))))
+         (add-before 'check 'dont-test-abstract-classes
+           (lambda _
+             ;; abstract classes are not meant to be run with junit
+             (substitute* "build.xml"
+               (("<include name=\"\\*\\*/\\*Test.java\" />")
+                (string-append "<include name=\"**/*Test.java\" />"
+                               "<exclude name=\"**/MultithreadedInitializationTest"
+                               ".java\" />"))))))))
     (inputs
      `(("java-junit" ,java-junit)
        ("java-hamcrest-core" ,java-hamcrest-core)))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#28250] slf4j-api: enable tests
  2017-08-27 11:31 [bug#28250] slf4j-api: enable tests Julien Lepiller
@ 2017-09-08 16:05 ` Ludovic Courtès
  2017-09-08 18:42   ` bug#28250: " Julien Lepiller
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-09-08 16:05 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 28250

Julien Lepiller <julien@lepiller.eu> skribis:

>>From 2a9b0420c249b4b896f5980a55be8ae5595bd96b Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Sun, 27 Aug 2017 13:19:31 +0200
> Subject: [PATCH] gnu: java-slf4j-api: Fix tests.
>
> * gnu/packages/java.scm (java-slf4j-api)[arguments]: Enable tests
> Adjust the jar content to prevent a test failure.

I don’t fully understand what’s at play but this looks like a step in
the right direction to me, so I’d say go ahead!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#28250: slf4j-api: enable tests
  2017-09-08 16:05 ` Ludovic Courtès
@ 2017-09-08 18:42   ` Julien Lepiller
  0 siblings, 0 replies; 3+ messages in thread
From: Julien Lepiller @ 2017-09-08 18:42 UTC (permalink / raw)
  To: 28250-done

Le Fri, 08 Sep 2017 18:05:25 +0200,
ludo@gnu.org (Ludovic Courtès) a écrit :

> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> >>From 2a9b0420c249b4b896f5980a55be8ae5595bd96b Mon Sep 17 00:00:00
> >>2001  
> > From: Julien Lepiller <julien@lepiller.eu>
> > Date: Sun, 27 Aug 2017 13:19:31 +0200
> > Subject: [PATCH] gnu: java-slf4j-api: Fix tests.
> >
> > * gnu/packages/java.scm (java-slf4j-api)[arguments]: Enable tests
> > Adjust the jar content to prevent a test failure.  
> 
> I don’t fully understand what’s at play but this looks like a step in
> the right direction to me, so I’d say go ahead!
> 
> Thanks,
> Ludo’.

Actually, since there was no answer on this bug, I already pushed it a
few days ago. I forgot to close the ticket.

Pushed as dcf7a8a660554eb952e6412637e26bb523af03e8.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-08 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-27 11:31 [bug#28250] slf4j-api: enable tests Julien Lepiller
2017-09-08 16:05 ` Ludovic Courtès
2017-09-08 18:42   ` bug#28250: " Julien Lepiller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).