Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8213214: Set -Djava.io.tmpdir= when running tests
Reviewed-by: alanb, mikael
  • Loading branch information
erikj79 committed Jun 23, 2020
1 parent 2765410 commit d8219d0a78ca860557385c16f97334b35c4131e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
@@ -849,10 +849,14 @@ define SetupRunJtregTestBody
$1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
endif

# Make sure the tmp dir is normalized as some tests will react badly otherwise
$1_TEST_TMP_DIR := $$(abspath $$($1_TEST_SUPPORT_DIR)/tmp)

$1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
-verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
-concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
-vmoption:-Djava.io.tmpdir="$$($1_TEST_TMP_DIR)"

$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet

@@ -968,7 +972,8 @@ define SetupRunJtregTestBody
run-test-$1: pre-run-test clean-workdir-$1 $$($1_AOT_TARGETS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR) \
$$($1_TEST_TMP_DIR))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, ( \
$$(COV_ENVIRONMENT) $$($1_COMMAND_LINE) \
))
@@ -120,8 +120,22 @@ static void testToRealPath(Path dir) throws IOException {
* Test: toRealPath() should resolve links
*/
if (supportsLinks) {
Files.createSymbolicLink(link, file.toAbsolutePath());
assertTrue(link.toRealPath().equals(file.toRealPath()));
Path resolvedFile = file;
if (isWindows) {
// Path::toRealPath does not work with environments using the
// legacy subst mechanism. This is a workaround to keep the
// test working if 'dir' points to a location on a subst drive.
// See JDK-8213216.
//
Path tempLink = dir.resolve("tempLink");
Files.createSymbolicLink(tempLink, dir.toAbsolutePath());
Path resolvedDir = tempLink.toRealPath();
Files.delete(tempLink);
resolvedFile = resolvedDir.resolve(file.getFileName());
}

Files.createSymbolicLink(link, resolvedFile.toAbsolutePath());
assertTrue(link.toRealPath().equals(resolvedFile.toRealPath()));
Files.delete(link);
}

0 comments on commit d8219d0

Please sign in to comment.