[Soc-coordination] Jigsaw - Report 3

Guillaume Mazoyer respawneral at gmail.com
Sat Jul 2 11:14:17 UTC 2011


Status report Jigsaw num. 3 for GSoC 2011
-----------------------------------------

At beginning of the last two weeks, I was working on the final package
of JTReg. I was working on generating man pages and I finally found a
solution. I decided to use help2man[1] to generate the man pages but I
had to patch the two scripts "jtreg.sh" and "jtdiff.sh". Basically,
these two scripts launch main classes of the "jtreg.jar" JAR file. The
problem with them is that they don't know where they can find the JAR
file on Debian. So I patched the two scripts shell so they can locate
JAR files in "/usr/share/java".
To be able to generate man pages with help2man, I needed to be able to
use the scripts. But with "jtdiff.sh" and "jtreg.sh" using "jtreg.jar"
which is not in "/usr/share/java" during the build, I had to find a way
to make the scripts work. I decided to patch the scripts (again) and
make them depend of some environment variables. So in each script, there
are 4 used variables:

    - JAVA_HOME, which is the path where Java is,
    - JTREG_HOME, which is the path where "jtreg.jar" is,
    - JTHAR_HOME, which is the path where jtharness JAR are, and,
    - JAR_HOME, which is the path where other JAR are.

So during the packaging only JTREG_HOME needed to be changed to be able
to use the script. Once the scripts patch done, I finally wrote the
"rules" file of the package. Once again, I used javahelper so the
"rules" file contains the following code:

    #!/usr/bin/make -f
    JAVA_HOME = /usr/lib/jvm/default-java

    override_dh_auto_build:
        ant -f make/build.xml
        dh_auto_build
        JTREG_HOME=./dist/jtreg/lib/ help2man \
         --name="Regression Test Harness" \
         --help-option="-help" ./dist/jtreg/linux/bin/jtdiff > jtdiff.1
        JTREG_HOME=./dist/jtreg/lib/ help2man \
         --name="Regression Test Harness" \
         --help-option="-help" ./dist/jtreg/linux/bin/jtreg > jtreg.1

    override_dh_auto_clean:
        rm -r dist  ||:
        rm -r build ||:
        rm jtdiff.1 ||:
        rm jtreg.1  ||:
        dh_auto_clean

    %:
        dh $@ --with javahelper

As you can see it is not really complicated. The most interesting part
is the one when the man pages are generated. The JTREG_HOME variable is
set to "./dist/jtreg/lib/" because it is the path where "jtreg.jar" is
once it is built. I also used the "--help-option" option of help2man
because the help option of "jtreg" and "jtdiff" is "-help" and not
"--help".
The jtreg package is now on the Debian Java team SVN so anyone can get
it using:

    svn checkout
svn+ssh://${SVN_USER}@svn.debian.org/svn/pkg-java/trunk/jtreg

Thanks to Sylestre Ledru, jtreg is now available in Sid[2] and the
ITP[3] is now closed.

The second part of my work consisted in testing Jigsaw and fixed tests
if necessary. All the packaging work is now useful since the tests need
JTReg to be run. The problem with the current build system of Jigsaw is
that it is enough generic to be used on any system. So I had to patch
several makefiles. To find them:

    - cd jigsaw-tests
    - find . -name 'Makefile' | grep '/test/Makefile'

Then, the path to find "jtreg" has to be modified to match
"/usr/bin/jtreg". After that it is possible to run the tests with the
following command:

    - make test

