Skip to content

Commit

Permalink
7903741: some test properties are not documented
Browse files Browse the repository at this point in the history
Reviewed-by: iris
  • Loading branch information
jonathan-gibbons committed Jun 7, 2024
1 parent 826400c commit 2e57b47
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,8 @@ Map<String, String> getTestProperties() {
p.put("test.classes", locations.absTestClsDir().toString());
p.put("test.class.path", toString(locations.absTestClsPath()));
if (getExecMode() == ExecMode.AGENTVM) {
// The following will be added to javac.class.path on the test VM
// The following will be added to java.class.path on the test VM
// and is not for general use
SearchPath path = new SearchPath()
.append(locations.absTestClsDir())
.append(locations.absTestSrcDir())
Expand Down
28 changes: 26 additions & 2 deletions src/share/doc/javatest/regtest/tag-spec.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<!--
Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2024, 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
Expand Down Expand Up @@ -1228,7 +1228,8 @@ <h2 class="appendix" id="testvars">APPENDIX 2: TEST-SPECIFIC SYSTEM PROPERTIES a
<p>The system properties in the following table will be set
while executing any class specified in an action tag;
the environment variables will be set while executing a shell
action tag.
action tag. Recently added values may not be available
in environment variables.

<table>
<caption>Test-specific system properties and environment variables</caption>
Expand All @@ -1239,6 +1240,13 @@ <h2 class="appendix" id="testvars">APPENDIX 2: TEST-SPECIFIC SYSTEM PROPERTIES a
<td><code>TESTFILE</code>
<td>The defining file of the test

<tr>
<td><code>test.name</code>
<td><i>Not Available</i>
<td>The name of the test, as a relative URL formed from the defining file
of the test and any corresponding id if the file contains multiple separate
test descriptions.

<tr>
<td><code>test.src</code>
<td><code>TESTSRC</code>
Expand Down Expand Up @@ -1313,6 +1321,17 @@ <h2 class="appendix" id="testvars">APPENDIX 2: TEST-SPECIFIC SYSTEM PROPERTIES a
will be unset or empty, if the version of JDK used to run the tests does not
support modules.

<tr>
<td><code>test.module.path</code>
<td><i>Not Available</i>
<td>The path for any library modules used by the test.

<tr>
<td><code>test.patch.path</code>
<td><i>Not Available</i>
<td>The path for tests that are written as a patch for
a system module.

<tr>
<td><code>test.root</code>
<td><code>TESTROOT</code>
Expand All @@ -1326,6 +1345,11 @@ <h2 class="appendix" id="testvars">APPENDIX 2: TEST-SPECIFIC SYSTEM PROPERTIES a
as indicated by <code>@enablePreview</code> in the test description
or an <code>enablePreview</code> entry in a TEST.properties file.

<tr>
<td><code>test.verbose</code>
<td><i>Not Available</i>
<td>The cumulative value of any command-line "verbose" options.

<tr>
<td><code>test.query</code>
<td><code>TESTQUERY</code>
Expand Down
54 changes: 54 additions & 0 deletions test/tag-spec/TestTagSpec.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# Copyright (c) 2024, 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#

#----------------------------------------------------------------------
#
# checks that the env vars and system properties given to tests
# are documented in tag-spec.html, and vice-versa

$(BUILDTESTDIR)/TestTagSpec_env.ok: \
$(JTREG_TAGSPEC) \
$(JAVAFILES.com.sun.javatest.regtest-tools)
$(GREP) -oh '.put("TEST[^"]*' $(JAVAFILES.com.sun.javatest.regtest-tools) | \
$(SED) -e 's/.*"//' | $(SORT) -u > $(@:%.ok=%.src)
$(GREP) -o '<code>TEST[^<]*</code>' $(JTREG_TAGSPEC) | \
$(SED) -e 's/<[^>]*>//g' | $(SORT) -u > $(@:%.ok=%.spec)
$(DIFF) $(@:%.ok=%.src) $(@:%.ok=%.spec)
echo "test passed at `date`" > $@

$(BUILDTESTDIR)/TestTagSpec_sysProps.ok: \
$(JTREG_TAGSPEC) \
$(JAVAFILES.com.sun.javatest.regtest-tools)
$(GREP) -oh '\(.put(\|put(map, \)"test.[^"]*' $(JAVAFILES.com.sun.javatest.regtest-tools) | \
$(GREP) -v "test.class.path.prefix" | \
$(SED) -e 's/.*"//' | $(SORT) -u > $(@:%.ok=%.src)
$(GREP) -o '<code>test[^<]*</code>' $(JTREG_TAGSPEC) | \
$(SED) -e 's/<[^>]*>//g' | $(SORT) -u > $(@:%.ok=%.spec)
$(DIFF) $(@:%.ok=%.src) $(@:%.ok=%.spec)
echo "test passed at `date`" > $@

TESTS.jtreg += \
$(BUILDTESTDIR)/TestTagSpec_env.ok \
$(BUILDTESTDIR)/TestTagSpec_sysProps.ok

0 comments on commit 2e57b47

Please sign in to comment.