Merge

Fri, 28 Aug 2020 07:32:38 +0100

author
andrew
date
Fri, 28 Aug 2020 07:32:38 +0100
changeset 9994
9d42d5dfa0cf
parent 9989
6898cbe6d575
parent 9993
9ceaa376784a
child 9995
633a3d28d2fe

Merge

     1.1 --- a/THIRD_PARTY_README	Wed Aug 26 03:59:50 2020 +0100
     1.2 +++ b/THIRD_PARTY_README	Fri Aug 28 07:32:38 2020 +0100
     1.3 @@ -2240,7 +2240,7 @@
     1.4  
     1.5  -------------------------------------------------------------------------------
     1.6  
     1.7 -%% This notice is provided with respect to PC/SC Lite v1.8.24,
     1.8 +%% This notice is provided with respect to PC/SC Lite v1.8.26,
     1.9  which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
    1.10  
    1.11  --- begin of LICENSE ---
     2.1 --- a/src/share/vm/runtime/globals.hpp	Wed Aug 26 03:59:50 2020 +0100
     2.2 +++ b/src/share/vm/runtime/globals.hpp	Fri Aug 28 07:32:38 2020 +0100
     2.3 @@ -1339,7 +1339,7 @@
     2.4    develop(bool, TraceClassInitialization, false,                            \
     2.5            "Trace class initialization")                                     \
     2.6                                                                              \
     2.7 -  develop(bool, TraceExceptions, false,                                     \
     2.8 +  product(bool, TraceExceptions, false,                                     \
     2.9            "Trace exceptions")                                               \
    2.10                                                                              \
    2.11    develop(bool, TraceICs, false,                                            \
     3.1 --- a/test/runtime/CommandLine/TraceExceptionsTest.java	Wed Aug 26 03:59:50 2020 +0100
     3.2 +++ b/test/runtime/CommandLine/TraceExceptionsTest.java	Fri Aug 28 07:32:38 2020 +0100
     3.3 @@ -33,11 +33,6 @@
     3.4  public class TraceExceptionsTest {
     3.5      public static void main(String[] args) throws Exception {
     3.6  
     3.7 -        if (!Platform.isDebugBuild()) {
     3.8 -          System.out.println("Skip the test on product builds since XX:+TraceExceptions is not available on product builds");
     3.9 -          return;
    3.10 -        }
    3.11 -
    3.12          ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
    3.13              "-XX:+TraceExceptions", "NoClassFound");
    3.14          OutputAnalyzer output = new OutputAnalyzer(pb.start());
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/runtime/containers/docker/CheckOperatingSystemMXBean.java	Fri Aug 28 07:32:38 2020 +0100
     4.3 @@ -0,0 +1,43 @@
     4.4 +/*
     4.5 + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2019, Red Hat Inc. All rights reserved.
     4.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8 + *
     4.9 + * This code is free software; you can redistribute it and/or modify it
    4.10 + * under the terms of the GNU General Public License version 2 only, as
    4.11 + * published by the Free Software Foundation.
    4.12 + *
    4.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.16 + * version 2 for more details (a copy is included in the LICENSE file that
    4.17 + * accompanied this code).
    4.18 + *
    4.19 + * You should have received a copy of the GNU General Public License version
    4.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.22 + *
    4.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.24 + * or visit www.oracle.com if you need additional information or have any
    4.25 + * questions.
    4.26 + */
    4.27 +
    4.28 +import com.sun.management.OperatingSystemMXBean;
    4.29 +import java.lang.management.ManagementFactory;
    4.30 +
    4.31 +public class CheckOperatingSystemMXBean {
    4.32 +
    4.33 +    public static void main(String[] args) {
    4.34 +        System.out.println("Checking OperatingSystemMXBean");
    4.35 +
    4.36 +        OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
    4.37 +        System.out.println(String.format("Runtime.availableProcessors: %d", Runtime.getRuntime().availableProcessors()));
    4.38 +        System.out.println(String.format("OperatingSystemMXBean.getAvailableProcessors: %d", osBean.getAvailableProcessors()));
    4.39 +        System.out.println(String.format("OperatingSystemMXBean.getTotalPhysicalMemorySize: %d", osBean.getTotalPhysicalMemorySize()));
    4.40 +        System.out.println(String.format("OperatingSystemMXBean.getFreePhysicalMemorySize: %d", osBean.getFreePhysicalMemorySize()));
    4.41 +        System.out.println(String.format("OperatingSystemMXBean.getTotalSwapSpaceSize: %d", osBean.getTotalSwapSpaceSize()));
    4.42 +        System.out.println(String.format("OperatingSystemMXBean.getFreeSwapSpaceSize: %d", osBean.getFreeSwapSpaceSize()));
    4.43 +        System.out.println(String.format("OperatingSystemMXBean.getSystemCpuLoad: %f", osBean.getSystemCpuLoad()));
    4.44 +    }
    4.45 +
    4.46 +}
     5.1 --- a/test/runtime/containers/docker/Dockerfile-BasicTest	Wed Aug 26 03:59:50 2020 +0100
     5.2 +++ b/test/runtime/containers/docker/Dockerfile-BasicTest	Fri Aug 28 07:32:38 2020 +0100
     5.3 @@ -1,4 +1,4 @@
     5.4 -FROM oraclelinux:7.2
     5.5 +FROM oraclelinux:7.6
     5.6  MAINTAINER mikhailo.seledtsov@oracle.com
     5.7  
     5.8  COPY /jdk /jdk
     6.1 --- a/test/runtime/containers/docker/TestCPUAwareness.java	Wed Aug 26 03:59:50 2020 +0100
     6.2 +++ b/test/runtime/containers/docker/TestCPUAwareness.java	Fri Aug 28 07:32:38 2020 +0100
     6.3 @@ -25,7 +25,9 @@
     6.4  /*
     6.5   * @test
     6.6   * @summary Test JVM's CPU resource awareness when running inside docker container
     6.7 - * @library /testlibrary
     6.8 + * @library /testlibrary /testlibrary/whitebox
     6.9 + * @build sun.hotspot.WhiteBox PrintContainerInfo CheckOperatingSystemMXBean
    6.10 + * @run driver ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
    6.11   * @run driver TestCPUAwareness
    6.12   */
    6.13  
    6.14 @@ -72,6 +74,14 @@
    6.15              testCpuQuotaAndPeriod(150*1000, 100*1000);
    6.16              testCpuQuotaAndPeriod(400*1000, 100*1000);
    6.17  
    6.18 +            testOperatingSystemMXBeanAwareness("0.5", "1");
    6.19 +            testOperatingSystemMXBeanAwareness("1.0", "1");
    6.20 +            if (availableCPUs > 2) {
    6.21 +                testOperatingSystemMXBeanAwareness("1.2", "2");
    6.22 +                testOperatingSystemMXBeanAwareness("1.8", "2");
    6.23 +                testOperatingSystemMXBeanAwareness("2.0", "2");
    6.24 +            }
    6.25 +
    6.26          } finally {
    6.27              DockerTestUtils.removeDockerImage(imageName);
    6.28          }
    6.29 @@ -202,4 +212,21 @@
    6.30              .shouldMatch("CPU Shares is.*" + shares)
    6.31              .shouldMatch("active_processor_count.*" + expectedAPC);
    6.32      }
    6.33 +
    6.34 +    private static void testOperatingSystemMXBeanAwareness(String cpuAllocation, String expectedCpus) throws Exception {
    6.35 +        Common.logNewTestCase("Check OperatingSystemMXBean");
    6.36 +
    6.37 +        DockerRunOptions opts = Common.newOpts(imageName, "CheckOperatingSystemMXBean")
    6.38 +            .addDockerOpts(
    6.39 +                "--cpus", cpuAllocation
    6.40 +            );
    6.41 +
    6.42 +        DockerTestUtils.dockerRunJava(opts)
    6.43 +            .shouldHaveExitValue(0)
    6.44 +            .shouldContain("Checking OperatingSystemMXBean")
    6.45 +            .shouldContain("Runtime.availableProcessors: " + expectedCpus)
    6.46 +            .shouldContain("OperatingSystemMXBean.getAvailableProcessors: " + expectedCpus)
    6.47 +            .shouldMatch("OperatingSystemMXBean\\.getSystemCpuLoad: [0-9]+\\.[0-9]+")
    6.48 +            ;
    6.49 +    }
    6.50  }
     7.1 --- a/test/runtime/containers/docker/TestMemoryAwareness.java	Wed Aug 26 03:59:50 2020 +0100
     7.2 +++ b/test/runtime/containers/docker/TestMemoryAwareness.java	Fri Aug 28 07:32:38 2020 +0100
     7.3 @@ -26,7 +26,7 @@
     7.4   * @test
     7.5   * @summary Test JVM's memory resource awareness when running inside docker container
     7.6   * @library /testlibrary /testlibrary/whitebox
     7.7 - * @build AttemptOOM sun.hotspot.WhiteBox PrintContainerInfo
     7.8 + * @build AttemptOOM sun.hotspot.WhiteBox PrintContainerInfo CheckOperatingSystemMXBean
     7.9   * @run driver ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
    7.10   * @run driver TestMemoryAwareness
    7.11   */
    7.12 @@ -59,6 +59,18 @@
    7.13              // Add extra 10 Mb to allocator limit, to be sure to cause OOM
    7.14              testOOM("256m", 256 + 10);
    7.15  
    7.16 +            testOperatingSystemMXBeanAwareness(
    7.17 +                "100M", Integer.toString(((int) Math.pow(2, 20)) * 100),
    7.18 +                "150M", Integer.toString(((int) Math.pow(2, 20)) * (150 - 100))
    7.19 +            );
    7.20 +            testOperatingSystemMXBeanAwareness(
    7.21 +                "128M", Integer.toString(((int) Math.pow(2, 20)) * 128),
    7.22 +                "256M", Integer.toString(((int) Math.pow(2, 20)) * (256 - 128))
    7.23 +            );
    7.24 +            testOperatingSystemMXBeanAwareness(
    7.25 +                "1G", Integer.toString(((int) Math.pow(2, 20)) * 1024),
    7.26 +                "1500M", Integer.toString(((int) Math.pow(2, 20)) * (1500 - 1024))
    7.27 +            );
    7.28          } finally {
    7.29              DockerTestUtils.removeDockerImage(imageName);
    7.30          }
    7.31 @@ -106,4 +118,24 @@
    7.32              .shouldContain("java.lang.OutOfMemoryError");
    7.33      }
    7.34  
    7.35 +    private static void testOperatingSystemMXBeanAwareness(String memoryAllocation, String expectedMemory,
    7.36 +            String swapAllocation, String expectedSwap) throws Exception {
    7.37 +        Common.logNewTestCase("Check OperatingSystemMXBean");
    7.38 +
    7.39 +        DockerRunOptions opts = Common.newOpts(imageName, "CheckOperatingSystemMXBean")
    7.40 +            .addDockerOpts(
    7.41 +                "--memory", memoryAllocation,
    7.42 +                "--memory-swap", swapAllocation
    7.43 +            );
    7.44 +
    7.45 +        DockerTestUtils.dockerRunJava(opts)
    7.46 +            .shouldHaveExitValue(0)
    7.47 +            .shouldContain("Checking OperatingSystemMXBean")
    7.48 +            .shouldContain("OperatingSystemMXBean.getTotalPhysicalMemorySize: " + expectedMemory)
    7.49 +            .shouldMatch("OperatingSystemMXBean\\.getFreePhysicalMemorySize: [1-9][0-9]+")
    7.50 +            .shouldContain("OperatingSystemMXBean.getTotalSwapSpaceSize: " + expectedSwap)
    7.51 +            .shouldMatch("OperatingSystemMXBean\\.getFreeSwapSpaceSize: [1-9][0-9]+")
    7.52 +            ;
    7.53 +    }
    7.54 +
    7.55  }

mercurial