Passing all the tests is something which takes a lot of time. After
that, I identified 42 (that's a cool number right?) failing tests. Some
of them came from the lack of X11 server and other from unreachable
network hosts. Some hackers of IcedTea[4] gave me some ideas to fix
several tests. They told me to look here[5] and here[6] because I just
had the same problems that they had before.
With this, I was able to fix the tests related to unreachable hosts and
to the lack of X server. I used Xvfb[7] to fix the X server depending
tests.
After running the tests again, only 13 tests were still failing. That is
a good result. Tom Marble and me decided to apply the patch of Alan
Bateman[8] and re-run the tests to see if it will break something:

    - cd jigsaw-tests
    - mkdir patches && cd patches
    - wget
      http://cr.openjdk.java.net/~alanb/jigsaw-mp-prototype1/webrev/jdk.patch
    - cd jdk
    - patch -p1 < ../patches/jdk.patch
    - make clean
    - make sanity
    - make all
    - make modules
    - xvfb-run -e xvfb-errors -a -s -ac make test -k

15 tests failed against 13 before. The 2 new failing tests are:

    - java/lang/management/MemoryMXBean/LowMemoryTestConcMarkSweepGC.sh
    - java/util/Locale/Bug6989440.java

I didn't go further but I'll try to understand why we have 15 failing
tests in few days. All the modifications that I have made on the source
code of Jigsaw can be found in a patch format here[10]:

This 2 weeks were also dedicated to the understanding of Jigsaw and its
modules. Reading the jigsaw-dev mailing list[9], I have found some
interesting conversation about jigsaw and how to write modules[11]. So I
decided to write a module to see how it works. I followed the
instruction of the quick start guide but when compiling the module
didn't work. So I tried to understand why and then to fix it. I
eventually compiled and installed my module and here is how I did it:

    - mkdir -p src/com.greetings/com/greetings/
    - mkdir -p src/org.astro/org/astro/
    - mkdir modules
    - vim src/com.greetings/module-info.java
    - vim src/com.greetings/com/greetings/Hello.java
    - vim src/org.astro/module-info.java
    - vim src/org.astro/org/astro/World.java
    - ./jigsaw/build/linux-amd64/bin/javac -d modules \
      -modulepath ./jigsaw/build/linux-amd64/modules/modules \
      -sourcepath src `find src -name '*.java'`
    - jmod create -L mlib
    - jmod install modules org.astro com.greetings -L mlib
    - java -L mlib -m com.greetings

And here it is, we have a nice hello world module. The documentation
says to put the "module-info.java" of "org.astro" in
"src/org.astro/org/astro/" but it didn't work for me so I tried to put
it in "src/org.astro/" and it worked. Also the quick start guide says
that we have to use the "-modulepath" option to specify where the
modules are. I first tried to use "./jigsaw/build/linux-amd64/modules/"
but "javac" told me he could not find "java.lang" so I noticed that
there is a subdirectory called "modules" in
"./jigsaw/build/linux-amd64/modules/" so I used it as module path and it
worked.

Writing a module and seeing how Jigsaw modules are made started to make
me think about the packaging of Jigsaw. Dependencies being available,
knowing how to build and test Jigsaw and seeing how modules are made, I
think that I will soon try to start the packaging of Jigsaw and getting
started with the packaging will be my ultimate goal for the next weeks.

[1] http://www.gnu.org/software/help2man/
[2] http://packages.debian.org/fr/sid/jtreg
[3] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629577
[4] http://icedtea.classpath.org/
[5]
http://icedtea.classpath.org/hg/buildbot/file/c02bdc56dc6e/icedtea/build.sh
[6]
http://icedtea.classpath.org/hg/icedtea6/file/tip/patches/testenv.patch
[7] http://en.wikipedia.org/wiki/Xvfb
[8]
http://cr.openjdk.java.net/~alanb/jigsaw-mp-prototype1/webrev/jdk.patch
[9] http://mail.openjdk.java.net/pipermail/jigsaw-dev/
[10] http://roku.info9.net/~guillaume/jigsaw/patch_jigsaw_02072011.patch
[11] http://openjdk.java.net/projects/jigsaw/doc/quickstart.html

-- 

Guillaume Mazoyer - http://respawner.fr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/soc-coordination/attachments/20110702/00c67fd1/attachment.pgp>


More information about the Soc-coordination mailing list