Re: JavaHL jar file containing class files for unit tests

Daniel Sahlberg <[email protected]> Tue, 28 Jul 2026 16:58:38 +0200
Newsgroups gmane.comp.version-control.subversion.devel
Message-ID <CAMHy98OV1b4xEGLDTvPXu7uH1r6cJ2+53pBubaVhwf4+W86c6w@mail.gmail.com>
--000000000000ae0dad0657ad1339
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Den m=C3=A5n 27 juli 2026 kl 00:09 skrev Jun Omae <[email protected]>:

>
>
> On Mon, Jul 27, 2026 at 12:30=E2=80=AFAM Daniel Sahlberg <
> [email protected]> wrote:
>
>> Den s=C3=B6n 26 juli 2026 kl 12:06 skrev Jun Omae <[email protected]>:
>>
>>> On Sun, Jul 26, 2026 at 6:39=E2=80=AFPM Branko =C4=8Cibej <brane@apache=
.org> wrote:
>>> >
>>> > On 26. 7. 2026 11:24, Jun Omae wrote:
>>> >
>>> > Hi,
>>> >
>>> > I noticed that svn-javahl.jar file has class files for unit tests
>>> while working for support build JavaHL with cmake.
>>> > I don't think it's necessary for the jar file for distribution.... is
>>> that intentional?
>>> >
>>> >
>>> >
>>> > I noticed this myself the last time I looked at JavaHL. I'm not sure
>>> how this came about in the first place, but by now it's intentional bec=
ause
>>> it's always been this way. Maybe it's to allow users who only use binar=
ies
>>> to run JavaHL tests. In any case this is part of the published ABI.
>>>
>>>
>>> In JavaDoc for JavaHL, test classes are not described.
>>> See https://subversion.apache.org/docs/javahl/1.14/
>>>
>>>
>>> > In JavaHL build with cmake, the class files for unit tests are
>>> archived into svn-javahl-tests.jar, and only svn-javahl.jar is installe=
d.
>>> >
>>> >
>>> > The CMake build must create a JAR that is identical to what the
>>> autotools produce.
>>>
>>>
>>> JUnit jar is not required for build with autoconf. Without JUnit jar,
>>> the svn-javahl.jar doesn't have test classes.
>>>
>>
>> How did you configure your build?
>>
>> If I configure with --with-junit=3D/path/to/junit-4.13.2.jar, I can run =
`make
>> install-javahl` successfully.
>>
>> However if I configure without --with-junit (and run make clean!), I get
>> error messages whenever I run `make install-javahl`:
>> [[[
>> /home/dsg/ramdisk/svn_trunk/subversion/bindings/javahl/tests/org/apache/=
subversion/javahl/BasicTests.java:1446:
>> error: cannot find symbol
>>         assertEquals(expected, actual);
>>         ^
>>   symbol:   method assertEquals(String,String)
>>   location: class BasicTests
>> ]]]
>>
>> What I'd like to confirm is if we can create a JAR without the test
>> classes.
>>
>> @Jun Omae <[email protected]> Is there a problem if we include the test
>> classes?
>>
>> Cheers,
>> Daniel
>>
>>
>
> [[[
> $ svn co -q https://svn.apache.org/repos/asf/subversion/branches/1.14.x
> ./subversion-1.14.x
> $ svn cleanup --remove-{unversioned,ignored}
> $ cd ./subversion-1.14.x$ /bin/sh autogen.sh
> $ ./configure --prefix=3D/dev/shm/svn-javahl --without-apxs --without-swi=
g \
> >   --enable-javahl --with-jdk=3D/usr/lib/jvm/java-11-openjdk-amd64 \
> >   --without-junit PYTHON=3D/usr/bin/python3
> $ make -j$(nproc) all
> $ make javahl
> $ make install
> $ make install-javahl
> $ unzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F
> .class | wc -l
> 276
> $ unzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F
> Test | wc -l
> 0
> ]]]
>
> > 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.j=
ava:
>    static {
> subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.j=
ava:
>    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

--000000000000ae0dad0657ad1339
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><span style=3D"backgroun=
d-color:transparent">Den m=C3=A5n 27 juli 2026 kl 00:09 skrev Jun Omae &lt;=
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a=
>&gt;:</span></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><div style=3D"font-f=
amily:&quot;courier new&quot;,monospace"><br></div></div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Jul 27, 2026 at =
12:30=E2=80=AFAM Daniel Sahlberg &lt;<a href=3D"mailto:daniel.l.sahlberg@gm=
ail.com" target=3D"_blank">[email protected]</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div=
 dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><span style=3D"background-co=
lor:transparent">Den s=C3=B6n 26 juli 2026 kl 12:06 skrev Jun Omae &lt;<a h=
ref=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt=
;:</span></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote"=
 style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);p=
