Re: JavaHL jar file containing class files for unit tests

Branko Čibej <[email protected]> Wed, 29 Jul 2026 12:52:53 +0200
Newsgroups gmane.comp.version-control.subversion.devel
Organization The Apache Software Foundation
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------26jsWzspPwANVohH8oLQbFgV
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 29. 7. 2026 10:58, Daniel Sahlberg wrote:
>
>
> Den ons 29 juli 2026 kl 04:32 skrev Jun Omae <[email protected]>:
>
>     On 2026/07/28 23:58, Daniel Sahlberg wrote:
>     > Den mån 27 juli 2026 kl 00:09 skrev Jun Omae <[email protected]
>     <mailto:[email protected]>>:
>     >
>     >     > Is there a problem if we include the test classes?
>     >
>     >     No direct issues have been found so far. However, static
>     initializers within test classes are executed simply by loading
>     the class.
>     >
>     >     [[[
>     >     $ grep -r 'static *{' subversion/bindings/javahl
>     >
>      subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java:
>        static {
>     >
>      subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java:
>        static {
>     >     ]]]
>     >
>     >
>     > Thank you!
>     >
>     > I think I got it working on 1.14.x, successfully created a JAR
>     file without the tests.
>     >
>     > It still seems to fail on trunk. Can you do the same steps above
>     on trunk?
>     >
>     > Cheers,
>     > Daniel
>     >
>
>     Hm, I get the same failures on trunk.
>     It seems that the changes of the behavior is introduced in r1933892.
>     At least, ./configure should stop and/or warn it if the junit is
>     NOT optional when javahl enabled.
>
>     [[[
>     $ /bin/sh autogen.sh
>     $ ./configure --prefix=/dev/shm/svn/trunk --without-apxs
>     --without-swig --without-swig-{perl,python,ruby} --enable-javahl
>     --with-jdk=/usr/lib/jvm/java-11-openjdk-amd64 --without-junit
>     PYTHON=/usr/bin/python3
>     $ make -j$(nproc) all
>     $ make javahl
>
>     $ find subversion/bindings/javahl -name '*.class' | wc -l
>     277
>     $ find subversion/bindings/javahl -name '*Test*.class' | wc -l
>     0    #==> tests/**/*.java are compiled yet.
>
>     $ make install
>     $ make install-javahl    # Why this task builds tests/**/*.java?
>     ...
>     /dev/shm/subversion-trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java:1708:
>     error: cannot find symbol
>             assertEquals("wrong revision from commit",
>             ^
>       symbol:   method assertEquals(String,long,int)
>       location: class BasicTests
>     /dev/shm/subversion-trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java:1756:
>     error: cannot find symbol
>             assertEquals("wrong revision from update",
>             ^
>       symbol:   method assertEquals(String,long,int)
>       location: class BasicTests
>     Note: Some input files use or override a deprecated API.
>     Note: Recompile with -Xlint:deprecation for details.
>     100 errors
>     ]]]
>
>
> Thanks for confirming! It seems like 1.15.x is also affected by this 
> (I'll bring it up on the release thread).
>
> To add three more data points to the discussion, I checked Fedora 43, 
> 44 and FreeBSD 14. The tests are present in Fedora's svn-javahl.jar 
> but not in FreeBSD's svn-javahl.jar. Obviously different distributors 
> use different options when building. That is unfortunate since we are 
> distributing different ABIs.
>
> I think it would be cleaner to have the tests in svn-javahl-tests.jar 
> if built. Maybe we want to install this alongside svn-javahl.jar. That 
> way Fedora and Ubuntu can keep distributing the tests and FreeBSD not, 
> while everyone's svn-javahl.jar is the same.
>
> Does that make sense?


The following makes sense:

1. There is no regression in autotools. It is what it is. Note that 
putting test classes in a separate jar has wider consequences than just 
the ABI. For example, JavaHL tests would fail in autotools builds. We'd 
have to change the way the classpath is constructed in `make 
check-*-javahl`.

2. No change is needed in 1.15.x. Autotools are consistent with earlier 
releases and CMake doesn't build JavaHL. IFF we want to change this in 
CMake for 1.15, then we have further questions to consider:

    2.1. CMake and Autotools/vcxproj should produce identical results
    given identical options. In this case specifically I mean that the
    CMake build should create the same lib/dll names and the same JavaHL
    jar (singular) as the vcxproj generator.


3. Regardless of the answer to 2: If we decide to not include test 
classes in svn-javhl.jar, then we have to consider how to mitigate the 
ABI change.

Personally I'd prefer changing the build requirements to changing the 
ABI in svn-javahl.jar. That means that --enable-javahl implies that 
JUnit is mandatory.

-- Brane

--------------26jsWzspPwANVohH8oLQbFgV
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 29. 7. 2026 10:58, Daniel Sahlberg
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMHy98Nxhf0K=ghWSApO_ArC8t5Znucgcow8JEugK0FNHcuT_g@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr"><br>
        </div>
        <br>
        <div class="gmail_quote gmail_quote_container">
          <div dir="ltr" class="gmail_attr">Den ons 29 juli 2026 kl
            04:32 skrev Jun Omae &lt;<a href="mailto:[email protected]"
              moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>&gt;:<br>
          </div>
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On
            2026/07/28 23:58, Daniel Sahlberg wrote:<br>
            &gt; Den mån 27 juli 2026 kl 00:09 skrev Jun Omae &lt;<a
              href="mailto:[email protected]" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>
            &lt;mailto:<a href="mailto:[email protected]"
              target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">[email protected]</a>&gt;&gt;:<br>
            &gt; <br>
            &gt;     &gt; Is there a problem if we include the test
            classes?<br>
            &gt; <br>
            &gt;     No direct issues have been found so far. However,
            static initializers within test classes are executed simply
            by loading the class.<br>
            &gt; <br>
            &gt;     [[[<br>
            &gt;     $ grep -r 'static *{' subversion/bindings/javahl<br>
            &gt;   
 subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java:
               static {<br>
            &gt;   
 subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java:
               static {<br>
            &gt;     ]]]<br>
            &gt; <br>
            &gt; <br>
            &gt; Thank you!<br>
            &gt; <br>
            &gt; I think I got it working on 1.14.x, successfully
            created a JAR file without the tests.<br>
            &gt; <br>
            &gt; It still seems to fail on trunk. Can you do the same
            steps above on trunk?<br>
            &gt; <br>
            &gt; Cheers,<br>
            &gt; Daniel<br>
            &gt; <br>
            <br>
            Hm, I get the same failures on trunk.<br>
            It seems that the changes of the behavior is introduced in
            r1933892.<br>
            At least, ./configure should stop and/or warn it if the
            junit is NOT optional when javahl enabled.<br>
            <br>
            [[[<br>
            $ /bin/sh autogen.sh<br>
            $ ./configure --prefix=/dev/shm/svn/trunk --without-apxs
            --without-swig --without-swig-{perl,python,ruby}
            --enable-javahl
            --with-jdk=/usr/lib/jvm/java-11-openjdk-amd64
            --without-junit PYTHON=/usr/bin/python3<br>
            $ make -j$(nproc) all<br>
            $ make javahl<br>
            <br>
            $ find subversion/bindings/javahl -name '*.class' | wc -l<br>
            277<br>
            $ find subversion/bindings/javahl -name '*Test*.class' | wc
            -l<br>
            0    #==&gt; tests/**/*.java are compiled yet.<br>
            <br>
            $ make install<br>
            $ make install-javahl    # Why this task builds
            tests/**/*.java?<br>
            ...<br>
/dev/shm/subversion-trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java:1708:
            error: cannot find symbol<br>
                    assertEquals("wrong revision from commit",<br>
                    ^<br>
              symbol:   method assertEquals(String,long,int)<br>
              location: class BasicTests<br>
/dev/shm/subversion-trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java:1756:
            error: cannot find symbol<br>
                    assertEquals("wrong revision from update",<br>
                    ^<br>
              symbol:   method assertEquals(String,long,int)<br>
              location: class BasicTests<br>
            Note: Some input files use or override a deprecated API.<br>
            Note: Recompile with -Xlint:deprecation for details.<br>
            100 errors<br>
            ]]]<br>
          </blockquote>
          <div><br>
          </div>
          <div>Thanks for confirming! It seems like 1.15.x is also
            affected by this (I'll bring it up on the release thread).</div>
          <div><br>
          </div>
          <div>
            <div>To add three more data points to the discussion, I
              checked Fedora 43, 44 and FreeBSD 14. The tests are
              present in Fedora's svn-javahl.jar but not in FreeBSD's
              svn-javahl.jar. Obviously different distributors use
              different options when building. That is unfortunate since
              we are distributing different ABIs.</div>
            <div><br>
            </div>
            <div><span style="background-color:transparent">I think it
                would be cleaner to have the tests in
                svn-javahl-tests.jar if built. Maybe we want to install
                this alongside svn-javahl.jar. That way Fedora and
                Ubuntu can keep distributing the tests and FreeBSD not,
                while everyone's svn-javahl.jar is the same.</span></div>
            <div><span style="background-color:transparent"><br>
              </span></div>
            <div><span style="background-color:transparent">Does that
                make sense?</span></div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    The following makes sense:<br>
    <br>
    1. There is no regression in autotools. It is what it is. Note that
    putting test classes in a separate jar has wider consequences than
    just the ABI. For example, JavaHL tests would fail in autotools
    builds. We'd have to change the way the classpath is constructed in
    `make check-*-javahl`.<br>
    <br>
    2. No change is needed in 1.15.x. Autotools are consistent with
    earlier releases and CMake doesn't build JavaHL. IFF we want to
    change this in CMake for 1.15, then we have further questions to
    consider:<br>
    <br>
    <blockquote>2.1. CMake and Autotools/vcxproj should produce
      identical results given identical options. In this case
      specifically I mean that the CMake build should create the same
      lib/dll names and the same JavaHL jar (singular) as the vcxproj
      generator.<br>
    </blockquote>
    <br>
    3. Regardless of the answer to 2: If we decide to not include test
    classes in svn-javhl.jar, then we have to consider how to mitigate
    the ABI change.<br>
    <br>
    Personally I'd prefer changing the build requirements to changing
    the ABI in svn-javahl.jar. That means that --enable-javahl implies
    that JUnit is mandatory.<br>
    <br>
    -- Brane<br>
    <br>
  </body>
</html>

--------------26jsWzspPwANVohH8oLQbFgV--