Skip to main content
Sign in
Snippets Groups Projects
Commit 084f0b75 authored by Goetz Lindenmaier's avatar Goetz Lindenmaier
Browse files

8216265: [testbug] Introduce Platform.sharedLibraryPathVariableName() and adapt all tests

Also cleanup some switches over OSes and use File.pathSeparator.

Reviewed-by: dholmes, mdoerr
parent 2a932824
Branches
Tags
No related merge requests found
Showing
with 48 additions and 81 deletions
/*
* Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
......@@ -34,6 +34,7 @@ import java.util.Map;
import java.util.stream.Stream;
import java.util.stream.Collectors;
import java.io.File;
import java.nio.file.Paths;
import java.nio.file.Path;
......@@ -69,14 +70,10 @@ public class GTestWrapper {
// may have set LD_LIBRARY_PATH or LIBPATH to point to the jdk libjvm. In
// that case, prepend the path with the location of the gtest library."
String ldLibraryPath = System.getenv("LD_LIBRARY_PATH");
String pathVar = Platform.sharedLibraryPathVariableName();
String ldLibraryPath = System.getenv(pathVar);
if (ldLibraryPath != null) {
env.put("LD_LIBRARY_PATH", path + ":" + ldLibraryPath);
}
String libPath = System.getenv("LIBPATH");
if (libPath != null) {
env.put("LIBPATH", path + ":" + libPath);
env.put(pathVar, path + File.pathSeparator + ldLibraryPath);
}
pb.command(new String[] {
......
......
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
......@@ -68,8 +68,7 @@ public class SigTestDriver {
Path test = Paths.get(System.getProperty("test.nativepath"))
.resolve("sigtest")
.toAbsolutePath();
String envVar = Platform.isWindows() ? "PATH" :
(Platform.isOSX() ? "DYLD_LIBRARY_PATH" : "LD_LIBRARY_PATH");
String envVar = Platform.sharedLibraryPathVariableName();
List<String> cmd = new ArrayList<>();
Collections.addAll(cmd,
......
......
/*
* 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
......@@ -103,7 +103,7 @@ public class ExecDriver {
if (launcher) {
Path dir = Paths.get(Utils.TEST_JDK);
String value;
String name;
String name = Platform.sharedLibraryPathVariableName();
if (Platform.isWindows()) {
value = dir.resolve("bin")
.resolve(variant())
......@@ -113,13 +113,11 @@ public class ExecDriver {
value += dir.resolve("bin")
.toAbsolutePath()
.toString();
name = "PATH";
} else {
value = dir.resolve("lib")
.resolve(variant())
.toAbsolutePath()
.toString();
name = Platform.isOSX() ? "DYLD_LIBRARY_PATH" : "LD_LIBRARY_PATH";
}
System.out.println(" with " + name + " = " +
......
......
......@@ -77,17 +77,7 @@ public class TestDriver {
nsk.jvmti.RetransformClasses.retransform003.class.getName()
);
String envName;
if (Platform.isWindows()) {
envName = "PATH";
} else if (Platform.isOSX()) {
envName = "DYLD_LIBRARY_PATH";
} else if (Platform.isAix()) {
envName = "LIBPATH";
} else {
envName = "LD_LIBRARY_PATH";
}
String envName = Platform.sharedLibraryPathVariableName();
pb.environment()
.merge(envName, ".", (x, y) -> y + File.pathSeparator + x);
......
......
......@@ -67,17 +67,7 @@ public class TestDriver {
nsk.jvmti.SetNativeMethodPrefix.SetNativeMethodPrefix002.class.getName()
);
String envName;
if (Platform.isWindows()) {
envName = "PATH";
} else if (Platform.isOSX()) {
envName = "DYLD_LIBRARY_PATH";
} else if (Platform.isAix()) {
envName = "LIBPATH";
} else {
envName = "LD_LIBRARY_PATH";
}
String envName = Platform.sharedLibraryPathVariableName();
pb.environment()
.merge(envName, ".", (x, y) -> y + File.pathSeparator + x);
......
......
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
......@@ -33,10 +33,12 @@
* @run main/othervm PrivateTransportTest
*/
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.process.ProcessTools;
import java.io.IOException;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
......@@ -71,17 +73,8 @@ public class PrivateTransportTest {
}
transportLib = foundLib.get();
}
if (System.getProperty("os.name").startsWith("Windows")) {
pathSep = ";";
pathEnvVar = "PATH";
} else {
pathSep = ":";
if (System.getProperty("os.name").equals("AIX")) {
pathEnvVar = "LIBPATH";
} else {
pathEnvVar = "LD_LIBRARY_PATH";
}
}
pathEnvVar = Platform.sharedLibraryPathVariableName();
pathSep = File.pathSeparator;
}
private void test() throws Throwable {
......
......
/*
* 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
......@@ -67,7 +67,7 @@ public class InheritedChannelTest {
private static final String ARCH = System.getProperty("os.arch");
private static final String OS_ARCH = ARCH.equals("i386") ? "i586" : ARCH;
private static final Path LD_LIBRARY_PATH
private static final Path libraryPath
= Paths.get(System.getProperty("java.library.path"));
@DataProvider
......@@ -98,7 +98,8 @@ public class InheritedChannelTest {
@Test(dataProvider = "testCases")
public void test(String desc, List<String> opts) throws Throwable {
System.out.println("LD_LIBRARY_PATH=" + LD_LIBRARY_PATH);
String pathVar = Platform.sharedLibraryPathVariableName();
System.out.println(pathVar + "=" + libraryPath);
List<String> args = new ArrayList<>();
args.add(JDKToolFinder.getJDKTool("java"));
......@@ -111,9 +112,8 @@ public class InheritedChannelTest {
Map<String, String> env = pb.environment();
env.put("CLASSPATH", TEST_CLASSES);
env.put("LD_LIBRARY_PATH", LD_LIBRARY_PATH.toString());
env.put(pathVar, libraryPath.toString());
ProcessTools.executeCommand(pb)
.shouldHaveExitValue(0);
ProcessTools.executeCommand(pb).shouldHaveExitValue(0);
}
}
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS buffer overflow and underflow status when dealing with
* application data.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.base/sun.security.util
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS application data exchange using each of the supported
* cipher suites.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS engines closing using each of the supported
* cipher suites.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS engines handshake using each of the supported
* cipher suites.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS engines handshake using each of the supported
* cipher suites with replicated packets check.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -27,7 +27,7 @@
* @summary Testing DTLS engines handshake using each of the supported
* cipher suites with different maximum fragment length. Testing of
* MFLN extension.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -25,7 +25,7 @@
* @test
* @bug 8043758
* @summary Testing DTLS engines do not enable RC4 ciphers by default.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS engines re-handshaking using each of the supported
* cipher suites.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -27,7 +27,7 @@
* @summary Testing DTLS engines re-handshaking using each of the supported
* cipher suites with application data exchange before and after
* re-handshake and closing of the engines.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing that try to enable unsupported ciphers
* causes IllegalArgumentException.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* java.security.jgss/sun.security.jgss.krb5
* java.security.jgss/sun.security.krb5:+open
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS buffer overflow and underflow status when dealing with
* application data.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS application data exchange using each of the supported
* cipher suites.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
......@@ -26,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS engines closing using each of the supported
* cipher suites.
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon
* @library /sun/security/krb5/auto /javax/net/ssl/TLSCommon /test/lib
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.jgss.krb5
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment