changeset 51403:1bf8f9840705

8205605: [testbug][aix] Various test adaption to aix pecularities. Reviewed-by: lfoltan, coleenp
author goetz
date Mon, 25 Jun 2018 13:37:01 +0200
parents 68fa3d4026ea
children c545db4fc9bd
files test/hotspot/jtreg/runtime/8176717/TestInheritFD.java test/hotspot/jtreg/runtime/jni/CalleeSavedRegisters/FPRegs.java test/hotspot/jtreg/runtime/whitebox/WBStackSize.java test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java
diffstat 4 files changed, 37 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java	Mon Jun 25 13:41:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java	Mon Jun 25 13:37:01 2018 +0200
@@ -45,6 +45,8 @@
  * @test TestInheritFD
  * @bug 8176717 8176809
  * @summary a new process should not inherit open file descriptors
+ * @comment On Aix lsof requires root privileges.
+ * @requires os.family != "aix"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/runtime/jni/CalleeSavedRegisters/FPRegs.java	Mon Jun 25 13:41:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/jni/CalleeSavedRegisters/FPRegs.java	Mon Jun 25 13:37:01 2018 +0200
@@ -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,9 +21,13 @@
  * questions.
  *
  */
-/*
+
+/**
  * @test
  * @bug 8067744
+ * @comment Test uses custom launcher that starts VM in primordial thread. This is
+ *          not possible on aix.
+ * @requires os.family != "aix"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @run main/native FPRegs
--- a/test/hotspot/jtreg/runtime/whitebox/WBStackSize.java	Mon Jun 25 13:41:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/whitebox/WBStackSize.java	Mon Jun 25 13:37:01 2018 +0200
@@ -21,7 +21,7 @@
  * questions.
  */
 
-/*
+/**
  * @test WBStackSize
  * @summary verify that whitebox functions getThreadFullStackSize() and getThreadRemainingStackSize are working
  * @modules java.base/jdk.internal.misc
@@ -43,6 +43,7 @@
  */
 
 import sun.hotspot.WhiteBox;
+import jdk.test.lib.Platform;
 
 public class WBStackSize {
 
@@ -83,18 +84,40 @@
     }
 
     public static void main(String[] args) {
+        long pageSize = wb.getVMPageSize();
+
         long configStackSize = wb.getIntxVMFlag("ThreadStackSize") * K;
         System.out.println("ThreadStackSize VM option: " + configStackSize);
 
-        long stackProtectionSize = wb.getIntxVMFlag("StackShadowPages") * wb.getVMPageSize();
+        long stackProtectionSize = wb.getIntxVMFlag("StackShadowPages") * pageSize;
         System.out.println("Size of protected shadow pages: " + stackProtectionSize);
 
         long actualStackSize = wb.getThreadStackSize();
         System.out.println("Full stack size: " + actualStackSize);
 
-        if (Math.abs(actualStackSize - configStackSize) > configStackSize * 0.1) {
-            throw new RuntimeException("getThreadFullStackSize value [" + actualStackSize
-                                     + "] should be within 90%..110% of ThreadStackSize value");
+        if (!Platform.isAix()) {
+            if (Math.abs(actualStackSize - configStackSize) > configStackSize * 0.1) {
+                throw new RuntimeException("getThreadStackSize value [" + actualStackSize
+                                           + "] should be within 90%..110% of ThreadStackSize value");
+            }
+        } else {
+            // AIX pthread implementation returns stacks with sizes varying a lot.
+            // We add +64K to assure stacks are not too small, thus we get
+            // even more variation to bigger sizes. So only check the lower bound.
+            // Allow for at least one page deviation.
+            long slack = (long)(configStackSize * 0.1);
+            if (slack < pageSize) {
+                if (configStackSize - actualStackSize > pageSize) {
+                    throw new RuntimeException("getThreadStackSize value [" + actualStackSize
+                                               + "] should not be more than one page smaller than "
+                                               + "ThreadStackSize value");
+                }
+            } else {
+                if (configStackSize - actualStackSize > slack) {
+                    throw new RuntimeException("getThreadStackSize value [" + actualStackSize
+                                               + "] should not be less than 90% of ThreadStackSize value");
+                }
+            }
         }
 
         long remainingStackSize = wb.getThreadRemainingStackSize();
--- a/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java	Mon Jun 25 13:41:39 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java	Mon Jun 25 13:37:01 2018 +0200
@@ -27,6 +27,7 @@
  * @summary Tests that jvmtiEnv::GetPotentialCapabilities reports
  *          can_generate_all_class_hook_events capability with CDS (-Xshare:on)
  *          at ONLOAD and LIVE phases
+ * @requires vm.cds
  * @library /test/lib
  * @compile CanGenerateAllClassHook.java
  * @run main/othervm/native CanGenerateAllClassHook