mirror of
https://github.com/darlinghq/darling-openjdk.git
synced 2024-11-26 22:00:25 +00:00
8210112: remove jdk.testlibrary.ProcessTools
Reviewed-by: alanb, sspitsyn, jcbeyler
This commit is contained in:
parent
bd77f790c3
commit
21a0458422
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.cds
|
||||
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules jdk.compiler
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* jdk.jlink
|
||||
@ -39,7 +39,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
|
||||
public class AddModules {
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.cds
|
||||
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules jdk.compiler
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* jdk.jlink
|
||||
@ -39,7 +39,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
|
||||
public class AddOpens {
|
||||
|
||||
|
@ -39,7 +39,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.Asserts;
|
||||
|
||||
public class AddReads {
|
||||
|
@ -40,7 +40,6 @@ import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.Asserts;
|
||||
|
||||
public class ExportModule {
|
||||
|
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.cds
|
||||
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules jdk.compiler
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* jdk.jlink
|
||||
@ -41,7 +41,6 @@ import java.util.Arrays;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
|
||||
public class MainModuleOnly {
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.cds
|
||||
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules jdk.compiler
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* jdk.jlink
|
||||
@ -40,7 +40,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
|
||||
public class ModulePathAndCP {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
@ -21,18 +21,16 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/* @test
|
||||
* @bug 8147456
|
||||
* @summary Check that providing a non-existing -agentpath gives a proper error.
|
||||
* @author Sharath Ballal
|
||||
*
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* @build jdk.testlibrary.*
|
||||
* @build BadAgentPath
|
||||
* @run driver BadAgentPath
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2018, 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
|
||||
@ -37,12 +37,13 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import jdk.testlibrary.Utils;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/* @test
|
||||
* @bug 6306165 6432567
|
||||
* @summary Check that a bad handshake doesn't cause a debuggee to abort
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
*
|
||||
* @modules java.management
|
||||
* jdk.jdi
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
@ -21,8 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
/* @test
|
||||
@ -30,6 +30,7 @@ import jdk.testlibrary.Utils;
|
||||
* @summary Check that multiple -agentlib statements in command line fails
|
||||
*
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* @build jdk.testlibrary.*
|
||||
* @build DoubleAgentTest Exit0
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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,6 +26,7 @@
|
||||
* @summary Test that more than one debuggee cannot bind to same port
|
||||
* at the same time.
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
*
|
||||
* @modules java.management
|
||||
* jdk.jdi
|
||||
@ -44,7 +45,7 @@ import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
public class ExclusiveBind {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2018, 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
|
||||
@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
import static jdk.testlibrary.Asserts.assertFalse;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/*
|
||||
* @test NoLaunchOptionTest.java
|
||||
@ -32,6 +32,7 @@ import jdk.testlibrary.ProcessTools;
|
||||
* @author Tim Bell
|
||||
*
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
*
|
||||
* @run compile -g NoLaunchOptionTest.java
|
||||
* @build jdk.testlibrary.* VMConnection
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
@ -39,6 +39,7 @@ import com.sun.jdi.connect.IllegalConnectorArgumentsException;
|
||||
* @summary Unit test for ProcessAttachingConnector
|
||||
*
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* jdk.jdi
|
||||
* @build jdk.testlibrary.* ProcessAttachTest
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2018, 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
|
||||
@ -24,10 +24,10 @@
|
||||
/* @test
|
||||
* @bug 4997445
|
||||
* @summary Test that with server=y, when VM runs to System.exit() no error happens
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* jdk.jdi
|
||||
* @build jdk.testlibrary.* VMConnection RunToExit Exit0
|
||||
* @build VMConnection RunToExit Exit0
|
||||
* @run driver RunToExit
|
||||
*/
|
||||
import java.net.ServerSocket;
|
||||
@ -42,7 +42,7 @@ import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class RunToExit {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
@ -21,15 +21,14 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/* @test
|
||||
* @bug 4914611
|
||||
* @summary Test for JDWP: -agentlib:jdwp=suspend=n hanging
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* @build jdk.testlibrary.*
|
||||
* @compile -g HelloWorld.java
|
||||
* @run driver SuspendNoFlagTest
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -29,9 +29,8 @@
|
||||
* @modules jdk.jdi
|
||||
* java.management
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @library ..
|
||||
* @build jdk.testlibrary.*
|
||||
* @build TestScaffold VMConnection TargetListener TargetAdapter
|
||||
* @build CDSJDITest
|
||||
* @run compile -g ../BreakpointTest.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -29,9 +29,8 @@
|
||||
* @modules jdk.jdi
|
||||
* java.management
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @library ..
|
||||
* @build jdk.testlibrary.*
|
||||
* @build TestScaffold VMConnection TargetListener TargetAdapter
|
||||
* @build CDSJDITest
|
||||
* @run compile -g ../DeleteAllBkptsTest.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -29,9 +29,8 @@
|
||||
* @modules jdk.jdi
|
||||
* java.management
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @library ..
|
||||
* @build jdk.testlibrary.*
|
||||
* @build TestScaffold VMConnection TargetListener TargetAdapter
|
||||
* @build CDSJDITest
|
||||
* @run compile -g ../FieldWatchpoints.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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,8 +25,8 @@
|
||||
* Helper superclass for launching JDI tests out of the CDS archive.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
@ -27,10 +27,9 @@
|
||||
* @author Staffan Larsen
|
||||
* @comment Graal does not support CMS
|
||||
* @requires !vm.graal.enabled
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules jdk.attach/sun.tools.attach
|
||||
* jdk.management
|
||||
* @build jdk.testlibrary.*
|
||||
* @run main CheckOrigin
|
||||
*/
|
||||
|
||||
@ -44,7 +43,7 @@ import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Map;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import sun.tools.attach.HotSpotVirtualMachine;
|
||||
|
||||
public class CheckOrigin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2018, 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
|
||||
@ -29,7 +29,7 @@ import java.lang.management.*;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.test.lib.hprof.HprofParser;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
|
||||
|
@ -28,10 +28,8 @@
|
||||
* @author Steve Bohne
|
||||
* @author Jaroslav Bachorik
|
||||
*
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
*
|
||||
* @build TestTotalSwap jdk.testlibrary.*
|
||||
* @run main TestTotalSwap
|
||||
*/
|
||||
|
||||
@ -57,8 +55,8 @@ import com.sun.management.OperatingSystemMXBean;
|
||||
import java.lang.management.*;
|
||||
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class TestTotalSwap {
|
||||
|
||||
|
@ -29,8 +29,8 @@ import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import jdk.test.lib.thread.ProcessThread;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import com.sun.tools.attach.AgentInitializationException;
|
||||
import com.sun.tools.attach.AgentLoadException;
|
||||
|
@ -25,8 +25,8 @@ import com.sun.tools.attach.VirtualMachine;
|
||||
import com.sun.tools.attach.AttachNotSupportedException;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.thread.ProcessThread;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/*
|
||||
* @test
|
||||
|
@ -22,9 +22,8 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.JDKToolLauncher;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import com.sun.tools.attach.VirtualMachine;
|
||||
import com.sun.tools.attach.spi.AttachProvider;
|
||||
|
||||
|
@ -27,7 +27,7 @@ import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
|
||||
import jdk.test.lib.thread.ProcessThread;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
/*
|
||||
|
@ -46,7 +46,7 @@ import jdk.testlibrary.Utils;
|
||||
* jdk.attach
|
||||
* jdk.jartool/sun.tools.jar
|
||||
*
|
||||
* @run build Application SimpleProvider jdk.testlibrary.*
|
||||
* @run build jdk.testlibrary.* Application SimpleProvider jdk.testlibrary.*
|
||||
* @run main/timeout=300 StartManagementAgent
|
||||
*/
|
||||
|
||||
|
@ -30,8 +30,8 @@ import java.util.List;
|
||||
import java.io.File;
|
||||
|
||||
import jdk.test.lib.thread.ProcessThread;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/*
|
||||
* @test
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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,8 +25,7 @@
|
||||
* @bug 7129312
|
||||
* @summary BufferedInputStream calculates negative array size with large
|
||||
* streams and mark
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.*
|
||||
* @library /test/lib
|
||||
* @run main/othervm LargeCopyWithMark
|
||||
*/
|
||||
|
||||
@ -34,7 +33,7 @@ import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
|
||||
public class LargeCopyWithMark {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -31,7 +31,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import jdk.test.lib.util.FileUtils;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@ -41,12 +41,12 @@ import static org.testng.Assert.assertTrue;
|
||||
* @test
|
||||
* @bug 8087335
|
||||
* @summary Tests for Class.forName(Module,String)
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build jdk.test.lib.Platform
|
||||
* jdk.test.lib.util.FileUtils
|
||||
* jdk.test.lib.compiler.CompilerUtils
|
||||
* jdk.testlibrary.ProcessTools
|
||||
* jdk.test.lib.process.ProcessTools
|
||||
* TestDriver TestMain TestLayer
|
||||
* @run testng TestDriver
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -24,7 +24,7 @@
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
@ -33,9 +33,9 @@ import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build ResourcesTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
|
||||
* @build ResourcesTest jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng ResourcesTest
|
||||
* @summary Driver for basic test of Class getResource and getResourceAsStream
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -24,11 +24,11 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8060206 8067366
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @summary Endorsed standards and override mechanism is removed
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -24,11 +24,11 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8060206 8067366
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @summary Extension mechanism is removed
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import java.lang.Integer;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2018, 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,8 +26,7 @@
|
||||
* @bug 4273031
|
||||
* @summary ClassLoader.getResouce() should be able to
|
||||
* find resources with leading "." in their names
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.*
|
||||
* @library /test/lib
|
||||
* @run main GetDotResource
|
||||
*/
|
||||
|
||||
@ -37,7 +36,7 @@ import java.io.IOException;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class GetDotResource {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -24,8 +24,8 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8060130
|
||||
* @library /lib/testlibrary
|
||||
* @build package2.Class2 GetSystemPackage jdk.testlibrary.*
|
||||
* @library /test/lib
|
||||
* @build package2.Class2 GetSystemPackage
|
||||
* @summary Test if getSystemPackage() return consistent values for cases
|
||||
* where a manifest is provided or not and ensure only jars on
|
||||
* bootclasspath gets resolved via Package.getSystemPackage
|
||||
@ -41,7 +41,7 @@ import java.util.jar.Attributes;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class GetSystemPackage {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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,8 @@
|
||||
* @test
|
||||
* @bug 6760902
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.ProcessTools
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.process.ProcessTools
|
||||
* @run testng GetResource
|
||||
* @summary Empty path on bootclasspath is not default to current working
|
||||
* directory for both class lookup and resource lookup whereas
|
||||
@ -45,7 +46,7 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -23,8 +23,8 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary
|
||||
* @build Driver Main JarUtils jdk.testlibrary.ProcessTools
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @build Driver Main JarUtils
|
||||
* @run main Driver
|
||||
* @summary Test ClassLoader.getResourceXXX to locate resources in an automatic
|
||||
* module
|
||||
@ -38,7 +38,7 @@ import java.nio.file.Paths;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/**
|
||||
* The driver creates a JAR file containing p/Foo.class, p/foo.properties,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -24,7 +24,7 @@
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
@ -34,9 +34,9 @@ import static org.testng.Assert.*;
|
||||
/**
|
||||
* @test
|
||||
* @bug 8087335
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build ResourcesTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
|
||||
* @build ResourcesTest jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng ResourcesTest
|
||||
* @summary Driver for basic test of ClassLoader getResource and getResourceAsStream
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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,6 +27,7 @@
|
||||
* @summary Different types of ClassLoader running with(out) SecurityManager and
|
||||
* (in)valid security policy file.
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.module
|
||||
* @build JarUtils
|
||||
* @build TestClassLoader TestClient
|
||||
@ -49,7 +50,7 @@ import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import jdk.internal.module.ModuleInfoWriter;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class ClassLoaderTest {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -35,9 +35,9 @@ import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build AccessTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
|
||||
* @build AccessTest jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng AccessTest
|
||||
* @summary Driver for test that checks access to access to types in
|
||||
* exported and non-exported packages.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
@ -24,16 +24,15 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8154017
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.*
|
||||
* @library /test/lib
|
||||
* @summary Shutdown hooks are racing against shutdown sequence,
|
||||
if System.exit()-calling thread is interrupted
|
||||
* @run main ShutdownInterruptedMain exec
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import static jdk.testlibrary.ProcessTools.createJavaProcessBuilder;
|
||||
import static jdk.testlibrary.ProcessTools.executeProcess;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder;
|
||||
import static jdk.test.lib.process.ProcessTools.executeProcess;
|
||||
|
||||
public class ShutdownInterruptedMain {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -24,14 +24,13 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8140450
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.*
|
||||
* @library /test/lib
|
||||
* @summary Test if the getCallerClass method returns empty optional
|
||||
* @run main CallerFromMain exec
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CallerFromMain {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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,7 +35,7 @@ import java.util.stream.Stream;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
import static jdk.test.lib.process.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* Base class for tests.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -23,19 +23,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @modules jdk.compiler
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -23,19 +23,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @modules java.logging
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -23,19 +23,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @modules jdk.compiler
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -24,17 +24,6 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -24,17 +24,6 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -24,17 +24,6 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -24,17 +24,6 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
|
||||
/*
|
||||
* @test
|
||||
|
@ -22,16 +22,15 @@
|
||||
*/
|
||||
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8132374
|
||||
* @summary Check that the value of the os.version property is equal
|
||||
* to the value of the corresponding OS provided tools.
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @build jdk.test.lib.Platform
|
||||
* @library /test/lib
|
||||
* @run main OsVersionTest
|
||||
* @author Volker Simonis
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Goldman Sachs.
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -24,11 +24,11 @@
|
||||
/* @test
|
||||
* @bug 7142035
|
||||
* @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
*
|
||||
* @modules java.instrument
|
||||
* java.management
|
||||
* @build jdk.testlibrary.* DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
|
||||
* @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
|
||||
* @run shell ../MakeJAR3.sh DummyAgent
|
||||
* @run main/timeout=240 TestDaemonThreadLauncher
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Goldman Sachs.
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class TestDaemonThreadLauncher {
|
||||
public static void main(String args[]) throws Exception {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -21,8 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
/*
|
||||
@ -30,6 +30,7 @@ import jdk.testlibrary.Utils;
|
||||
* @bug 6289149
|
||||
* @summary test when the agent's class is missing the premain() function.
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* java.instrument
|
||||
* @run build jdk.testlibrary.* DummyMain
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -21,8 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
/*
|
||||
@ -30,6 +30,7 @@ import jdk.testlibrary.Utils;
|
||||
* @bug 5055293
|
||||
* @summary Test non ascii characters in the Premain-Class attribute.
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* @run build jdk.testlibrary.* DummyMain
|
||||
* @run main PremainClassTest
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -21,8 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
/*
|
||||
@ -30,6 +30,7 @@ import jdk.testlibrary.Utils;
|
||||
* @bug 6289149
|
||||
* @summary test when the agent's class has a zero arg premain() function.
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* java.instrument
|
||||
* @run build jdk.testlibrary.* DummyMain
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -24,6 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @build ExecJarWithAgent Main Agent AgentHelper JarUtils jdk.testlibrary.*
|
||||
* @run testng ExecJarWithAgent
|
||||
* @summary Test starting agents in executable JAR files
|
||||
@ -38,8 +39,8 @@ import java.util.stream.Stream;
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
@Test
|
||||
public class ExecJarWithAgent {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
@ -24,14 +24,18 @@
|
||||
/**
|
||||
* @test
|
||||
* @bug 8169909
|
||||
* @library src /lib/testlibrary
|
||||
* @library src /test/lib
|
||||
* @build test/*
|
||||
* @run shell AppendToClassPathModuleTest.sh
|
||||
* @run main AppendToClassPathModuleTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.JDKToolFinder;
|
||||
|
||||
import java.util.Map;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
/**
|
||||
* Launch a modular test with no class path and no CLASSPATH set.
|
||||
@ -41,14 +45,17 @@ import static jdk.testlibrary.ProcessTools.*;
|
||||
public class AppendToClassPathModuleTest {
|
||||
public static void main(String... args) throws Throwable {
|
||||
String modulepath = System.getProperty("test.module.path");
|
||||
ProcessBuilder pb =
|
||||
createJavaProcessBuilder("-javaagent:Agent.jar",
|
||||
"--module-path", modulepath,
|
||||
"-m", "test/jdk.test.Main");
|
||||
|
||||
// remove CLASSPATH environment variable
|
||||
// can't use ProcessTools.createJavaProcessBuilder as it always adds -cp
|
||||
ProcessBuilder pb = new ProcessBuilder(
|
||||
JDKToolFinder.getTestJDKTool("java"),
|
||||
"-javaagent:Agent.jar",
|
||||
"--module-path", modulepath,
|
||||
"-m", "test/jdk.test.Main");
|
||||
|
||||
Map<String,String> env = pb.environment();
|
||||
String value = env.remove("CLASSPATH");
|
||||
// remove CLASSPATH environment variable
|
||||
env.remove("CLASSPATH");
|
||||
|
||||
int exitCode = executeCommand(pb).getExitValue();
|
||||
if (exitCode != 0) {
|
||||
|
@ -45,7 +45,7 @@ import java.util.*;
|
||||
import java.util.concurrent.Phaser;
|
||||
import javax.management.*;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -28,9 +28,9 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
public class RunUtil {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -30,7 +30,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -38,9 +38,9 @@ import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build ProxyClassAccessTest q.NP jdk.testlibrary.*
|
||||
* @build ProxyClassAccessTest q.NP
|
||||
* jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng ProxyClassAccessTest
|
||||
* @summary Driver for testing proxy class doesn't have access to
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -30,7 +30,7 @@ import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -38,9 +38,9 @@ import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build ProxyTest jdk.testlibrary.ProcessTools
|
||||
* @build ProxyTest jdk.test.lib.process.ProcessTools
|
||||
* jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng ProxyLayerTest
|
||||
* @summary Test proxies to implement interfaces in a layer
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -35,9 +35,9 @@ import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build ProxyTest q.U jdk.testlibrary.*
|
||||
* @build ProxyTest q.U
|
||||
* jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng ProxyTest
|
||||
* @summary Driver for testing proxies accessing interfaces in named modules
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, 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
|
||||
@ -24,8 +24,8 @@
|
||||
/**
|
||||
* @test
|
||||
* @modules jdk.jartool
|
||||
* @library /lib/testlibrary
|
||||
* @build SetDefaultProvider TestProvider m/* jdk.testlibrary.ProcessTools
|
||||
* @library /test/lib
|
||||
* @build SetDefaultProvider TestProvider m/* jdk.test.lib.process.ProcessTools
|
||||
* @run testng/othervm SetDefaultProvider
|
||||
* @summary Runs tests with -Djava.nio.file.spi.DefaultFileSystemProvider set on
|
||||
* the command line to override the default file system provider
|
||||
@ -38,7 +38,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.spi.ToolProvider;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
@ -24,13 +24,13 @@
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @build jdk.testlibrary.ProcessTools
|
||||
* @build jdk.test.lib.process.ProcessTools
|
||||
* ModuleTest jdk.test.lib.compiler.CompilerUtils JarUtils
|
||||
* @run testng ModuleTest
|
||||
* @summary Basic tests for using rmi in module world
|
||||
*/
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.util.JarUtils;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Base64;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import static java.lang.System.out;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
@ -37,6 +37,7 @@ import java.util.List;
|
||||
* @summary Test for PKCS12 keystore list , export commands. Refer README for
|
||||
* keystore files information
|
||||
* @library /lib/testlibrary ../
|
||||
* @library /test/lib
|
||||
* @run main KeytoolReaderP12Test
|
||||
*/
|
||||
public class KeytoolReaderP12Test {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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
|
||||
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import static java.lang.System.out;
|
||||
|
||||
/**
|
||||
@ -32,6 +32,7 @@ import static java.lang.System.out;
|
||||
* @bug 8048830
|
||||
* @summary Tests for creating pkcs12 keystore with various algorithms
|
||||
* @library /lib/testlibrary ../
|
||||
* @library /test/lib
|
||||
* @run main KeytoolWriteP12Test
|
||||
*/
|
||||
public class KeytoolWriteP12Test {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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
|
||||
@ -40,6 +40,7 @@ import static java.lang.System.out;
|
||||
* @bug 8048830
|
||||
* @summary Entry's attribute set should be empty
|
||||
* @library /lib/testlibrary ../
|
||||
* @library /test/lib
|
||||
* @run main MetadataEmptyTest
|
||||
*/
|
||||
public class MetadataEmptyTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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
|
||||
@ -44,6 +44,7 @@ import java.util.HashSet;
|
||||
* @bug 8048830
|
||||
* @summary Test store metadata attributes to PKCS12 keystore.
|
||||
* @library /lib/testlibrary ../
|
||||
* @library /test/lib
|
||||
* @run main MetadataStoreLoadTest
|
||||
*/
|
||||
public class MetadataStoreLoadTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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
|
||||
@ -43,6 +43,7 @@ import static java.lang.System.out;
|
||||
* trusted certificate Check import errors (must be not errors) & check keystore
|
||||
* content after import
|
||||
* @library /lib/testlibrary ../
|
||||
* @library /test/lib
|
||||
* @run main StoreTrustedCertAPITest
|
||||
*/
|
||||
public class StoreTrustedCertAPITest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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
|
||||
@ -30,7 +30,7 @@ import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import static java.lang.System.out;
|
||||
|
||||
/**
|
||||
@ -39,6 +39,7 @@ import static java.lang.System.out;
|
||||
* @summary Tests keytool command imports certificate , list keystore, print
|
||||
* certificate and import password help.
|
||||
* @library /lib/testlibrary ../
|
||||
* @library /test/lib
|
||||
* @run main StoreTrustedCertKeytool
|
||||
*/
|
||||
public class StoreTrustedCertKeytool {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2018, 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
|
||||
@ -32,8 +32,8 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
import static java.lang.System.out;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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,14 +26,14 @@ import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.AccessController;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.util.JarUtils;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8050402
|
||||
* @summary Check policy is extensible with user defined permissions
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.util.JarUtils
|
||||
* @compile TVJar/TVPermission.java
|
||||
* @run main ExtensiblePolicyWithJarTest
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -28,13 +28,13 @@ import java.security.AccessControlException;
|
||||
import java.security.AccessController;
|
||||
import java.security.Permission;
|
||||
import java.security.PrivilegedAction;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8048360
|
||||
* @summary test policy entry with signedBy alias
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @run main/othervm SignedJarTest
|
||||
*/
|
||||
public class SignedJarTest {
|
||||
|
@ -26,10 +26,9 @@
|
||||
* @bug 8072909
|
||||
* @summary Test TimSort stack size on big arrays
|
||||
* @key intermittent
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules java.management
|
||||
* java.base/jdk.internal
|
||||
* @build jdk.testlibrary.*
|
||||
* @build TimSortStackSize2
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
@ -41,9 +40,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
public class TimSortStackSize2 {
|
||||
|
@ -23,15 +23,15 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @bug 8189134
|
||||
* @summary Tests the system properties
|
||||
* @modules jdk.localedata
|
||||
* @build DefaultLocaleTest jdk.testlibrary.*
|
||||
* @build DefaultLocaleTest
|
||||
* @run testng/othervm SystemPropertyTests
|
||||
*/
|
||||
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
@ -24,19 +24,17 @@
|
||||
/**
|
||||
* @test
|
||||
* @bug 8170772
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build CacheTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
|
||||
* @build CacheTest jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng CacheTest
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -24,17 +24,17 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8177980
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build jdk.test.lib.compiler.CompilerUtils
|
||||
* jdk.testlibrary.ProcessTools CaseInsensitiveNameClash
|
||||
* jdk.test.lib.process.ProcessTools CaseInsensitiveNameClash
|
||||
* @run testng CaseInsensitiveNameClash
|
||||
*/
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.executeTestJava;
|
||||
import static jdk.test.lib.process.ProcessTools.executeTestJava;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -35,9 +35,9 @@ import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build TestPermission jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
|
||||
* @build TestPermission jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng TestPermission
|
||||
* @summary Driver for testing ResourceBundle::getBundle(String, Module)
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2018, 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 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import static jdk.testlibrary.Asserts.assertGreaterThan;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import com.sun.tools.attach.AttachNotSupportedException;
|
||||
import com.sun.tools.attach.VirtualMachine;
|
||||
@ -38,9 +38,10 @@ import sun.tools.attach.HotSpotVirtualMachine;
|
||||
* @bug 6942989
|
||||
* @summary Check for WeakReference leak in Logger and anonymous Logger objects
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules jdk.attach/sun.tools.attach
|
||||
* java.logging
|
||||
* @build jdk.testlibrary.ProcessTools
|
||||
* @build jdk.test.lib.process.ProcessTools
|
||||
* @run main/othervm -Djdk.attach.allowAttachSelf TestLoggerWeakRefLeak Logger
|
||||
* @run main/othervm -Djdk.attach.allowAttachSelf TestLoggerWeakRefLeak AnonymousLogger
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -29,17 +29,17 @@ import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8129126 8136802 8137316 8137317 8136804 8139350
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* java.logging
|
||||
* @build GetResourceBundleTest jdk.testlibrary.ProcessTools
|
||||
* @build GetResourceBundleTest jdk.test.lib.process.ProcessTools
|
||||
* jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng GetResourceBundleTest
|
||||
* @summary Tests Logger.getLogger + logger.getResourceBundle in an named/unnamed module,
|
||||
|
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @summary Test java.util.zip behavior with ~64k entries
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @run main/othervm EntryCount64k
|
||||
* @run main/othervm -Djdk.util.zip.inhibitZip64=true EntryCount64k
|
||||
* @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k
|
||||
@ -44,8 +44,8 @@ import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class EntryCount64k {
|
||||
public static class Main {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2018, 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
|
||||
@ -29,6 +29,7 @@
|
||||
* @author Olivier Lagneau
|
||||
* @modules java.management.rmi
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @compile Basic.java
|
||||
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest
|
||||
*/
|
||||
@ -58,7 +59,7 @@ import javax.management.openmbean.SimpleType;
|
||||
import javax.management.openmbean.TabularDataSupport;
|
||||
import javax.management.openmbean.TabularType;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
public class MXBeanWeirdParamTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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,6 +25,7 @@
|
||||
* @test
|
||||
* @bug 8159377
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @summary Tests ObjectFilter on default agent
|
||||
* @author Harsha Wardhana B
|
||||
* @modules java.management
|
||||
@ -54,7 +55,7 @@ import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.Utils;
|
||||
|
||||
public class DefaultAgentFilterTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
@ -28,6 +28,7 @@
|
||||
* @author Olivier Lagneau
|
||||
* @modules java.management.rmi
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @compile Simple.java
|
||||
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
|
||||
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username2 -Dpassword=password2 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedSetException -expectedInvokeException
|
||||
@ -64,7 +65,7 @@ import javax.management.remote.JMXServiceURL;
|
||||
import javax.management.Attribute ;
|
||||
import javax.management.ObjectName ;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
public class AuthorizationTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
@ -28,6 +28,7 @@
|
||||
* @author Olivier Lagneau
|
||||
* @modules java.management.rmi
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java
|
||||
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials
|
||||
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=UNKNOWN_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials -expectedThrowable java.lang.SecurityException
|
||||
@ -80,7 +81,7 @@ import javax.rmi.ssl.SslRMIServerSocketFactory;
|
||||
|
||||
import java.security.Security;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
|
||||
public class SecurityTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2018, 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,7 +41,7 @@ import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -50,7 +50,7 @@ import jdk.testlibrary.ProcessTools;
|
||||
* in case of nested Subject.doAs() invocations
|
||||
* when one of protection domains doesn't have permissions
|
||||
*
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
*
|
||||
* @run main NestedActions jar NestedActionsACE.jar
|
||||
* NestedActionsACE.class Utils.class
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @summary Basic test of VM::getRuntimeArguments
|
||||
* @library /lib/testlibrary
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* jdk.zipfs
|
||||
* @run testng RuntimeArguments
|
||||
@ -34,7 +34,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.internal.misc.VM;
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.*;
|
||||
|
@ -27,7 +27,7 @@
|
||||
* @modules jdk.compiler
|
||||
* jdk.jlink
|
||||
* jdk.zipfs
|
||||
* @library src /lib/testlibrary
|
||||
* @library src /test/lib
|
||||
* @build java.json/*
|
||||
* @run main DefaultModules
|
||||
* @summary Test that all modules that export an API are in the set of modules
|
||||
@ -37,13 +37,9 @@
|
||||
import java.io.PrintStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.util.spi.ToolProvider;
|
||||
|
||||
import jdk.testlibrary.ProcessTools;
|
||||
import jdk.testlibrary.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/**
|
||||
* This test compiles and runs the following tests on the class path:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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 8170859
|
||||
* @summary Ensure no incubator modules are resolved by default in the image
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng DefaultImage
|
||||
@ -47,7 +47,7 @@ import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
import static jdk.test.lib.process.ProcessTools.executeCommand;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
@Test
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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 8170859
|
||||
* @summary Basic test for incubator modules in jmods and images
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @key intermittent
|
||||
* @modules jdk.compiler jdk.jartool jdk.jlink
|
||||
* @build jdk.test.lib.Platform
|
||||
@ -54,7 +54,7 @@ import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static jdk.testlibrary.ProcessTools.executeCommand;
|
||||
import static jdk.test.lib.process.ProcessTools.executeCommand;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
public class ImageModules {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -28,7 +28,7 @@
|
||||
* java.scripting
|
||||
* jdk.zipfs
|
||||
* @build RunWithAutomaticModules jdk.test.lib.compiler.CompilerUtils JarUtils
|
||||
* jdk.testlibrary.ProcessTools
|
||||
* jdk.test.lib.process.ProcessTools
|
||||
* @run testng RunWithAutomaticModules
|
||||
* @summary Runs tests that make use of automatic modules
|
||||
*/
|
||||
@ -38,7 +38,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.*;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, 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
|
||||
@ -23,12 +23,12 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.jartool/sun.tools.jar
|
||||
* jdk.compiler
|
||||
* jdk.zipfs
|
||||
* java.se
|
||||
* @build ContainerTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
|
||||
* @build ContainerTest jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng ContainerTest
|
||||
* @summary Starts a simple container that uses dynamic configurations
|
||||
* and launches two applications in the same VM
|
||||
@ -39,7 +39,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -23,9 +23,9 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /lib/testlibrary /test/lib
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @build OverlappingPackagesTest jdk.testlibrary.*
|
||||
* @build OverlappingPackagesTest
|
||||
* jdk.test.lib.compiler.CompilerUtils
|
||||
* @run testng OverlappingPackagesTest
|
||||
* @summary Basic test to ensure that startup fails if two or more modules
|
||||
@ -38,7 +38,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.test.lib.compiler.CompilerUtils;
|
||||
import static jdk.testlibrary.ProcessTools.*;
|
||||
import static jdk.test.lib.process.ProcessTools.*;
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -21,18 +21,18 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.testlibrary;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Test the OutputAnalyzer reporting functionality,
|
||||
* such as printing additional diagnostic info
|
||||
* (exit code, stdout, stderr, command line, etc.)
|
||||
* @modules java.management
|
||||
* @build jdk.testlibrary.*
|
||||
* @run main jdk.testlibrary.OutputAnalyzerReportingTest
|
||||
* @library /test/lib
|
||||
* @run main OutputAnalyzerReportingTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -20,16 +20,17 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.testlibrary;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Test the OutputAnalyzer utility class
|
||||
* @modules java.management
|
||||
* @build jdk.testlibrary.*
|
||||
* @run main jdk.testlibrary.OutputAnalyzerTest
|
||||
* @library /test/lib
|
||||
* @run main OutputAnalyzerTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class OutputAnalyzerTest {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
@ -150,17 +151,23 @@ public class OutputAnalyzerTest {
|
||||
// expected
|
||||
}
|
||||
|
||||
if (output.shouldMatchByLine(byLinePattern) != 1) {
|
||||
throw new Exception("shouldMatchByLine() should find one line");
|
||||
try {
|
||||
output.shouldMatchByLine(byLinePattern);
|
||||
} catch (RuntimeException e) {
|
||||
throw new Exception("shouldMatchByLine() failed", e);
|
||||
}
|
||||
|
||||
try {
|
||||
output.shouldMatchByLine(nonExistingPattern);
|
||||
throw new Exception("shouldMatchByLine() failed to throw exception");
|
||||
} catch (RuntimeException e) {
|
||||
// expected
|
||||
}
|
||||
if (output.stdoutShouldMatchByLine(stdoutByLinePattern) != 1) {
|
||||
throw new Exception("stdoutShouldMatchByLine() should find one line");
|
||||
|
||||
try {
|
||||
output.stdoutShouldMatchByLine(stdoutByLinePattern);
|
||||
} catch (RuntimeException e) {
|
||||
throw new Exception("stdoutShouldMatchByLine() failed", e);
|
||||
}
|
||||
|
||||
// Should not match
|
||||
|
@ -1,577 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package jdk.testlibrary;
|
||||
|
||||
import static jdk.testlibrary.Asserts.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* Utility class for verifying output and exit value from a {@code Process}.
|
||||
*
|
||||
* @deprecated This class is deprecated. Use the one from
|
||||
* {@code <root>/test/lib/jdk/test/lib/process}
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public final class OutputAnalyzer {
|
||||
private final OutputBuffer output;
|
||||
private final String stdout;
|
||||
private final String stderr;
|
||||
private final int exitValue; // useless now. output contains exit value.
|
||||
|
||||
/**
|
||||
* Create an OutputAnalyzer, a utility class for verifying output and exit
|
||||
* value from a Process.
|
||||
* <p>
|
||||
* OutputAnalyzer should never be instantiated directly -
|
||||
* use {@linkplain ProcessTools#executeProcess(ProcessBuilder)} instead
|
||||
*
|
||||
* @param process
|
||||
* Process to analyze
|
||||
* @throws IOException
|
||||
* If an I/O error occurs.
|
||||
*/
|
||||
OutputAnalyzer(Process process) throws IOException {
|
||||
output = new OutputBuffer(process);
|
||||
exitValue = -1;
|
||||
this.stdout = null;
|
||||
this.stderr = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an OutputAnalyzer, a utility class for verifying output.
|
||||
*
|
||||
* @param buf
|
||||
* String buffer to analyze
|
||||
*/
|
||||
OutputAnalyzer(String buf) {
|
||||
this(buf, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an OutputAnalyzer, a utility class for verifying output
|
||||
*
|
||||
* @param stdout
|
||||
* stdout buffer to analyze
|
||||
* @param stderr
|
||||
* stderr buffer to analyze
|
||||
*/
|
||||
OutputAnalyzer(String stdout, String stderr) {
|
||||
this.output = null;
|
||||
this.stdout = stdout;
|
||||
this.stderr = stderr;
|
||||
exitValue = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout and stderr contents of output buffer contains the
|
||||
* string
|
||||
*
|
||||
* @param expectedString
|
||||
* String that buffer should contain
|
||||
* @throws RuntimeException
|
||||
* If the string was not found
|
||||
*/
|
||||
public OutputAnalyzer shouldContain(String expectedString) {
|
||||
if (!getStdout().contains(expectedString)
|
||||
&& !getStderr().contains(expectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + expectedString
|
||||
+ "' missing from stdout/stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout contents of output buffer contains the string
|
||||
*
|
||||
* @param expectedString
|
||||
* String that buffer should contain
|
||||
* @throws RuntimeException
|
||||
* If the string was not found
|
||||
*/
|
||||
public OutputAnalyzer stdoutShouldContain(String expectedString) {
|
||||
if (!getStdout().contains(expectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + expectedString
|
||||
+ "' missing from stdout \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stderr contents of output buffer contains the string
|
||||
*
|
||||
* @param expectedString
|
||||
* String that buffer should contain
|
||||
* @throws RuntimeException
|
||||
* If the string was not found
|
||||
*/
|
||||
public OutputAnalyzer stderrShouldContain(String expectedString) {
|
||||
if (!getStderr().contains(expectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + expectedString
|
||||
+ "' missing from stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout and stderr contents of output buffer does not
|
||||
* contain the string
|
||||
*
|
||||
* @param notExpectedString
|
||||
* String that the buffer should not contain
|
||||
* @throws RuntimeException
|
||||
* If the string was found
|
||||
*/
|
||||
public OutputAnalyzer shouldNotContain(String notExpectedString) {
|
||||
if (getStdout().contains(notExpectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + notExpectedString
|
||||
+ "' found in stdout \n");
|
||||
}
|
||||
if (getStderr().contains(notExpectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + notExpectedString
|
||||
+ "' found in stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout contents of output buffer does not contain the
|
||||
* string
|
||||
*
|
||||
* @param notExpectedString
|
||||
* String that the buffer should not contain
|
||||
* @throws RuntimeException
|
||||
* If the string was found
|
||||
*/
|
||||
public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
|
||||
if (getStdout().contains(notExpectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + notExpectedString
|
||||
+ "' found in stdout \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stderr contents of output buffer does not contain the
|
||||
* string
|
||||
*
|
||||
* @param notExpectedString
|
||||
* String that the buffer should not contain
|
||||
* @throws RuntimeException
|
||||
* If the string was found
|
||||
*/
|
||||
public OutputAnalyzer stderrShouldNotContain(String notExpectedString) {
|
||||
if (getStderr().contains(notExpectedString)) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + notExpectedString
|
||||
+ "' found in stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout and stderr contents of output buffer matches the
|
||||
* pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @throws RuntimeException
|
||||
* If the pattern was not found
|
||||
*/
|
||||
public OutputAnalyzer shouldMatch(String pattern) {
|
||||
Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
|
||||
.matcher(getStdout());
|
||||
Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
|
||||
.matcher(getStderr());
|
||||
if (!stdoutMatcher.find() && !stderrMatcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern
|
||||
+ "' missing from stdout/stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout contents of output buffer matches the pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @throws RuntimeException
|
||||
* If the pattern was not found
|
||||
*/
|
||||
public OutputAnalyzer stdoutShouldMatch(String pattern) {
|
||||
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
|
||||
getStdout());
|
||||
if (!matcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern
|
||||
+ "' missing from stdout \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stderr contents of output buffer matches the pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @throws RuntimeException
|
||||
* If the pattern was not found
|
||||
*/
|
||||
public OutputAnalyzer stderrShouldMatch(String pattern) {
|
||||
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
|
||||
getStderr());
|
||||
if (!matcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern
|
||||
+ "' missing from stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout and stderr contents of output buffer does not
|
||||
* match the pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @throws RuntimeException
|
||||
* If the pattern was found
|
||||
*/
|
||||
public OutputAnalyzer shouldNotMatch(String pattern) {
|
||||
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
|
||||
getStdout());
|
||||
if (matcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern + "' found in stdout: '"
|
||||
+ matcher.group() + "' \n");
|
||||
}
|
||||
matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(getStderr());
|
||||
if (matcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern + "' found in stderr: '"
|
||||
+ matcher.group() + "' \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout contents of output buffer does not match the
|
||||
* pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @throws RuntimeException
|
||||
* If the pattern was found
|
||||
*/
|
||||
public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
|
||||
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
|
||||
getStdout());
|
||||
if (matcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern + "' found in stdout \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stderr contents of output buffer does not match the
|
||||
* pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @throws RuntimeException
|
||||
* If the pattern was found
|
||||
*/
|
||||
public OutputAnalyzer stderrShouldNotMatch(String pattern) {
|
||||
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
|
||||
getStderr());
|
||||
if (matcher.find()) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("'" + pattern + "' found in stderr \n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the captured group of the first string matching the pattern. stderr
|
||||
* is searched before stdout.
|
||||
*
|
||||
* @param pattern
|
||||
* The multi-line pattern to match
|
||||
* @param group
|
||||
* The group to capture
|
||||
* @return The matched string or null if no match was found
|
||||
*/
|
||||
public String firstMatch(String pattern, int group) {
|
||||
Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
|
||||
.matcher(getStderr());
|
||||
Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
|
||||
.matcher(getStdout());
|
||||
if (stderrMatcher.find()) {
|
||||
return stderrMatcher.group(group);
|
||||
}
|
||||
if (stdoutMatcher.find()) {
|
||||
return stdoutMatcher.group(group);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first string matching the pattern. stderr is searched before
|
||||
* stdout.
|
||||
*
|
||||
* @param pattern
|
||||
* The multi-line pattern to match
|
||||
* @return The matched string or null if no match was found
|
||||
*/
|
||||
public String firstMatch(String pattern) {
|
||||
return firstMatch(pattern, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the exit value of the process
|
||||
*
|
||||
* @param expectedExitValue
|
||||
* Expected exit value from process
|
||||
* @throws RuntimeException
|
||||
* If the exit value from the process did not match the expected
|
||||
* value
|
||||
*/
|
||||
public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) {
|
||||
if (getExitValue() != expectedExitValue) {
|
||||
reportDiagnosticSummary();
|
||||
throw new RuntimeException("Expected to get exit value of ["
|
||||
+ expectedExitValue + "]\n");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report summary that will help to diagnose the problem Currently includes:
|
||||
* - standard input produced by the process under test - standard output -
|
||||
* exit code Note: the command line is printed by the ProcessTools
|
||||
*/
|
||||
private OutputAnalyzer reportDiagnosticSummary() {
|
||||
String msg = " stdout: [" + getStdout() + "];\n" + " stderr: [" + getStderr()
|
||||
+ "]\n" + " exitValue = " + getExitValue() + "\n";
|
||||
|
||||
System.err.println(msg);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of the output buffer (stdout and stderr)
|
||||
*
|
||||
* @return Content of the output buffer
|
||||
*/
|
||||
public String getOutput() {
|
||||
return getStdout() + getStderr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of the stdout buffer
|
||||
*
|
||||
* @return Content of the stdout buffer
|
||||
*/
|
||||
public String getStdout() {
|
||||
return output == null ? stdout : output.getStdout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of the stderr buffer
|
||||
*
|
||||
* @return Content of the stderr buffer
|
||||
*/
|
||||
public String getStderr() {
|
||||
return output == null ? stderr : output.getStderr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the process exit value
|
||||
*
|
||||
* @return Process exit value
|
||||
*/
|
||||
public int getExitValue() {
|
||||
return output == null ? exitValue : output.getExitValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print the stdout buffer to the given {@code PrintStream}.
|
||||
*
|
||||
* @return this OutputAnalyzer
|
||||
*/
|
||||
public OutputAnalyzer outputTo(PrintStream out) {
|
||||
out.println(getStdout());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the stderr buffer to the given {@code PrintStream}.
|
||||
*
|
||||
* @return this OutputAnalyzer
|
||||
*/
|
||||
public OutputAnalyzer errorTo(PrintStream out) {
|
||||
out.println(getStderr());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the contents of the output buffer (stdout and stderr)
|
||||
* as a list of strings. Output will be split at new-lines as
|
||||
* recognized by java.io.BufferedReader.readLine().
|
||||
*
|
||||
* @return Contents of the output buffer as list of strings
|
||||
*/
|
||||
public List<String> asLines() {
|
||||
return asLines(getOutput());
|
||||
}
|
||||
|
||||
private List<String> asLines(String buffer) {
|
||||
return new BufferedReader(new StringReader(buffer))
|
||||
.lines().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is a line matching {@code pattern} and return its index
|
||||
*
|
||||
* @param pattern Matching pattern
|
||||
* @return Index of first matching line
|
||||
*/
|
||||
private int indexOf(List<String> lines, String pattern) {
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (lines.get(i).matches(pattern)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #shouldMatchByLine(String, String, String)
|
||||
*/
|
||||
public int shouldMatchByLine(String pattern) {
|
||||
return shouldMatchByLine(null, null, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #stdoutShouldMatchByLine(String, String, String)
|
||||
*/
|
||||
public int stdoutShouldMatchByLine(String pattern) {
|
||||
return stdoutShouldMatchByLine(null, null, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #shouldMatchByLine(String, String, String)
|
||||
*/
|
||||
public int shouldMatchByLineFrom(String from, String pattern) {
|
||||
return shouldMatchByLine(from, null, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #shouldMatchByLine(String, String, String)
|
||||
*/
|
||||
public int shouldMatchByLineTo(String to, String pattern) {
|
||||
return shouldMatchByLine(null, to, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout and stderr contents of output buffer match the
|
||||
* {@code pattern} line by line. The whole output could be matched or
|
||||
* just a subset of it.
|
||||
*
|
||||
* @param from
|
||||
* The line from where output will be matched.
|
||||
* Set {@code from} to null for matching from the first line.
|
||||
* @param to
|
||||
* The line until where output will be matched.
|
||||
* Set {@code to} to null for matching until the last line.
|
||||
* @param pattern
|
||||
* Matching pattern
|
||||
* @return Count of lines which match the {@code pattern}
|
||||
*/
|
||||
public int shouldMatchByLine(String from, String to, String pattern) {
|
||||
return shouldMatchByLine(getOutput(), from, to, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the stdout contents of output buffer matches the
|
||||
* {@code pattern} line by line. The whole stdout could be matched or
|
||||
* just a subset of it.
|
||||
*
|
||||
* @param from
|
||||
* The line from where stdout will be matched.
|
||||
* Set {@code from} to null for matching from the first line.
|
||||
* @param to
|
||||
* The line until where stdout will be matched.
|
||||
* Set {@code to} to null for matching until the last line.
|
||||
* @param pattern
|
||||
* Matching pattern
|
||||
* @return Count of lines which match the {@code pattern}
|
||||
*/
|
||||
public int stdoutShouldMatchByLine(String from, String to, String pattern) {
|
||||
return shouldMatchByLine(getStdout(), from, to, pattern);
|
||||
}
|
||||
|
||||
private int shouldMatchByLine(String buffer, String from, String to, String pattern) {
|
||||
List<String> lines = asLines(buffer);
|
||||
|
||||
int fromIndex = 0;
|
||||
if (from != null) {
|
||||
fromIndex = indexOf(lines, from);
|
||||
assertGreaterThan(fromIndex, -1,
|
||||
"The line/pattern '" + from + "' from where the output should match can not be found");
|
||||
}
|
||||
|
||||
int toIndex = lines.size();
|
||||
if (to != null) {
|
||||
toIndex = indexOf(lines, to);
|
||||
assertGreaterThan(toIndex, -1,
|
||||
"The line/pattern '" + to + "' until where the output should match can not be found");
|
||||
}
|
||||
|
||||
List<String> subList = lines.subList(fromIndex, toIndex);
|
||||
int matchedCount = 0;
|
||||
for (String line : subList) {
|
||||
assertTrue(line.matches(pattern),
|
||||
"The line '" + line + "' does not match pattern '" + pattern + "'");
|
||||
matchedCount++;
|
||||
}
|
||||
|
||||
return matchedCount;
|
||||
}
|
||||
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package jdk.testlibrary;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* @deprecated This class is deprecated. Use the one from
|
||||
* {@code <root>/test/lib/jdk/test/lib/process}
|
||||
*/
|
||||
@Deprecated
|
||||
class OutputBuffer {
|
||||
private static class OutputBufferException extends RuntimeException {
|
||||
private static final long serialVersionUID = 8528687792643129571L;
|
||||
|
||||
public OutputBufferException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
||||
private final Process p;
|
||||
private final Future<Void> outTask;
|
||||
private final Future<Void> errTask;
|
||||
private final ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
|
||||
private final ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
|
||||
|
||||
/**
|
||||
* Create an OutputBuffer, a class for storing and managing stdout and
|
||||
* stderr results separately
|
||||
*
|
||||
* @param stdout
|
||||
* stdout result
|
||||
* @param stderr
|
||||
* stderr result
|
||||
*/
|
||||
OutputBuffer(Process p) {
|
||||
this.p = p;
|
||||
StreamPumper outPumper = new StreamPumper(p.getInputStream(),
|
||||
stdoutBuffer);
|
||||
StreamPumper errPumper = new StreamPumper(p.getErrorStream(),
|
||||
stderrBuffer);
|
||||
|
||||
outTask = outPumper.process();
|
||||
errTask = errPumper.process();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stdout result
|
||||
*
|
||||
* @return stdout result
|
||||
*/
|
||||
public String getStdout() {
|
||||
try {
|
||||
outTask.get();
|
||||
return stdoutBuffer.toString();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new OutputBufferException(e);
|
||||
} catch (ExecutionException | CancellationException e) {
|
||||
throw new OutputBufferException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stderr result
|
||||
*
|
||||
* @return stderr result
|
||||
*/
|
||||
public String getStderr() {
|
||||
try {
|
||||
errTask.get();
|
||||
return stderrBuffer.toString();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new OutputBufferException(e);
|
||||
} catch (ExecutionException | CancellationException e) {
|
||||
throw new OutputBufferException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public int getExitValue() {
|
||||
try {
|
||||
return p.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new OutputBufferException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,560 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2017, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package jdk.testlibrary;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated This class is deprecated. Use the one from
|
||||
* {@code <root>/test/lib/jdk/test/lib/process}
|
||||
*/
|
||||
@Deprecated
|
||||
public final class ProcessTools {
|
||||
private static final class LineForwarder extends StreamPumper.LinePump {
|
||||
private final PrintStream ps;
|
||||
private final String prefix;
|
||||
LineForwarder(String prefix, PrintStream os) {
|
||||
this.ps = os;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
@Override
|
||||
protected void processLine(String line) {
|
||||
ps.println("[" + prefix + "] " + line);
|
||||
}
|
||||
}
|
||||
|
||||
private ProcessTools() {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Starts a process from its builder.</p>
|
||||
* <span>The default redirects of STDOUT and STDERR are started</span>
|
||||
* @param name The process name
|
||||
* @param processBuilder The process builder
|
||||
* @return Returns the initialized process
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Process startProcess(String name,
|
||||
ProcessBuilder processBuilder)
|
||||
throws IOException {
|
||||
return startProcess(name, processBuilder, (Consumer<String>)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Starts a process from its builder.</p>
|
||||
* <span>The default redirects of STDOUT and STDERR are started</span>
|
||||
* <p>It is possible to monitor the in-streams via the provided {@code consumer}
|
||||
* @param name The process name
|
||||
* @param consumer {@linkplain Consumer} instance to process the in-streams
|
||||
* @param processBuilder The process builder
|
||||
* @return Returns the initialized process
|
||||
* @throws IOException
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public static Process startProcess(String name,
|
||||
ProcessBuilder processBuilder,
|
||||
Consumer<String> consumer)
|
||||
throws IOException {
|
||||
try {
|
||||
return startProcess(name, processBuilder, consumer, null, -1, TimeUnit.NANOSECONDS);
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
// will never happen
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Starts a process from its builder.</p>
|
||||
* <span>The default redirects of STDOUT and STDERR are started</span>
|
||||
* <p>
|
||||
* It is possible to wait for the process to get to a warmed-up state
|
||||
* via {@linkplain Predicate} condition on the STDOUT
|
||||
* </p>
|
||||
* @param name The process name
|
||||
* @param processBuilder The process builder
|
||||
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
|
||||
* Used to determine the moment the target app is
|
||||
* properly warmed-up.
|
||||
* It can be null - in that case the warmup is skipped.
|
||||
* @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever
|
||||
* @param unit The timeout {@linkplain TimeUnit}
|
||||
* @return Returns the initialized {@linkplain Process}
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @throws TimeoutException
|
||||
*/
|
||||
public static Process startProcess(String name,
|
||||
ProcessBuilder processBuilder,
|
||||
final Predicate<String> linePredicate,
|
||||
long timeout,
|
||||
TimeUnit unit)
|
||||
throws IOException, InterruptedException, TimeoutException {
|
||||
return startProcess(name, processBuilder, null, linePredicate, timeout, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Starts a process from its builder.</p>
|
||||
* <span>The default redirects of STDOUT and STDERR are started</span>
|
||||
* <p>
|
||||
* It is possible to wait for the process to get to a warmed-up state
|
||||
* via {@linkplain Predicate} condition on the STDOUT and monitor the
|
||||
* in-streams via the provided {@linkplain Consumer}
|
||||
* </p>
|
||||
* @param name The process name
|
||||
* @param processBuilder The process builder
|
||||
* @param lineConsumer The {@linkplain Consumer} the lines will be forwarded to
|
||||
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
|
||||
* Used to determine the moment the target app is
|
||||
* properly warmed-up.
|
||||
* It can be null - in that case the warmup is skipped.
|
||||
* @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever
|
||||
* @param unit The timeout {@linkplain TimeUnit}
|
||||
* @return Returns the initialized {@linkplain Process}
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @throws TimeoutException
|
||||
*/
|
||||
public static Process startProcess(String name,
|
||||
ProcessBuilder processBuilder,
|
||||
final Consumer<String> lineConsumer,
|
||||
final Predicate<String> linePredicate,
|
||||
long timeout,
|
||||
TimeUnit unit)
|
||||
throws IOException, InterruptedException, TimeoutException {
|
||||
System.out.println("["+name+"]:" + processBuilder.command().stream().collect(Collectors.joining(" ")));
|
||||
Process p = processBuilder.start();
|
||||
StreamPumper stdout = new StreamPumper(p.getInputStream());
|
||||
StreamPumper stderr = new StreamPumper(p.getErrorStream());
|
||||
|
||||
stdout.addPump(new LineForwarder(name, System.out));
|
||||
stderr.addPump(new LineForwarder(name, System.err));
|
||||
if (lineConsumer != null) {
|
||||
StreamPumper.LinePump pump = new StreamPumper.LinePump() {
|
||||
@Override
|
||||
protected void processLine(String line) {
|
||||
lineConsumer.accept(line);
|
||||
}
|
||||
};
|
||||
stdout.addPump(pump);
|
||||
stderr.addPump(pump);
|
||||
}
|
||||
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
if (linePredicate != null) {
|
||||
StreamPumper.LinePump pump = new StreamPumper.LinePump() {
|
||||
@Override
|
||||
protected void processLine(String line) {
|
||||
if (latch.getCount() > 0 && linePredicate.test(line)) {
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
};
|
||||
stdout.addPump(pump);
|
||||
stderr.addPump(pump);
|
||||
} else {
|
||||
latch.countDown();
|
||||
}
|
||||
final Future<Void> stdoutTask = stdout.process();
|
||||
final Future<Void> stderrTask = stderr.process();
|
||||
|
||||
try {
|
||||
if (timeout > -1) {
|
||||
if (timeout == 0) {
|
||||
latch.await();
|
||||
} else {
|
||||
if (!latch.await(Utils.adjustTimeout(timeout), unit)) {
|
||||
throw new TimeoutException();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TimeoutException | InterruptedException e) {
|
||||
System.err.println("Failed to start a process (thread dump follows)");
|
||||
for(Map.Entry<Thread, StackTraceElement[]> s : Thread.getAllStackTraces().entrySet()) {
|
||||
printStack(s.getKey(), s.getValue());
|
||||
}
|
||||
|
||||
if (p.isAlive()) {
|
||||
p.destroyForcibly();
|
||||
}
|
||||
|
||||
stdoutTask.cancel(true);
|
||||
stderrTask.cancel(true);
|
||||
throw e;
|
||||
}
|
||||
|
||||
return new ProcessImpl(p, stdoutTask, stderrTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Starts a process from its builder.</p>
|
||||
* <span>The default redirects of STDOUT and STDERR are started</span>
|
||||
* <p>
|
||||
* It is possible to wait for the process to get to a warmed-up state
|
||||
* via {@linkplain Predicate} condition on the STDOUT. The warm-up will
|
||||
* wait indefinitely.
|
||||
* </p>
|
||||
* @param name The process name
|
||||
* @param processBuilder The process builder
|
||||
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
|
||||
* Used to determine the moment the target app is
|
||||
* properly warmed-up.
|
||||
* It can be null - in that case the warmup is skipped.
|
||||
* @return Returns the initialized {@linkplain Process}
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @throws TimeoutException
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public static Process startProcess(String name,
|
||||
ProcessBuilder processBuilder,
|
||||
final Predicate<String> linePredicate)
|
||||
throws IOException, InterruptedException, TimeoutException {
|
||||
return startProcess(name, processBuilder, linePredicate, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the process id of the current running Java process
|
||||
*
|
||||
* @return Process id
|
||||
*/
|
||||
public static long getProcessId() {
|
||||
return ProcessHandle.current().pid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create ProcessBuilder using the java launcher from the jdk to be tested,
|
||||
* and with any platform specific arguments prepended.
|
||||
*
|
||||
* @param command Arguments to pass to the java command.
|
||||
* @return The ProcessBuilder instance representing the java command.
|
||||
*/
|
||||
public static ProcessBuilder createJavaProcessBuilder(String... command) {
|
||||
return createJavaProcessBuilder(false, command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create ProcessBuilder using the java launcher from the jdk to be tested,
|
||||
* and with any platform specific arguments prepended.
|
||||
*
|
||||
* @param addTestVmAndJavaOptions If true, adds test.vm.opts and test.java.opts
|
||||
* to the java arguments.
|
||||
* @param command Arguments to pass to the java command.
|
||||
* @return The ProcessBuilder instance representing the java command.
|
||||
*/
|
||||
public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
|
||||
String javapath = JDKToolFinder.getJDKTool("java");
|
||||
|
||||
ArrayList<String> args = new ArrayList<>();
|
||||
args.add(javapath);
|
||||
|
||||
if (addTestVmAndJavaOptions) {
|
||||
// -cp is needed to make sure the same classpath is used whether the test is
|
||||
// run in AgentVM mode or OtherVM mode. It was added to the hotspot version
|
||||
// of this API as part of 8077608. However, for the jdk version it is only
|
||||
// added when addTestVmAndJavaOptions is true in order to minimize
|
||||
// disruption to existing JDK tests, which have yet to be tested with -cp
|
||||
// being added. At some point -cp should always be added to be consistent
|
||||
// with what the hotspot version does.
|
||||
args.add("-cp");
|
||||
args.add(System.getProperty("java.class.path"));
|
||||
Collections.addAll(args, Utils.getTestJavaOpts());
|
||||
}
|
||||
|
||||
Collections.addAll(args, command);
|
||||
|
||||
// Reporting
|
||||
StringBuilder cmdLine = new StringBuilder();
|
||||
for (String cmd : args)
|
||||
cmdLine.append(cmd).append(' ');
|
||||
System.out.println("Command line: [" + cmdLine.toString() + "]");
|
||||
|
||||
return new ProcessBuilder(args.toArray(new String[args.size()]));
|
||||
}
|
||||
|
||||
private static void printStack(Thread t, StackTraceElement[] stack) {
|
||||
System.out.println("\t" + t +
|
||||
" stack: (length = " + stack.length + ")");
|
||||
if (t != null) {
|
||||
for (StackTraceElement stack1 : stack) {
|
||||
System.out.println("\t" + stack1);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a test java process, waits for it to finish and returns the process output.
|
||||
* The default options from jtreg, test.vm.opts and test.java.opts, are added.
|
||||
* The java from the test.jdk is used to execute the command.
|
||||
*
|
||||
* The command line will be like:
|
||||
* {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
|
||||
*
|
||||
* The java process will have exited before this method returns.
|
||||
*
|
||||
* @param cmds User specifed arguments.
|
||||
* @return The output from the process.
|
||||
*/
|
||||
public static OutputAnalyzer executeTestJava(String... options) throws Exception {
|
||||
ProcessBuilder pb = createJavaProcessBuilder(Utils.addTestJavaOpts(options));
|
||||
return executeProcess(pb);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use executeTestJava instead
|
||||
*/
|
||||
public static OutputAnalyzer executeTestJvm(String... options) throws Exception {
|
||||
return executeTestJava(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process, waits for it to finish and returns the process output.
|
||||
* The process will have exited before this method returns.
|
||||
* @param pb The ProcessBuilder to execute.
|
||||
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
|
||||
*/
|
||||
public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception {
|
||||
return executeProcess(pb, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process, pipe some text into its STDIN, waits for it
|
||||
* to finish and returns the process output. The process will have exited
|
||||
* before this method returns.
|
||||
* @param pb The ProcessBuilder to execute.
|
||||
* @param input The text to pipe into STDIN. Can be null.
|
||||
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
|
||||
*/
|
||||
public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input)
|
||||
throws Exception {
|
||||
OutputAnalyzer output = null;
|
||||
Process p = null;
|
||||
boolean failed = false;
|
||||
try {
|
||||
p = pb.start();
|
||||
if (input != null) {
|
||||
try (OutputStream os = p.getOutputStream();
|
||||
PrintStream ps = new PrintStream(os)) {
|
||||
ps.print(input);
|
||||
ps.flush();
|
||||
}
|
||||
}
|
||||
output = new OutputAnalyzer(p);
|
||||
p.waitFor();
|
||||
|
||||
return output;
|
||||
} catch (Throwable t) {
|
||||
if (p != null) {
|
||||
p.destroyForcibly().waitFor();
|
||||
}
|
||||
|
||||
failed = true;
|
||||
System.out.println("executeProcess() failed: " + t);
|
||||
throw t;
|
||||
} finally {
|
||||
if (failed) {
|
||||
System.err.println(getProcessLog(pb, output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process, waits for it to finish and returns the process output.
|
||||
*
|
||||
* The process will have exited before this method returns.
|
||||
*
|
||||
* @param cmds The command line to execute.
|
||||
* @return The output from the process.
|
||||
*/
|
||||
public static OutputAnalyzer executeProcess(String... cmds) throws Exception {
|
||||
return executeProcess(new ProcessBuilder(cmds));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to log command line, stdout, stderr and exit code from an executed process.
|
||||
* @param pb The executed process.
|
||||
* @param output The output from the process.
|
||||
*/
|
||||
public static String getProcessLog(ProcessBuilder pb, OutputAnalyzer output) {
|
||||
String stderr = output == null ? "null" : output.getStderr();
|
||||
String stdout = output == null ? "null" : output.getStdout();
|
||||
String exitValue = output == null ? "null": Integer.toString(output.getExitValue());
|
||||
StringBuilder logMsg = new StringBuilder();
|
||||
final String nl = System.getProperty("line.separator");
|
||||
logMsg.append("--- ProcessLog ---" + nl);
|
||||
logMsg.append("cmd: " + getCommandLine(pb) + nl);
|
||||
logMsg.append("exitvalue: " + exitValue + nl);
|
||||
logMsg.append("stderr: " + stderr + nl);
|
||||
logMsg.append("stdout: " + stdout + nl);
|
||||
|
||||
return logMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The full command line for the ProcessBuilder.
|
||||
*/
|
||||
public static String getCommandLine(ProcessBuilder pb) {
|
||||
if (pb == null) {
|
||||
return "null";
|
||||
}
|
||||
StringBuilder cmd = new StringBuilder();
|
||||
for (String s : pb.command()) {
|
||||
cmd.append(s).append(" ");
|
||||
}
|
||||
return cmd.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process, waits for it to finish, prints the process output
|
||||
* to stdout, and returns the process output.
|
||||
*
|
||||
* The process will have exited before this method returns.
|
||||
*
|
||||
* @param cmds The command line to execute.
|
||||
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
|
||||
*/
|
||||
public static OutputAnalyzer executeCommand(String... cmds)
|
||||
throws Throwable {
|
||||
String cmdLine = Arrays.stream(cmds).collect(Collectors.joining(" "));
|
||||
System.out.println("Command line: [" + cmdLine + "]");
|
||||
OutputAnalyzer analyzer = ProcessTools.executeProcess(cmds);
|
||||
System.out.println(analyzer.getOutput());
|
||||
return analyzer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process, waits for it to finish, prints the process output
|
||||
* to stdout and returns the process output.
|
||||
*
|
||||
* The process will have exited before this method returns.
|
||||
*
|
||||
* @param pb The ProcessBuilder to execute.
|
||||
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
|
||||
*/
|
||||
public static OutputAnalyzer executeCommand(ProcessBuilder pb)
|
||||
throws Throwable {
|
||||
String cmdLine = pb.command().stream().collect(Collectors.joining(" "));
|
||||
System.out.println("Command line: [" + cmdLine + "]");
|
||||
OutputAnalyzer analyzer = ProcessTools.executeProcess(pb);
|
||||
System.out.println(analyzer.getOutput());
|
||||
return analyzer;
|
||||
}
|
||||
|
||||
private static class ProcessImpl extends Process {
|
||||
|
||||
private final Process p;
|
||||
private final Future<Void> stdoutTask;
|
||||
private final Future<Void> stderrTask;
|
||||
|
||||
public ProcessImpl(Process p, Future<Void> stdoutTask, Future<Void> stderrTask) {
|
||||
this.p = p;
|
||||
this.stdoutTask = stdoutTask;
|
||||
this.stderrTask = stderrTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getOutputStream() {
|
||||
return p.getOutputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
return p.getInputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getErrorStream() {
|
||||
return p.getErrorStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int waitFor() throws InterruptedException {
|
||||
int rslt = p.waitFor();
|
||||
waitForStreams();
|
||||
return rslt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int exitValue() {
|
||||
return p.exitValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
p.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long pid() {
|
||||
return p.pid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
return p.isAlive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Process destroyForcibly() {
|
||||
return p.destroyForcibly();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
boolean rslt = p.waitFor(timeout, unit);
|
||||
if (rslt) {
|
||||
waitForStreams();
|
||||
}
|
||||
return rslt;
|
||||
}
|
||||
|
||||
private void waitForStreams() throws InterruptedException {
|
||||
try {
|
||||
stdoutTask.get();
|
||||
} catch (ExecutionException e) {
|
||||
}
|
||||
try {
|
||||
stderrTask.get();
|
||||
} catch (ExecutionException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package jdk.testlibrary;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* @deprecated This class is deprecated. Use the one from
|
||||
* {@code <root>/test/lib/jdk/test/lib/process}
|
||||
*/
|
||||
@Deprecated
|
||||
public final class StreamPumper implements Runnable {
|
||||
|
||||
private static final int BUF_SIZE = 256;
|
||||
|
||||
/**
|
||||
* Pump will be called by the StreamPumper to process the incoming data
|
||||
*/
|
||||
abstract public static class Pump {
|
||||
abstract void register(StreamPumper d);
|
||||
}
|
||||
|
||||
/**
|
||||
* OutputStream -> Pump adapter
|
||||
*/
|
||||
final public static class StreamPump extends Pump {
|
||||
private final OutputStream out;
|
||||
public StreamPump(OutputStream out) {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
@Override
|
||||
void register(StreamPumper sp) {
|
||||
sp.addOutputStream(out);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to process the incoming data line-by-line
|
||||
*/
|
||||
abstract public static class LinePump extends Pump {
|
||||
@Override
|
||||
final void register(StreamPumper sp) {
|
||||
sp.addLineProcessor(this);
|
||||
}
|
||||
|
||||
abstract protected void processLine(String line);
|
||||
}
|
||||
|
||||
private final InputStream in;
|
||||
private final Set<OutputStream> outStreams = new HashSet<>();
|
||||
private final Set<LinePump> linePumps = new HashSet<>();
|
||||
|
||||
private final AtomicBoolean processing = new AtomicBoolean(false);
|
||||
private final FutureTask<Void> processingTask = new FutureTask<>(this, null);
|
||||
|
||||
public StreamPumper(InputStream in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a StreamPumper that reads from in and writes to out.
|
||||
*
|
||||
* @param in
|
||||
* The stream to read from.
|
||||
* @param out
|
||||
* The stream to write to.
|
||||
*/
|
||||
public StreamPumper(InputStream in, OutputStream out) {
|
||||
this(in);
|
||||
this.addOutputStream(out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Thread.run(). Continuously read from {@code in} and write to
|
||||
* {@code out} until {@code in} has reached end of stream. Abort on
|
||||
* interruption. Abort on IOExceptions.
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
try (BufferedInputStream is = new BufferedInputStream(in)) {
|
||||
ByteArrayOutputStream lineBos = new ByteArrayOutputStream();
|
||||
byte[] buf = new byte[BUF_SIZE];
|
||||
int len = 0;
|
||||
int linelen = 0;
|
||||
|
||||
while ((len = is.read(buf)) > 0 && !Thread.interrupted()) {
|
||||
for(OutputStream out : outStreams) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
if (!linePumps.isEmpty()) {
|
||||
int i = 0;
|
||||
int lastcrlf = -1;
|
||||
while (i < len) {
|
||||
if (buf[i] == '\n' || buf[i] == '\r') {
|
||||
int bufLinelen = i - lastcrlf - 1;
|
||||
if (bufLinelen > 0) {
|
||||
lineBos.write(buf, lastcrlf + 1, bufLinelen);
|
||||
}
|
||||
linelen += bufLinelen;
|
||||
|
||||
if (linelen > 0) {
|
||||
lineBos.flush();
|
||||
final String line = lineBos.toString();
|
||||
linePumps.stream().forEach((lp) -> {
|
||||
lp.processLine(line);
|
||||
});
|
||||
lineBos.reset();
|
||||
linelen = 0;
|
||||
}
|
||||
lastcrlf = i;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
if (lastcrlf == -1) {
|
||||
lineBos.write(buf, 0, len);
|
||||
linelen += len;
|
||||
} else if (lastcrlf < len - 1) {
|
||||
lineBos.write(buf, lastcrlf + 1, len - lastcrlf - 1);
|
||||
linelen += len - lastcrlf - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
for(OutputStream out : outStreams) {
|
||||
try {
|
||||
out.flush();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
final void addOutputStream(OutputStream out) {
|
||||
outStreams.add(out);
|
||||
}
|
||||
|
||||
final void addLineProcessor(LinePump lp) {
|
||||
linePumps.add(lp);
|
||||
}
|
||||
|
||||
final public StreamPumper addPump(Pump ... pump) {
|
||||
if (processing.get()) {
|
||||
throw new IllegalStateException("Can not modify pumper while " +
|
||||
"processing is in progress");
|
||||
}
|
||||
for(Pump p : pump) {
|
||||
p.register(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
final public Future<Void> process() {
|
||||
if (!processing.compareAndSet(false, true)) {
|
||||
throw new IllegalStateException("Can not re-run the processing");
|
||||
}
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processingTask.run();
|
||||
}
|
||||
});
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
|
||||
return processingTask;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user