8219158: use 'test.root' property instead of traversing test-src path

Reviewed-by: dholmes
This commit is contained in:
Igor Ignatyev 2019-02-22 11:07:18 -08:00
parent 24c70fcf88
commit b88c7ac223
5 changed files with 41 additions and 64 deletions
test
hotspot/jtreg/vmTestbase
gc/g1/unloading
nsk/monitoring/stress/classload
vm
mlvm/share
runtime/defmeth/shared
lib/jdk/test/lib

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2019, 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
@ -35,12 +35,13 @@ import java.nio.file.Paths;
*/
public class GenClassesBuilder {
public static void main(String[] args) {
Path template = testRoot().resolve("vmTestbase")
.resolve("gc")
.resolve("g1")
.resolve("unloading")
.resolve("ClassNNN.java.template")
.toAbsolutePath();
Path template = Paths.get(Utils.TEST_ROOT)
.resolve("vmTestbase")
.resolve("gc")
.resolve("g1")
.resolve("unloading")
.resolve("ClassNNN.java.template")
.toAbsolutePath();
Path dir = Paths.get(".").toAbsolutePath();
String count = "1000";
if (Files.notExists(template)) {
@ -52,14 +53,6 @@ public class GenClassesBuilder {
throw new Error("can't generate classPool.jar", e);
}
}
private static Path testRoot() {
Path p = Paths.get(Utils.TEST_SRC);
while (!Files.exists(p.resolve("TEST.ROOT"))) {
p = p.getParent();
}
return p;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2019, 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
@ -79,12 +79,13 @@ public class GenClassesBuilder {
} catch (IOException e) {
throw new Error("can't create dirs for" + dir, e);
}
Path pattern = testRoot().resolve("vmTestbase")
.resolve("nsk")
.resolve("monitoring")
.resolve("share")
.resolve("LoadableClass.pattern")
.toAbsolutePath();
Path pattern = Paths.get(Utils.TEST_ROOT)
.resolve("vmTestbase")
.resolve("nsk")
.resolve("monitoring")
.resolve("share")
.resolve("LoadableClass.pattern")
.toAbsolutePath();
if (Files.notExists(pattern)) {
throw new Error("can't find pattern file: " + pattern);
}
@ -94,13 +95,5 @@ public class GenClassesBuilder {
throw new Error("can't generate classes", e);
}
}
private static Path testRoot() {
Path p = Paths.get(Utils.TEST_SRC);
while (!Files.exists(p.resolve("TEST.ROOT"))) {
p = p.getParent();
}
return p;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, 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
@ -38,7 +38,7 @@ import java.util.stream.Stream;
public class StratumClassesBuilder {
public static void main(String[] args) {
Path root = testRoot();
Path root = Paths.get(Utils.TEST_ROOT);
Arrays.stream(args)
.map(root::resolve)
.forEach(StratumClassesBuilder::build);
@ -113,12 +113,4 @@ public class StratumClassesBuilder {
return file.getParent()
.resolve(filename.replaceFirst("\\.class$", ".smap"));
}
private static Path testRoot() {
Path p = Paths.get(Utils.TEST_SRC);
while (!Files.exists(p.resolve("TEST.ROOT"))) {
p = p.getParent();
}
return p;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2019, 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
@ -41,13 +41,14 @@ import java.util.Arrays;
*/
public class BuildJar {
public static void main(String[] args) {
Path manifest = testRoot().resolve("vmTestbase")
.resolve("vm")
.resolve("runtime")
.resolve("defmeth")
.resolve("shared")
.resolve("retransform.mf")
.toAbsolutePath();
Path manifest = Paths.get(Utils.TEST_ROOT)
.resolve("vmTestbase")
.resolve("vm")
.resolve("runtime")
.resolve("defmeth")
.resolve("shared")
.resolve("retransform.mf")
.toAbsolutePath();
if (Files.notExists(manifest)) {
throw new Error("can't find manifest file: " + manifest);
}
@ -90,13 +91,5 @@ public class BuildJar {
}
throw new Error("can't find " + file + " in " + Utils.TEST_CLASS_PATH);
}
private static Path testRoot() {
Path p = Paths.get(Utils.TEST_SRC);
while (!Files.exists(p.resolve("TEST.ROOT"))) {
p = p.getParent();
}
return p;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2019, 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
@ -88,6 +88,11 @@ public final class Utils {
*/
public static final String TEST_SRC = System.getProperty("test.src", "").trim();
/**
* Returns the value of 'test.root' system property.
*/
public static final String TEST_ROOT = System.getProperty("test.root", "").trim();
/*
* Returns the value of 'test.jdk' system property
*/
@ -96,12 +101,13 @@ public final class Utils {
/*
* Returns the value of 'compile.jdk' system property
*/
public static final String COMPILE_JDK= System.getProperty("compile.jdk", TEST_JDK);
public static final String COMPILE_JDK = System.getProperty("compile.jdk", TEST_JDK);
/**
* Returns the value of 'test.classes' system property
*/
public static final String TEST_CLASSES = System.getProperty("test.classes", ".");
/**
* Defines property name for seed value.
*/
@ -118,9 +124,9 @@ public final class Utils {
*/
public static final long SEED = Long.getLong(SEED_PROPERTY_NAME, new Random().nextLong());
/**
* Returns the value of 'test.timeout.factor' system property
* converted to {@code double}.
*/
* Returns the value of 'test.timeout.factor' system property
* converted to {@code double}.
*/
public static final double TIMEOUT_FACTOR;
static {
String toFactor = System.getProperty("test.timeout.factor", "1.0");
@ -128,9 +134,9 @@ public final class Utils {
}
/**
* Returns the value of JTREG default test timeout in milliseconds
* converted to {@code long}.
*/
* Returns the value of JTREG default test timeout in milliseconds
* converted to {@code long}.
*/
public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
private Utils() {