adding-left:1ex">On Sun, Jul 26, 2026 at 6:39=E2=80=AFPM Branko =C4=8Cibej =
&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]<=
/a>&gt; wrote:<br>
&gt;<br>
&gt; On 26. 7. 2026 11:24, Jun Omae wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I noticed that svn-javahl.jar file has class files for unit tests whil=
e working for support build JavaHL with cmake.<br>
&gt; I don&#39;t think it&#39;s necessary for the jar file for distribution=
.... is that intentional?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I noticed this myself the last time I looked at JavaHL. I&#39;m not su=
re how this came about in the first place, but by now it&#39;s intentional =
because it&#39;s always been this way. Maybe it&#39;s to allow users who on=
ly use binaries to run JavaHL tests. In any case this is part of the publis=
hed ABI.<br>
<br>
<br>
In JavaDoc for JavaHL, test classes are not described.<br>
See <a href=3D"https://subversion.apache.org/docs/javahl/1.14/" rel=3D"nore=
ferrer" target=3D"_blank">https://subversion.apache.org/docs/javahl/1.14/</=
a><br>
<br>
<br>
&gt; In JavaHL build with cmake, the class files for unit tests are archive=
d into svn-javahl-tests.jar, and only svn-javahl.jar is installed.<br>
&gt;<br>
&gt;<br>
&gt; The CMake build must create a JAR that is identical to what the autoto=
ols produce.<br>
<br>
<br>
JUnit jar is not required for build with autoconf. Without JUnit jar,<br>
the svn-javahl.jar doesn&#39;t have test classes.<br></blockquote><div><br>=
</div><div>How did you configure your build?</div><div><br></div><div><div>=
<span style=3D"background-color:transparent">I</span><span style=3D"backgro=
und-color:transparent">f I configure with --with-junit=3D/path/to/junit-4.1=
3.2.jar, I can run=C2=A0</span><span style=3D"background-color:transparent"=
>`make install-javahl`</span><span style=3D"background-color:transparent">=
=C2=A0successfully.</span></div><br></div><div>However if I configure witho=
ut --with-junit (and run make clean!), I get error messages w<span style=3D=
"background-color:transparent">henever I run `make install-javahl`:</span><=
/div><div>[[[</div>/home/dsg/ramdisk/svn_trunk/subversion/bindings/javahl/t=
ests/org/apache/subversion/javahl/BasicTests.java:1446: error: cannot find =
symbol<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 assertEquals(expected, actual);<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br>=C2=A0 symbol: =C2=A0 method assertEquals(=
String,String)<br><div><span style=3D"background-color:transparent">=C2=A0 =
location: class BasicTests</span></div><div>]]]</div><div><br></div><div>Wh=
at I&#39;d like to confirm is if we can create a JAR without the test class=
es.</div><div><br></div><div><a class=3D"gmail_plusreply" id=3D"m_-24450128=
44157327442m_8271046481096262607m_1980389632522299721plusReplyChip-0" href=
=3D"mailto:[email protected]" target=3D"_blank">@Jun Omae</a><span class=3D=
"gmail_default" style=3D"font-family:&quot;courier new&quot;,monospace"></s=
pan>=C2=A0<span class=3D"gmail_default" style=3D"font-family:&quot;courier =
new&quot;,monospace"></span>Is there a problem if we include the test class=
es?<br></div><div><br></div><div><span style=3D"background-color:transparen=
t">Cheers,</span></div><div><span style=3D"background-color:transparent">Da=
niel</span></div><div><br></div></div></div>
</div>
</div>
</blockquote></div><div><br></div><div><br></div><div>[[[</div>$ svn co -q =
<a href=3D"https://svn.apache.org/repos/asf/subversion/branches/1.14.x" tar=
get=3D"_blank">https://svn.apache.org/repos/asf/subversion/branches/1.14.x<=
/a> ./subversion-1.14.x<br>$ svn cleanup --remove-{unversioned,ignored}<br>=
$ cd ./subversion-1.14.x$ /bin/sh autogen.sh<br>$ ./configure --prefix=3D/d=
ev/shm/svn-javahl --without-apxs --without-swig \<br>&gt; =C2=A0 --enable-j=
avahl --with-jdk=3D/usr/lib/jvm/java-11-openjdk-amd64 \<br>&gt; =C2=A0 --wi=
thout-junit PYTHON=3D/usr/bin/python3<br>$ make -j$(nproc) all<br>$ make ja=
vahl<br>$ make install<br>$ make install-javahl<br>$ unzip -l /dev/shm/svn-=
javahl/lib/svn-javahl/svn-javahl.jar | grep -F .class | wc -l<br>276<br>$ u=
nzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F Test | =
wc -l<br>0<br>]]]<br><br>&gt; Is there a problem if we include the test cla=
sses?<br><br><div>No direct issues have been found so far. However, static =
initializers within test classes are executed simply by loading the class.<=
/div><div><br></div>[[[<br>$ grep -r &#39;static *{&#39; subversion/binding=
s/javahl<br>subversion/bindings/javahl/tests/org/apache/subversion/javahl/U=
tilTests.java: =C2=A0 =C2=A0static {<br>subversion/bindings/javahl/tests/or=
g/apache/subversion/javahl/UtilTests.java: =C2=A0 =C2=A0static {<br>]]]<br>=
<div style=3D"font-family:&quot;courier new&quot;,monospace"></div></div><d=
iv dir=3D"ltr"><br></div></blockquote><div><br></div><div>Thank you!</div><=
div><br></div><div>I think I got it working on 1.14.x, successfully created=
 a JAR file without the tests.</div><div><br></div><div>It still seems to f=
ail on trunk. Can you do the same steps above on trunk?</div><div><br></div=
><div>Cheers,</div><div>Daniel</div><div><br></div></div></div>
</div>

--000000000000ae0dad0657ad1339--