diff --git a/jdk/test/tools/launcher/DefaultLocaleTestRun.java b/jdk/test/tools/launcher/DefaultLocaleTestRun.java index d3c08421e4f..a33bf3478c7 100644 --- a/jdk/test/tools/launcher/DefaultLocaleTestRun.java +++ b/jdk/test/tools/launcher/DefaultLocaleTestRun.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, 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 @@ -34,7 +34,6 @@ * @compile -XDignore.symbol.file DefaultLocaleTest.java TestHelper.java * @run main DefaultLocaleTestRun */ -import java.io.File; public class DefaultLocaleTestRun { public static void main(String... args) { @@ -43,11 +42,13 @@ public class DefaultLocaleTestRun { return; } TestHelper.TestResult tr = null; - tr = TestHelper.doExec(TestHelper.javaCmd, "DefaultLocaleTest", "-w", - "x.out"); + tr = TestHelper.doExec(TestHelper.javaCmd, + "-cp", TestHelper.TEST_CLASSES_DIR.getAbsolutePath(), + "DefaultLocaleTest", "-w", "x.out"); System.out.println(tr.testOutput); - tr = TestHelper.doExec(TestHelper.javawCmd, "DefaultLocaleTest", "-r", - "x.out"); + tr = TestHelper.doExec(TestHelper.javawCmd, + "-cp", TestHelper.TEST_CLASSES_DIR.getAbsolutePath(), + "DefaultLocaleTest", "-r", "x.out"); System.out.println(tr.testOutput); if (!tr.isOK()) { throw new RuntimeException("Test failed"); diff --git a/jdk/test/tools/launcher/TestHelper.java b/jdk/test/tools/launcher/TestHelper.java index c0f1119554c..de8f3f7f682 100644 --- a/jdk/test/tools/launcher/TestHelper.java +++ b/jdk/test/tools/launcher/TestHelper.java @@ -47,6 +47,10 @@ import static java.nio.file.StandardCopyOption.*; */ public enum TestHelper { INSTANCE; + // commonly used jtreg constants + static final File TEST_CLASSES_DIR; + static final File TEST_SOURCES_DIR; + static final String JAVAHOME = System.getProperty("java.home"); static final boolean isSDK = JAVAHOME.endsWith("jre"); static final String javaCmd; @@ -76,6 +80,18 @@ public enum TestHelper { static int testExitValue = 0; static { + String tmp = System.getProperty("test.classes", null); + if (tmp == null) { + throw new Error("property test.classes not defined ??"); + } + TEST_CLASSES_DIR = new File(tmp).getAbsoluteFile(); + + tmp = System.getProperty("test.src", null); + if (tmp == null) { + throw new Error("property test.src not defined ??"); + } + TEST_SOURCES_DIR = new File(tmp).getAbsoluteFile(); + if (is64Bit && is32Bit) { throw new RuntimeException("arch model cannot be both 32 and 64 bit"); }