Merge
This commit is contained in:
commit
6afcdf0e2c
@ -420,6 +420,7 @@ ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
|
||||
03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6
|
||||
b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169
|
||||
4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170
|
||||
|
||||
aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7
|
||||
df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8
|
||||
b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9
|
||||
4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171
|
||||
|
@ -651,7 +651,7 @@ MKDIR:=@MKDIR@
|
||||
MV:=@MV@
|
||||
NAWK:=@NAWK@
|
||||
NICE:=@NICE@
|
||||
PANDOC:=@PANDOC@
|
||||
PANDOC:=@FIXPATH@ @PANDOC@
|
||||
PATCH:=@PATCH@
|
||||
PRINTF:=@PRINTF@
|
||||
RM:=@RM@
|
||||
|
@ -1,21 +1,23 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>OpenJDK Build README</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../jdk/make/data/docs-resources/specs/resources/jdk-default.css">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<header>
|
||||
<h1 class="title">OpenJDK Build README</h1>
|
||||
</div>
|
||||
<div class="figure">
|
||||
<img src="http://openjdk.java.net/images/openjdk.png" alt="OpenJDK" />
|
||||
<p class="caption">OpenJDK</p>
|
||||
</div>
|
||||
</header>
|
||||
<figure>
|
||||
<img src="http://openjdk.java.net/images/openjdk.png" alt="OpenJDK" /><figcaption>OpenJDK</figcaption>
|
||||
</figure>
|
||||
<hr />
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<p>This README file contains build instructions for the <a href="http://openjdk.java.net">OpenJDK</a>. Building the source code for the OpenJDK requires a certain degree of technical expertise.</p>
|
||||
@ -149,50 +151,50 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th align="left">Package</th>
|
||||
<th align="left">Version</th>
|
||||
<th style="text-align: left;">Package</th>
|
||||
<th style="text-align: left;">Version</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="left">developer/solarisstudio-124/backend</td>
|
||||
<td align="left">12.4-1.0.6.0</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/backend</td>
|
||||
<td style="text-align: left;">12.4-1.0.6.0</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">developer/solarisstudio-124/c++</td>
|
||||
<td align="left">12.4-1.0.10.0</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/c++</td>
|
||||
<td style="text-align: left;">12.4-1.0.10.0</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">developer/solarisstudio-124/cc</td>
|
||||
<td align="left">12.4-1.0.4.0</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/cc</td>
|
||||
<td style="text-align: left;">12.4-1.0.4.0</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">developer/solarisstudio-124/library/c++-libs</td>
|
||||
<td align="left">12.4-1.0.10.0</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/library/c++-libs</td>
|
||||
<td style="text-align: left;">12.4-1.0.10.0</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">developer/solarisstudio-124/library/math-libs</td>
|
||||
<td align="left">12.4-1.0.0.1</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/library/math-libs</td>
|
||||
<td style="text-align: left;">12.4-1.0.0.1</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">developer/solarisstudio-124/library/studio-gccrt</td>
|
||||
<td align="left">12.4-1.0.0.1</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/library/studio-gccrt</td>
|
||||
<td style="text-align: left;">12.4-1.0.0.1</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">developer/solarisstudio-124/studio-common</td>
|
||||
<td align="left">12.4-1.0.0.1</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/studio-common</td>
|
||||
<td style="text-align: left;">12.4-1.0.0.1</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">developer/solarisstudio-124/studio-ja</td>
|
||||
<td align="left">12.4-1.0.0.1</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/studio-ja</td>
|
||||
<td style="text-align: left;">12.4-1.0.0.1</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">developer/solarisstudio-124/studio-legal</td>
|
||||
<td align="left">12.4-1.0.0.1</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/studio-legal</td>
|
||||
<td style="text-align: left;">12.4-1.0.0.1</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">developer/solarisstudio-124/studio-zhCN</td>
|
||||
<td align="left">12.4-1.0.0.1</td>
|
||||
<td style="text-align: left;">developer/solarisstudio-124/studio-zhCN</td>
|
||||
<td style="text-align: left;">12.4-1.0.0.1</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -211,66 +213,66 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th align="left">Binary Name</th>
|
||||
<th align="left">Category</th>
|
||||
<th align="left">Package</th>
|
||||
<th align="left">Description</th>
|
||||
<th style="text-align: left;">Binary Name</th>
|
||||
<th style="text-align: left;">Category</th>
|
||||
<th style="text-align: left;">Package</th>
|
||||
<th style="text-align: left;">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="left">ar.exe</td>
|
||||
<td align="left">Devel</td>
|
||||
<td align="left">binutils</td>
|
||||
<td align="left">The GNU assembler, linker and binary utilities</td>
|
||||
<td style="text-align: left;">ar.exe</td>
|
||||
<td style="text-align: left;">Devel</td>
|
||||
<td style="text-align: left;">binutils</td>
|
||||
<td style="text-align: left;">The GNU assembler, linker and binary utilities</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">make.exe</td>
|
||||
<td align="left">Devel</td>
|
||||
<td align="left">make</td>
|
||||
<td align="left">The GNU version of the 'make' utility built for CYGWIN</td>
|
||||
<td style="text-align: left;">make.exe</td>
|
||||
<td style="text-align: left;">Devel</td>
|
||||
<td style="text-align: left;">make</td>
|
||||
<td style="text-align: left;">The GNU version of the 'make' utility built for CYGWIN</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">m4.exe</td>
|
||||
<td align="left">Interpreters</td>
|
||||
<td align="left">m4</td>
|
||||
<td align="left">GNU implementation of the traditional Unix macro processor</td>
|
||||
<td style="text-align: left;">m4.exe</td>
|
||||
<td style="text-align: left;">Interpreters</td>
|
||||
<td style="text-align: left;">m4</td>
|
||||
<td style="text-align: left;">GNU implementation of the traditional Unix macro processor</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">cpio.exe</td>
|
||||
<td align="left">Utils</td>
|
||||
<td align="left">cpio</td>
|
||||
<td align="left">A program to manage archives of files</td>
|
||||
<td style="text-align: left;">cpio.exe</td>
|
||||
<td style="text-align: left;">Utils</td>
|
||||
<td style="text-align: left;">cpio</td>
|
||||
<td style="text-align: left;">A program to manage archives of files</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">gawk.exe</td>
|
||||
<td align="left">Utils</td>
|
||||
<td align="left">awk</td>
|
||||
<td align="left">Pattern-directed scanning and processing language</td>
|
||||
<td style="text-align: left;">gawk.exe</td>
|
||||
<td style="text-align: left;">Utils</td>
|
||||
<td style="text-align: left;">awk</td>
|
||||
<td style="text-align: left;">Pattern-directed scanning and processing language</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">file.exe</td>
|
||||
<td align="left">Utils</td>
|
||||
<td align="left">file</td>
|
||||
<td align="left">Determines file type using 'magic' numbers</td>
|
||||
<td style="text-align: left;">file.exe</td>
|
||||
<td style="text-align: left;">Utils</td>
|
||||
<td style="text-align: left;">file</td>
|
||||
<td style="text-align: left;">Determines file type using 'magic' numbers</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">zip.exe</td>
|
||||
<td align="left">Archive</td>
|
||||
<td align="left">zip</td>
|
||||
<td align="left">Package and compress (archive) files</td>
|
||||
<td style="text-align: left;">zip.exe</td>
|
||||
<td style="text-align: left;">Archive</td>
|
||||
<td style="text-align: left;">zip</td>
|
||||
<td style="text-align: left;">Package and compress (archive) files</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">unzip.exe</td>
|
||||
<td align="left">Archive</td>
|
||||
<td align="left">unzip</td>
|
||||
<td align="left">Extract compressed files in a ZIP archive</td>
|
||||
<td style="text-align: left;">unzip.exe</td>
|
||||
<td style="text-align: left;">Archive</td>
|
||||
<td style="text-align: left;">unzip</td>
|
||||
<td style="text-align: left;">Extract compressed files in a ZIP archive</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">free.exe</td>
|
||||
<td align="left">System</td>
|
||||
<td align="left">procps</td>
|
||||
<td align="left">Display amount of free and used memory in the system</td>
|
||||
<td style="text-align: left;">free.exe</td>
|
||||
<td style="text-align: left;">System</td>
|
||||
<td style="text-align: left;">procps</td>
|
||||
<td style="text-align: left;">Display amount of free and used memory in the system</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -561,14 +563,14 @@ This is caused by a missing libstdc++.a library. This is installed as part of a
|
||||
This is probably an issue with SELinux (See <a href="http://en.wikipedia.org/wiki/SELinux">SELinux on Wikipedia</a>). Parts of the VM is built without the <code>-fPIC</code> for performance reasons.</p></li>
|
||||
</ul>
|
||||
<p>To completely disable SELinux:</p>
|
||||
<ol style="list-style-type: decimal">
|
||||
<ol type="1">
|
||||
<li><code>$ su root</code></li>
|
||||
<li><code># system-config-securitylevel</code></li>
|
||||
<li><code>In the window that appears, select the SELinux tab</code></li>
|
||||
<li><code>Disable SELinux</code></li>
|
||||
</ol>
|
||||
<p>Alternatively, instead of completely disabling it you could disable just this one check.</p>
|
||||
<ol style="list-style-type: decimal">
|
||||
<ol type="1">
|
||||
<li>Select System->Administration->SELinux Management</li>
|
||||
<li>In the SELinux Management Tool which appears, select "Boolean" from the menu on the left</li>
|
||||
<li>Expand the "Memory Protection" group</li>
|
||||
@ -616,62 +618,62 @@ Try rebooting the system, or there could be some kind of issue with the disk or
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th align="left">Base OS and Architecture</th>
|
||||
<th align="left">OS</th>
|
||||
<th align="left">C/C++ Compiler</th>
|
||||
<th align="left">Processors</th>
|
||||
<th align="left">RAM Minimum</th>
|
||||
<th align="left">DISK Needs</th>
|
||||
<th style="text-align: left;">Base OS and Architecture</th>
|
||||
<th style="text-align: left;">OS</th>
|
||||
<th style="text-align: left;">C/C++ Compiler</th>
|
||||
<th style="text-align: left;">Processors</th>
|
||||
<th style="text-align: left;">RAM Minimum</th>
|
||||
<th style="text-align: left;">DISK Needs</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="left">Linux X86 (32-bit) and X64 (64-bit)</td>
|
||||
<td align="left">Oracle Enterprise Linux 6.4</td>
|
||||
<td align="left">gcc 4.9.2</td>
|
||||
<td align="left">2 or more</td>
|
||||
<td align="left">1 GB</td>
|
||||
<td align="left">6 GB</td>
|
||||
<td style="text-align: left;">Linux X86 (32-bit) and X64 (64-bit)</td>
|
||||
<td style="text-align: left;">Oracle Enterprise Linux 6.4</td>
|
||||
<td style="text-align: left;">gcc 4.9.2</td>
|
||||
<td style="text-align: left;">2 or more</td>
|
||||
<td style="text-align: left;">1 GB</td>
|
||||
<td style="text-align: left;">6 GB</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">Solaris SPARCV9 (64-bit)</td>
|
||||
<td align="left">Solaris 11 Update 1</td>
|
||||
<td align="left">Studio 12 Update 4 + patches</td>
|
||||
<td align="left">4 or more</td>
|
||||
<td align="left">4 GB</td>
|
||||
<td align="left">8 GB</td>
|
||||
<td style="text-align: left;">Solaris SPARCV9 (64-bit)</td>
|
||||
<td style="text-align: left;">Solaris 11 Update 1</td>
|
||||
<td style="text-align: left;">Studio 12 Update 4 + patches</td>
|
||||
<td style="text-align: left;">4 or more</td>
|
||||
<td style="text-align: left;">4 GB</td>
|
||||
<td style="text-align: left;">8 GB</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">Solaris X64 (64-bit)</td>
|
||||
<td align="left">Solaris 11 Update 1</td>
|
||||
<td align="left">Studio 12 Update 4 + patches</td>
|
||||
<td align="left">4 or more</td>
|
||||
<td align="left">4 GB</td>
|
||||
<td align="left">8 GB</td>
|
||||
<td style="text-align: left;">Solaris X64 (64-bit)</td>
|
||||
<td style="text-align: left;">Solaris 11 Update 1</td>
|
||||
<td style="text-align: left;">Studio 12 Update 4 + patches</td>
|
||||
<td style="text-align: left;">4 or more</td>
|
||||
<td style="text-align: left;">4 GB</td>
|
||||
<td style="text-align: left;">8 GB</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">Windows X86 (32-bit)</td>
|
||||
<td align="left">Windows Server 2012 R2 x64</td>
|
||||
<td align="left">Microsoft Visual Studio C++ 2013 Professional Edition</td>
|
||||
<td align="left">2 or more</td>
|
||||
<td align="left">2 GB</td>
|
||||
<td align="left">6 GB</td>
|
||||
<td style="text-align: left;">Windows X86 (32-bit)</td>
|
||||
<td style="text-align: left;">Windows Server 2012 R2 x64</td>
|
||||
<td style="text-align: left;">Microsoft Visual Studio C++ 2013 Professional Edition</td>
|
||||
<td style="text-align: left;">2 or more</td>
|
||||
<td style="text-align: left;">2 GB</td>
|
||||
<td style="text-align: left;">6 GB</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">Windows X64 (64-bit)</td>
|
||||
<td align="left">Windows Server 2012 R2 x64</td>
|
||||
<td align="left">Microsoft Visual Studio C++ 2013 Professional Edition</td>
|
||||
<td align="left">2 or more</td>
|
||||
<td align="left">2 GB</td>
|
||||
<td align="left">6 GB</td>
|
||||
<td style="text-align: left;">Windows X64 (64-bit)</td>
|
||||
<td style="text-align: left;">Windows Server 2012 R2 x64</td>
|
||||
<td style="text-align: left;">Microsoft Visual Studio C++ 2013 Professional Edition</td>
|
||||
<td style="text-align: left;">2 or more</td>
|
||||
<td style="text-align: left;">2 GB</td>
|
||||
<td style="text-align: left;">6 GB</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">Mac OS X X64 (64-bit)</td>
|
||||
<td align="left">Mac OS X 10.9 "Mavericks"</td>
|
||||
<td align="left">Xcode 6.3 or newer</td>
|
||||
<td align="left">2 or more</td>
|
||||
<td align="left">4 GB</td>
|
||||
<td align="left">6 GB</td>
|
||||
<td style="text-align: left;">Mac OS X X64 (64-bit)</td>
|
||||
<td style="text-align: left;">Mac OS X 10.9 "Mavericks"</td>
|
||||
<td style="text-align: left;">Xcode 6.3 or newer</td>
|
||||
<td style="text-align: left;">2 or more</td>
|
||||
<td style="text-align: left;">4 GB</td>
|
||||
<td style="text-align: left;">6 GB</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1,19 +1,22 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Testing OpenJDK</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../jdk/make/data/docs-resources/specs/resources/jdk-default.css">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<header>
|
||||
<h1 class="title">Testing OpenJDK</h1>
|
||||
</div>
|
||||
<div id="TOC">
|
||||
</header>
|
||||
<nav id="TOC">
|
||||
<ul>
|
||||
<li><a href="#using-the-run-test-framework">Using the run-test framework</a></li>
|
||||
<li><a href="#test-selection">Test selection</a><ul>
|
||||
@ -26,16 +29,18 @@
|
||||
<li><a href="#gtest-keywords">Gtest keywords</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<h2 id="using-the-run-test-framework">Using the run-test framework</h2>
|
||||
<p>This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.</p>
|
||||
<p>The main target "run-test" uses the jdk-image as the tested product. There is also an alternate target "exploded-run-test" that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.</p>
|
||||
<p>Some example command-lines:</p>
|
||||
<pre><code>$ make run-test-tier1
|
||||
$ make run-test-jdk_lang JTREG="JOBS=8"
|
||||
$ make run-test TEST=jdk_lang
|
||||
$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
|
||||
$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
|
||||
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"</code></pre>
|
||||
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
|
||||
$ make exploded-run-test TEST=hotspot_tier1</code></pre>
|
||||
<h2 id="test-selection">Test selection</h2>
|
||||
<p>All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the <code>TEST</code> variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.</p>
|
||||
<p>For some common top-level tests, direct make targets have been generated. This includes all JTreg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST="x"</code> solution needs to be used.</p>
|
||||
|
@ -7,6 +7,11 @@ built a jdk locally and want to test it. Running common test targets is simple,
|
||||
and more complex ad-hoc combination of tests is possible. The user interface is
|
||||
forgiving, and clearly report errors it cannot resolve.
|
||||
|
||||
The main target "run-test" uses the jdk-image as the tested product. There is
|
||||
also an alternate target "exploded-run-test" that uses the exploded image
|
||||
instead. Not all tests will run successfully on the exploded image, but using
|
||||
this target can greatly improve rebuild times for certain workflows.
|
||||
|
||||
Some example command-lines:
|
||||
|
||||
$ make run-test-tier1
|
||||
@ -15,6 +20,7 @@ Some example command-lines:
|
||||
$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
|
||||
$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
|
||||
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
|
||||
$ make exploded-run-test TEST=hotspot_tier1
|
||||
|
||||
## Test selection
|
||||
|
||||
|
@ -42,7 +42,8 @@ java.activation_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
|
||||
|
||||
################################################################################
|
||||
|
||||
java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline
|
||||
java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline \
|
||||
--doclint-format html4
|
||||
java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
|
||||
java.base_CLEAN := intrinsic.properties
|
||||
|
||||
@ -95,7 +96,8 @@ java.datatransfer_COPY := flavormap.properties
|
||||
################################################################################
|
||||
|
||||
java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \
|
||||
'-Xdoclint/package:java.*,javax.*' -Xlint:exports
|
||||
'-Xdoclint/package:java.*,javax.*' -Xlint:exports \
|
||||
--doclint-format html4
|
||||
java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
|
||||
java.desktop_CLEAN := iio-plugin.properties cursors.properties
|
||||
|
||||
|
@ -55,7 +55,6 @@ COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
|
||||
LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
|
||||
REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
|
||||
|
||||
|
||||
# In order to get a specific ordering it's necessary to specify the total
|
||||
# ordering of tags as the tags are otherwise ordered in order of definition.
|
||||
JAVADOC_TAGS := \
|
||||
@ -163,7 +162,7 @@ JAVASE_JAVADOC_DOC_TITLE := Java™ Platform, Standard Edition \
|
||||
|
||||
################################################################################
|
||||
|
||||
JDK_DOCS_INDEX_HTML_TITLE := Java™ Platform, Standard Edition Development Kit \
|
||||
JDK_INDEX_TITLE := Java™ Platform, Standard Edition Development Kit \
|
||||
(JDK™) $(VERSION_SPECIFICATION) Specification<br>$(DRAFT_MARKER_TITLE)
|
||||
|
||||
################################################################################
|
||||
@ -211,10 +210,10 @@ endef
|
||||
SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
|
||||
define SetupApiDocsGenerationBody
|
||||
|
||||
# Figure out all modules, both specified and transitive, that will be processed
|
||||
# by javadoc.
|
||||
$1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES))
|
||||
$1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES))
|
||||
# Figure out all modules, both specified and transitive indirect exports, that
|
||||
# will be processed by javadoc.
|
||||
$1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
|
||||
$1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
|
||||
|
||||
ifeq ($$(ENABLE_FULL_DOCS), true)
|
||||
# Tell the ModuleGraph taglet to generate html links to soon-to-be-created
|
||||
@ -334,7 +333,8 @@ $(eval $(call SetupApiDocsGeneration, JDK_API, \
|
||||
################################################################################
|
||||
# Setup generation of the Java SE API documentation (javadoc + modulegraph)
|
||||
|
||||
# The Java SE module scope is just java.se.ee and it's transitive modules.
|
||||
# The Java SE module scope is just java.se.ee and it's transitive indirect
|
||||
# exports.
|
||||
JAVASE_JAVADOC_MODULES := java.se.ee
|
||||
|
||||
JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
|
||||
@ -356,15 +356,27 @@ $(eval $(call SetupApiDocsGeneration, JAVASE_API, \
|
||||
|
||||
################################################################################
|
||||
|
||||
JDK_DOCS_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
|
||||
JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
|
||||
JDK_INDEX_TOOLS_DIR := $(TOOLS_CLASSES_DIR)/build/tools/docs
|
||||
|
||||
$(JDK_DOCS_INDEX_HTML): $(BUILD_JIGSAW_TOOLS)
|
||||
$(JDK_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) \
|
||||
$(JDK_INDEX_TOOLS_DIR)/docs-bundle-page.html \
|
||||
$(JDK_INDEX_TOOLS_DIR)/docs-module-groups.properties
|
||||
$(call LogInfo, Generating docs bundle index page)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_DOCS_INDEX_HTML_TITLE)' \
|
||||
$(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_INDEX_TITLE)' \
|
||||
--output $@
|
||||
|
||||
JDK_DOCS_INDEX_HTML_TARGETS := $(JDK_DOCS_INDEX_HTML)
|
||||
JDK_INDEX_TARGETS := $(JDK_INDEX_HTML)
|
||||
|
||||
# Copy the global resources
|
||||
GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/
|
||||
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
|
||||
SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
|
||||
FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
|
||||
DEST := $(DOCS_OUTPUTDIR), \
|
||||
))
|
||||
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
|
||||
|
||||
################################################################################
|
||||
# Copy JDK specs files
|
||||
@ -389,20 +401,11 @@ $(foreach m, $(ALL_MODULES), \
|
||||
) \
|
||||
)
|
||||
|
||||
# Copy the global resources
|
||||
GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs
|
||||
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
|
||||
SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
|
||||
FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
|
||||
DEST := $(DOCS_OUTPUTDIR)/specs/, \
|
||||
))
|
||||
JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
|
||||
|
||||
ifeq ($(ENABLE_FULL_DOCS), true)
|
||||
# For all markdown files in $module/share/specs directories, convert them to
|
||||
# html.
|
||||
|
||||
GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/specs/resources/jdk-default.css
|
||||
GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
|
||||
|
||||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
|
||||
@ -464,7 +467,7 @@ docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
|
||||
|
||||
docs-jdk-specs: $(JDK_SPECS_TARGETS)
|
||||
|
||||
docs-jdk-index: $(JDK_DOCS_INDEX_HTML_TARGETS)
|
||||
docs-jdk-index: $(JDK_INDEX_TARGETS)
|
||||
|
||||
docs-zip: $(ZIP_TARGETS)
|
||||
|
||||
|
@ -56,6 +56,8 @@ help:
|
||||
$(info $(_) make test # Run tests, default is all tests (see TEST below))
|
||||
$(info $(_) make run-test-<test> # Run test, e.g. run-test-tier1)
|
||||
$(info $(_) make run-test TEST=<t> # Run test(s) given by TEST specification)
|
||||
$(info $(_) make exploded-run-test TEST=<t> # Run test(s) on the exploded image instead of)
|
||||
$(info $(_) # the full jdk image)
|
||||
$(info )
|
||||
$(info Targets for cleaning)
|
||||
$(info $(_) make clean # Remove all files generated by make, but not those)
|
||||
|
@ -450,13 +450,18 @@ define DeclareRunTestRecipe
|
||||
run-test-$1:
|
||||
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$1")
|
||||
|
||||
exploded-run-test-$1:
|
||||
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
|
||||
TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
|
||||
|
||||
endef
|
||||
|
||||
# ALL_NAMED_TESTS is defined in FindTests.gmk
|
||||
$(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
|
||||
ALL_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
|
||||
ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-run-test-, $(ALL_NAMED_TESTS))
|
||||
|
||||
ALL_TARGETS += $(ALL_TEST_TARGETS)
|
||||
ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
|
||||
|
||||
################################################################################
|
||||
# Build tests
|
||||
@ -485,6 +490,10 @@ test-image-jdk-jtreg-native:
|
||||
run-test:
|
||||
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
|
||||
|
||||
exploded-run-test:
|
||||
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
|
||||
TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
|
||||
|
||||
ifeq ($(BUILD_GTEST), true)
|
||||
test-image-hotspot-gtest:
|
||||
+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
|
||||
@ -514,7 +523,7 @@ ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
|
||||
test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
|
||||
test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
|
||||
test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
|
||||
run-test
|
||||
run-test exploded-run-test
|
||||
|
||||
################################################################################
|
||||
# Run tests
|
||||
@ -798,7 +807,8 @@ else
|
||||
docs-javase-api-modulegraph: exploded-image buildtools-modules
|
||||
|
||||
# The gensrc steps for hotspot and jdk.jdi create html spec files.
|
||||
docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
|
||||
docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
|
||||
docs-jdk-index
|
||||
|
||||
docs-jdk-index: exploded-image buildtools-modules
|
||||
|
||||
@ -807,9 +817,11 @@ else
|
||||
test: jdk-image test-image
|
||||
|
||||
run-test: jdk-image test-image
|
||||
exploded-run-test: exploded-image test-image
|
||||
|
||||
# Declare dependency for all generated test targets
|
||||
$(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image))
|
||||
$(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
|
||||
|
||||
create-buildjdk-copy: jdk.jlink-java java.base-gendata \
|
||||
$(addsuffix -java, $(INTERIM_IMAGE_MODULES))
|
||||
|
@ -151,6 +151,7 @@ DOCS_MODULES += \
|
||||
jdk.crypto.ec \
|
||||
jdk.dynalink \
|
||||
jdk.editpad \
|
||||
jdk.hotspot.agent \
|
||||
jdk.httpserver \
|
||||
jdk.incubator.httpclient \
|
||||
jdk.jartool \
|
||||
@ -298,7 +299,8 @@ GetModuleSrcPath = \
|
||||
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
|
||||
|
||||
################################################################################
|
||||
# Extract module dependencies from module-info.java files.
|
||||
# Extract module dependencies from module-info.java files, both normal
|
||||
# dependencies ("requires"), and indirect exports ("requires transitive").
|
||||
|
||||
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
|
||||
|
||||
@ -320,17 +322,31 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
|
||||
gsub(/^ +\*.*/, ""); \
|
||||
gsub(/ /, ""); \
|
||||
printf(" %s", $$0) } \
|
||||
END { printf("\n") }' $m && \
|
||||
$(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
|
||||
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
|
||||
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
|
||||
/^ *requires *transitive/ { \
|
||||
sub(/;/, ""); \
|
||||
sub(/requires/, ""); \
|
||||
sub(/transitive/, ""); \
|
||||
sub(/\/\/.*/, ""); \
|
||||
sub(/\/\*.*\*\//, ""); \
|
||||
gsub(/^ +\*.*/, ""); \
|
||||
gsub(/ /, ""); \
|
||||
printf(" %s", $$0) } \
|
||||
END { printf("\n") }' $m \
|
||||
) >> $@ $(NEWLINE))
|
||||
|
||||
-include $(MODULE_DEPS_MAKEFILE)
|
||||
|
||||
# Param 1: Module to find deps for
|
||||
# Find dependencies ("requires") for a given module.
|
||||
# Param 1: Module to find dependencies for.
|
||||
FindDepsForModule = \
|
||||
$(DEPS_$(strip $1))
|
||||
|
||||
# Finds transitive dependencies in 3 levels.
|
||||
# Param 1: Module to find transitive deps for
|
||||
# Find dependencies ("requires") transitively in 3 levels for a given module.
|
||||
# Param 1: Module to find dependencies for.
|
||||
FindTransitiveDepsForModule = \
|
||||
$(sort $(call FindDepsForModule, $1) \
|
||||
$(foreach m, $(call FindDepsForModule, $1), \
|
||||
@ -338,11 +354,30 @@ FindTransitiveDepsForModule = \
|
||||
$(foreach n, $(call FindDepsForModule, $m), \
|
||||
$(call FindDepsForModule, $n))))
|
||||
|
||||
# Finds transitive dependencies in 3 levels for a set of modules.
|
||||
# Param 1: List of modules to find transitive deps for
|
||||
# Find dependencies ("requires") transitively in 3 levels for a set of modules.
|
||||
# Param 1: List of modules to find dependencies for.
|
||||
FindTransitiveDepsForModules = \
|
||||
$(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
|
||||
|
||||
# Find indirect exported modules ("requires transitive") for a given module .
|
||||
# Param 1: Module to find indirect exported modules for.
|
||||
FindIndirectExportsForModule = \
|
||||
$(TRANSITIVE_MODULES_$(strip $1))
|
||||
|
||||
# Finds indirect exported modules transitively in 3 levels for a given module.
|
||||
# Param 1: Module to find indirect exported modules for.
|
||||
FindTransitiveIndirectDepsForModule = \
|
||||
$(sort $(call FindIndirectExportsForModule, $1) \
|
||||
$(foreach m, $(call FindIndirectExportsForModule, $1), \
|
||||
$(call FindIndirectExportsForModule, $m) \
|
||||
$(foreach n, $(call FindIndirectExportsForModule, $m), \
|
||||
$(call FindIndirectExportsForModule, $n))))
|
||||
|
||||
# Finds indirect exported modules transitively in 3 levels for a set of modules.
|
||||
# Param 1: List of modules to find indirect exported modules for.
|
||||
FindTransitiveIndirectDepsForModules = \
|
||||
$(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m)))
|
||||
|
||||
# Upgradeable modules are those that are either defined as upgradeable or that
|
||||
# require an upradeable module.
|
||||
FindAllUpgradeableModules = \
|
||||
|
@ -36,7 +36,7 @@ define ProcessMarkdown
|
||||
ifneq ($$(findstring http:/, $$($1_CSS)), )
|
||||
$1_$2_CSS_OPTION := --css '$$($1_CSS)'
|
||||
else
|
||||
$1_$2_CSS := $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR))
|
||||
$1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
|
||||
$1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
|
||||
endif
|
||||
endif
|
||||
@ -51,7 +51,7 @@ $$($1_$2_OUTPUT_FILE): $$($1_SRC)/$2 $$($1_$2_VARDEPS_FILE)
|
||||
$$(call LogInfo, Converting $2 to html)
|
||||
$$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown)
|
||||
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
|
||||
$$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
|
||||
$$(PANDOC) $$($1_OPTIONS) -f markdown -t html5 --standalone \
|
||||
$$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@')
|
||||
ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
|
||||
TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
|
||||
|
@ -69,7 +69,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
|
||||
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
|
||||
JVM := $(JAVA_JAVAC), \
|
||||
JAVAC := $(NEW_JAVAC), \
|
||||
FLAGS := -source 10 -target 10 \
|
||||
FLAGS := -source 10 -target 10 --doclint-format html5 \
|
||||
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
|
||||
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
|
||||
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
|
||||
|
@ -21,7 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.test.lib.wrappers;
|
||||
package jdk.test.lib;
|
||||
|
||||
import java.util.Objects;
|
||||
|
103
test/lib/jdk/test/lib/RandomFactory.java
Normal file
103
test/lib/jdk/test/lib/RandomFactory.java
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.test.lib;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.SplittableRandom;
|
||||
|
||||
/**
|
||||
* Factory class which generates and prints to STDOUT a long-valued seed
|
||||
* for use in initializing a PRNG. An instance of {@code Random} or
|
||||
* {@code SplittableRandom} may likewise be obtained.
|
||||
*/
|
||||
public class RandomFactory {
|
||||
/**
|
||||
* Attempt to obtain the seed from the value of the "seed" property.
|
||||
* @return The seed or {@code null} if the "seed" property was not set or
|
||||
* could not be parsed.
|
||||
*/
|
||||
private static Long getSystemSeed() {
|
||||
Long seed = null;
|
||||
try {
|
||||
// note that Long.valueOf(null) also throws a
|
||||
// NumberFormatException so if the property is undefined this
|
||||
// will still work correctly
|
||||
seed = Long.valueOf(System.getProperty("seed"));
|
||||
} catch (NumberFormatException e) {
|
||||
// do nothing: seed is still null
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a seed from an independent PRNG.
|
||||
*
|
||||
* @return A random seed.
|
||||
*/
|
||||
private static long getRandomSeed() {
|
||||
return new Random().nextLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain and print to STDOUT a seed appropriate for initializing a PRNG.
|
||||
* If the system property "seed" is set and has value which may be correctly
|
||||
* parsed it is used, otherwise a seed is generated using an independent
|
||||
* PRNG.
|
||||
*
|
||||
* @return The seed.
|
||||
*/
|
||||
public static long getSeed() {
|
||||
Long seed = getSystemSeed();
|
||||
if (seed == null) {
|
||||
seed = getRandomSeed();
|
||||
}
|
||||
System.out.println("Seed from RandomFactory = "+seed+"L");
|
||||
return seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain and print to STDOUT a seed and use it to initialize a new
|
||||
* {@code Random} instance which is returned. If the system
|
||||
* property "seed" is set and has value which may be correctly parsed it
|
||||
* is used, otherwise a seed is generated using an independent PRNG.
|
||||
*
|
||||
* @return The {@code Random} instance.
|
||||
*/
|
||||
public static Random getRandom() {
|
||||
return new Random(getSeed());
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain and print to STDOUT a seed and use it to initialize a new
|
||||
* {@code SplittableRandom} instance which is returned. If the system
|
||||
* property "seed" is set and has value which may be correctly parsed it
|
||||
* is used, otherwise a seed is generated using an independent PRNG.
|
||||
*
|
||||
* @return The {@code SplittableRandom} instance.
|
||||
*/
|
||||
public static SplittableRandom getSplittableRandom() {
|
||||
return new SplittableRandom(getSeed());
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.test.lib.wrappers;
|
||||
package jdk.test.lib;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Callable;
|
229
test/lib/jdk/test/lib/util/FileUtils.java
Normal file
229
test/lib/jdk/test/lib/util/FileUtils.java
Normal file
@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.test.lib.util;
|
||||
|
||||
import jdk.test.lib.Platform;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryNotEmptyException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* Common library for various test file utility functions.
|
||||
*/
|
||||
public final class FileUtils {
|
||||
private static final boolean IS_WINDOWS = Platform.isWindows();
|
||||
private static final int RETRY_DELETE_MILLIS = IS_WINDOWS ? 500 : 0;
|
||||
private static final int MAX_RETRY_DELETE_TIMES = IS_WINDOWS ? 15 : 0;
|
||||
|
||||
/**
|
||||
* Deletes a file, retrying if necessary.
|
||||
*
|
||||
* @param path the file to delete
|
||||
*
|
||||
* @throws NoSuchFileException
|
||||
* if the file does not exist (optional specific exception)
|
||||
* @throws DirectoryNotEmptyException
|
||||
* if the file is a directory and could not otherwise be deleted
|
||||
* because the directory is not empty (optional specific exception)
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
*/
|
||||
public static void deleteFileWithRetry(Path path) throws IOException {
|
||||
try {
|
||||
deleteFileWithRetry0(path);
|
||||
} catch (InterruptedException x) {
|
||||
throw new IOException("Interrupted while deleting.", x);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file, retrying if necessary.
|
||||
* No exception thrown if file doesn't exist.
|
||||
*
|
||||
* @param path the file to delete
|
||||
*
|
||||
* @throws NoSuchFileException
|
||||
* if the file does not exist (optional specific exception)
|
||||
* @throws DirectoryNotEmptyException
|
||||
* if the file is a directory and could not otherwise be deleted
|
||||
* because the directory is not empty (optional specific exception)
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
*/
|
||||
public static void deleteFileIfExistsWithRetry(Path path) throws IOException {
|
||||
try {
|
||||
if (Files.exists(path)) {
|
||||
deleteFileWithRetry0(path);
|
||||
}
|
||||
} catch (InterruptedException x) {
|
||||
throw new IOException("Interrupted while deleting.", x);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteFileWithRetry0(Path path)
|
||||
throws IOException, InterruptedException {
|
||||
int times = 0;
|
||||
IOException ioe = null;
|
||||
while (true) {
|
||||
try {
|
||||
Files.delete(path);
|
||||
while (Files.exists(path)) {
|
||||
times++;
|
||||
if (times > MAX_RETRY_DELETE_TIMES) {
|
||||
throw new IOException("File still exists after " + times + " waits.");
|
||||
}
|
||||
Thread.sleep(RETRY_DELETE_MILLIS);
|
||||
}
|
||||
break;
|
||||
} catch (NoSuchFileException | DirectoryNotEmptyException x) {
|
||||
throw x;
|
||||
} catch (IOException x) {
|
||||
// Backoff/retry in case another process is accessing the file
|
||||
times++;
|
||||
if (ioe == null) {
|
||||
ioe = x;
|
||||
} else {
|
||||
ioe.addSuppressed(x);
|
||||
}
|
||||
|
||||
if (times > MAX_RETRY_DELETE_TIMES) {
|
||||
throw ioe;
|
||||
}
|
||||
Thread.sleep(RETRY_DELETE_MILLIS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a directory and its subdirectories, retrying if necessary.
|
||||
*
|
||||
* @param dir the directory to delete
|
||||
*
|
||||
* @throws IOException
|
||||
* If an I/O error occurs. Any such exceptions are caught
|
||||
* internally. If only one is caught, then it is re-thrown.
|
||||
* If more than one exception is caught, then the second and
|
||||
* following exceptions are added as suppressed exceptions of the
|
||||
* first one caught, which is then re-thrown.
|
||||
*/
|
||||
public static void deleteFileTreeWithRetry(Path dir) throws IOException {
|
||||
IOException ioe = null;
|
||||
final List<IOException> excs = deleteFileTreeUnchecked(dir);
|
||||
if (!excs.isEmpty()) {
|
||||
ioe = excs.remove(0);
|
||||
for (IOException x : excs) {
|
||||
ioe.addSuppressed(x);
|
||||
}
|
||||
}
|
||||
if (ioe != null) {
|
||||
throw ioe;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<IOException> deleteFileTreeUnchecked(Path dir) {
|
||||
final List<IOException> excs = new ArrayList<>();
|
||||
try {
|
||||
java.nio.file.Files.walkFileTree(dir, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
try {
|
||||
deleteFileWithRetry0(file);
|
||||
} catch (IOException x) {
|
||||
excs.add(x);
|
||||
} catch (InterruptedException x) {
|
||||
excs.add(new IOException("Interrupted while deleting.", x));
|
||||
return FileVisitResult.TERMINATE;
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
|
||||
try {
|
||||
deleteFileWithRetry0(dir);
|
||||
} catch (IOException x) {
|
||||
excs.add(x);
|
||||
} catch (InterruptedException x) {
|
||||
excs.add(new IOException("Interrupted while deleting.", x));
|
||||
return FileVisitResult.TERMINATE;
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
@Override
|
||||
public FileVisitResult visitFileFailed(Path file, IOException exc) {
|
||||
excs.add(exc);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
} catch (IOException x) {
|
||||
excs.add(x);
|
||||
}
|
||||
return excs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether all file systems are accessible. This is performed
|
||||
* by checking free disk space on all mounted file systems via a
|
||||
* separate, spawned process. File systems are considered to be
|
||||
* accessible if this process completes successfully before a given
|
||||
* fixed duration has elapsed.
|
||||
*
|
||||
* @implNote On Unix this executes the {@code df} command in a separate
|
||||
* process and on Windows always returns {@code true}.
|
||||
*/
|
||||
public static boolean areFileSystemsAccessible() throws IOException {
|
||||
boolean areFileSystemsAccessible = true;
|
||||
if (!IS_WINDOWS) {
|
||||
// try to check whether 'df' hangs
|
||||
System.out.println("\n--- df output ---");
|
||||
System.out.flush();
|
||||
Process proc = new ProcessBuilder("df").inheritIO().start();
|
||||
try {
|
||||
proc.waitFor(90, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
try {
|
||||
int exitValue = proc.exitValue();
|
||||
if (exitValue != 0) {
|
||||
System.err.printf("df process exited with %d != 0%n",
|
||||
exitValue);
|
||||
areFileSystemsAccessible = false;
|
||||
}
|
||||
} catch (IllegalThreadStateException ignored) {
|
||||
System.err.println("df command apparently hung");
|
||||
areFileSystemsAccessible = false;
|
||||
}
|
||||
}
|
||||
return areFileSystemsAccessible;
|
||||
}
|
||||
}
|
148
test/lib/jdk/test/lib/util/JarUtils.java
Normal file
148
test/lib/jdk/test/lib/util/JarUtils.java
Normal file
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.test.lib.util;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* Common library for various test jar file utility functions.
|
||||
*/
|
||||
public final class JarUtils {
|
||||
|
||||
/**
|
||||
* Create jar file with specified files. If a specified file does not exist,
|
||||
* a new jar entry will be created with the file name itself as the content.
|
||||
*/
|
||||
public static void createJar(String dest, String... files)
|
||||
throws IOException {
|
||||
try (JarOutputStream jos = new JarOutputStream(
|
||||
new FileOutputStream(dest), new Manifest())) {
|
||||
for (String file : files) {
|
||||
System.out.println(String.format("Adding %s to %s",
|
||||
file, dest));
|
||||
|
||||
// add an archive entry, and write a file
|
||||
jos.putNextEntry(new JarEntry(file));
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
fis.transferTo(jos);
|
||||
} catch (FileNotFoundException e) {
|
||||
jos.write(file.getBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or remove specified files to existing jar file. If a specified file
|
||||
* to be updated or added does not exist, the jar entry will be created
|
||||
* with the file name itself as the content.
|
||||
*
|
||||
* @param src the original jar file name
|
||||
* @param dest the new jar file name
|
||||
* @param files the files to update. The list is broken into 2 groups
|
||||
* by a "-" string. The files before in the 1st group will
|
||||
* be either updated or added. The files in the 2nd group
|
||||
* will be removed. If no "-" exists, all files belong to
|
||||
* the 1st group.
|
||||
*/
|
||||
public static void updateJar(String src, String dest, String... files)
|
||||
throws IOException {
|
||||
try (JarOutputStream jos = new JarOutputStream(
|
||||
new FileOutputStream(dest))) {
|
||||
|
||||
// copy each old entry into destination unless the entry name
|
||||
// is in the updated list
|
||||
List<String> updatedFiles = new ArrayList<>();
|
||||
try (JarFile srcJarFile = new JarFile(src)) {
|
||||
Enumeration<JarEntry> entries = srcJarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry entry = entries.nextElement();
|
||||
String name = entry.getName();
|
||||
boolean found = false;
|
||||
boolean update = true;
|
||||
for (String file : files) {
|
||||
if (file.equals("-")) {
|
||||
update = false;
|
||||
} else if (name.equals(file)) {
|
||||
updatedFiles.add(file);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (update) {
|
||||
System.out.println(String.format("Updating %s with %s",
|
||||
dest, name));
|
||||
jos.putNextEntry(new JarEntry(name));
|
||||
try (FileInputStream fis = new FileInputStream(name)) {
|
||||
fis.transferTo(jos);
|
||||
} catch (FileNotFoundException e) {
|
||||
jos.write(name.getBytes());
|
||||
}
|
||||
} else {
|
||||
System.out.println(String.format("Removing %s from %s",
|
||||
name, dest));
|
||||
}
|
||||
} else {
|
||||
System.out.println(String.format("Copying %s to %s",
|
||||
name, dest));
|
||||
jos.putNextEntry(entry);
|
||||
srcJarFile.getInputStream(entry).transferTo(jos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// append new files
|
||||
for (String file : files) {
|
||||
if (file.equals("-")) {
|
||||
break;
|
||||
}
|
||||
if (!updatedFiles.contains(file)) {
|
||||
System.out.println(String.format("Adding %s with %s",
|
||||
dest, file));
|
||||
jos.putNextEntry(new JarEntry(file));
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
fis.transferTo(jos);
|
||||
} catch (FileNotFoundException e) {
|
||||
jos.write(file.getBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user