Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

macOSでのjtregセットアップ

OpenJDKのテストは、jtregなので、セットアップしました。

http://openjdk.java.net/projects/code-tools/jtreg/intro.html

macOSでビルドします。

http://openjdk.java.net/jtreg/build.html

$ sh make/build-all.sh /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home                                                                                   
make/build-all.sh: line 109: sha1sum: command not found

sha1sumがないので、入れます。

$ brew install md5sha1sum

$ sha1sum --version
Microbrew md5sum/sha1sum/ripemd160sum 0.9.5 (Wed Dec  6 12:48:56 EST 2006)

ビルドを再実行します。

$ sh make/build-all.sh /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home                                                                                   
/Users/koichi.sakata/code/jtreg/build/ant/apache-ant-1.9.4.zip: OK
...
cd /Users/koichi.sakata/code/jtreg/build/images; /usr/bin/zip -rq /Users/koichi.sakata/code/jtreg/build/images/jtreg.zip jtreg

ビルドできました。

$ ls -la build/images/jtreg/bin/jtreg
-r-xr-xr-x  1 koichi.sakata  468341264  6109  2 26 17:48 build/images/jtreg/bin/jtreg

環境変数JT_HOMEを設定します。

$ export JT_HOME=[jtreg]/build/images/jtreg

OpenJDKを--with-jtregをつけてconfigureします。

$ sh ./configure --with-debug-level=fastdebug --with-jtreg                                                                                                              
configure: Configuration created at Tue Feb 26 17:54:56 JST 2019.

イメージをmakeしたあと、run-testでテストを実行できます。

$ CONF=macosx-x86_64-server-fastdebug make run-test TEST=gc/epsilon/
Building target 'run-test' in configuration 'macosx-x86_64-server-fastdebug'
...
Test selection 'gc/epsilon/', will run:
* jtreg:test/hotspot/jtreg/gc/epsilon

Running test 'jtreg:test/hotspot/jtreg/gc/epsilon'
Passed: gc/epsilon/TestAlwaysPretouch.java
Passed: gc/epsilon/TestAlignment.java
Passed: gc/epsilon/TestArraycopyCheckcast.java
Passed: gc/epsilon/TestClasses.java
Passed: gc/epsilon/TestByteArrays.java
Passed: gc/epsilon/TestDieDefault.java
Passed: gc/epsilon/TestDieWithOnError.java
Passed: gc/epsilon/TestElasticTLAB.java
Passed: gc/epsilon/TestDieWithHeapDump.java
Passed: gc/epsilon/TestEpsilonEnabled.java
Passed: gc/epsilon/TestHelloWorld.java
Passed: gc/epsilon/TestLogTrace.java
Passed: gc/epsilon/TestElasticTLABDecay.java
Passed: gc/epsilon/TestMaxTLAB.java
Passed: gc/epsilon/TestMemoryPools.java
Passed: gc/epsilon/TestObjects.java
Passed: gc/epsilon/TestPrintHeapSteps.java
Passed: gc/epsilon/TestManyThreads.java
Passed: gc/epsilon/TestRefArrays.java
Passed: gc/epsilon/TestUpdateCountersSteps.java
Passed: gc/epsilon/TestSlidingGC.java
Test results: passed: 21
Report written to /Users/koichi.sakata/code/jdk-jdk/build/macosx-x86_64-server-fastdebug/test-results/jtreg_test_hotspot_jtreg_gc_epsilon/html/report.html
Results written to /Users/koichi.sakata/code/jdk-jdk/build/macosx-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_epsilon
Finished running test 'jtreg:test/hotspot/jtreg/gc/epsilon'
Test report is stored in build/macosx-x86_64-server-fastdebug/test-results/jtreg_test_hotspot_jtreg_gc_epsilon

==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR
   jtreg:test/hotspot/jtreg/gc/epsilon                  21    21     0     0
==============================
TEST SUCCESS