8166837: [TESTBUG] Fix tests on Linux/s390x
authorgoetz
Mon, 31 Oct 2016 11:36:45 +0100
changeset 42543 9e7ac7aff2d1
parent 42542 e8d67bf2f2de
child 42544 58de8aaf9365
8166837: [TESTBUG] Fix tests on Linux/s390x Reviewed-by: kvn, simonis
hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
hotspot/test/compiler/ciReplay/SABase.java
hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java
hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java
hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java
hotspot/test/test_env.sh
hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java	Mon Oct 31 11:36:45 2016 +0100
@@ -1957,7 +1957,7 @@
         if (doit == null) {
             out.println("Unrecognized command.  Try help...");
         } else if (!debugger.isAttached() && !doit.okIfDisconnected) {
-            out.println("Command not valid until the attached to a VM");
+            out.println("Command not valid until attached to a VM");
         } else {
             try {
                 doit.doit(args);
--- a/hotspot/test/compiler/ciReplay/SABase.java	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/test/compiler/ciReplay/SABase.java	Mon Oct 31 11:36:45 2016 +0100
@@ -39,7 +39,12 @@
 public class SABase extends CiReplayBase {
     private static final String REPLAY_FILE_COPY = "replay_vm.txt";
 
-    public static void main(String args[]) {
+    public static void main(String args[]) throws Exception {
+        if (!Platform.shouldSAAttach()) {
+            System.out.println("SA attach not expected to work - test skipped.");
+            return;
+        }
+
         checkSetLimits();
         new SABase(args).runTest(/* needCoreDump = */ true, args);
     }
--- a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java	Mon Oct 31 11:36:45 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -74,7 +74,7 @@
      *         instructions required by the option are not supported.
      */
     public static String getWarningForUnsupportedCPU(String optionName) {
-        if (Platform.isSparc() || Platform.isAArch64() ||
+        if (Platform.isAArch64() || Platform.isS390x() || Platform.isSparc() ||
             Platform.isX64() || Platform.isX86()) {
             switch (optionName) {
             case SHAOptionsBase.USE_SHA_OPTION:
@@ -89,7 +89,7 @@
                 throw new Error("Unexpected option " + optionName);
             }
         } else {
-            throw new Error("Support for CPUs different fromn X86, SPARC, and AARCH64 "
+            throw new Error("Support for CPUs different fromn AARCH64, S390x, SPARC, and X86 "
                             + "is not implemented");
         }
     }
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java	Mon Oct 31 11:36:45 2016 +0100
@@ -37,11 +37,12 @@
 public class GenericTestCaseForOtherCPU extends
         SHAOptionsBase.TestCase {
     public GenericTestCaseForOtherCPU(String optionName) {
-        // Execute the test case on any CPU except SPARC and X86
+        // Execute the test case on any CPU except AArch64, S390x, SPARC and X86.
         super(optionName, new NotPredicate(
-                new OrPredicate(
-                    new OrPredicate(Platform::isSparc, Platform::isAArch64),
-                    new OrPredicate(Platform::isX64, Platform::isX86))));
+                              new OrPredicate(Platform::isAArch64,
+                              new OrPredicate(Platform::isS390x,
+                              new OrPredicate(Platform::isSparc,
+                              new OrPredicate(Platform::isX64, Platform::isX86))))));
     }
 
     @Override
--- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java	Mon Oct 31 11:36:45 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -59,33 +59,35 @@
     };
 
     public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
-            = new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { "sha" },null),
-              new OrPredicate(
-                      new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },null),
-                      new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" },null)))));
+            = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" }, null),
+              new OrPredicate(new CPUSpecificPredicate("s390.*",    new String[] { "sha1" }, null),
+              new OrPredicate(new CPUSpecificPredicate("sparc.*",   new String[] { "sha1" }, null),
+              // x86 variants
+              new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "sha" },  null),
+              new OrPredicate(new CPUSpecificPredicate("i386.*",    new String[] { "sha" },  null),
+                              new CPUSpecificPredicate("x86.*",     new String[] { "sha" },  null))))));
 
     public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE
-            = new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] {
-"sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null),
-              new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "avx2", "bmi2" }, null),
-              new OrPredicate(
-                      new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },null),
-                      new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" },null)))))));
+            = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha256"       }, null),
+              new OrPredicate(new CPUSpecificPredicate("s390.*",    new String[] { "sha256"       }, null),
+              new OrPredicate(new CPUSpecificPredicate("sparc.*",   new String[] { "sha256"       }, null),
+              // x86 variants
+              new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "sha"          }, null),
+              new OrPredicate(new CPUSpecificPredicate("i386.*",    new String[] { "sha"          }, null),
+              new OrPredicate(new CPUSpecificPredicate("x86.*",     new String[] { "sha"          }, null),
+              new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "avx2", "bmi2" }, null),
+                              new CPUSpecificPredicate("x86_64",    new String[] { "avx2", "bmi2" }, null))))))));
 
     public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE
-            = new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { "sha" },null),
-              new OrPredicate(new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null),
-              new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "avx2", "bmi2" }, null),
-              new OrPredicate(
-                      new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },null),
-                      new CPUSpecificPredicate("aarch64.*", new String[] { "sha512" },null)))))));
+            = new OrPredicate(new CPUSpecificPredicate("aarch64.*", new String[] { "sha512"       }, null),
+              new OrPredicate(new CPUSpecificPredicate("s390.*",    new String[] { "sha512"       }, null),
+              new OrPredicate(new CPUSpecificPredicate("sparc.*",   new String[] { "sha512"       }, null),
+              // x86 variants
+              new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "sha"          }, null),
+              new OrPredicate(new CPUSpecificPredicate("i386.*",    new String[] { "sha"          }, null),
+              new OrPredicate(new CPUSpecificPredicate("x86.*",     new String[] { "sha"          }, null),
+              new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "avx2", "bmi2" }, null),
+                              new CPUSpecificPredicate("x86_64",    new String[] { "avx2", "bmi2" }, null))))))));
 
     public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
             = new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
--- a/hotspot/test/test_env.sh	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/test/test_env.sh	Mon Oct 31 11:36:45 2016 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+#  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
@@ -204,6 +204,11 @@
 then
   VM_CPU="ia64"
 fi
+grep "s390x" vm_version.out > ${NULL}
+if [ $? = 0 ]
+then
+  VM_CPU="s390x"
+fi
 grep "aarch64" vm_version.out > ${NULL}
 if [ $? = 0 ]
 then
--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Mon Nov 07 10:12:14 2016 +0100
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Mon Oct 31 11:36:45 2016 +0100
@@ -45,7 +45,7 @@
  */
 public class TestMutuallyExclusivePlatformPredicates {
     private static enum MethodGroup {
-        ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64", "isAArch64"),
+        ARCH("isAArch64", "isARM", "isPPC", "isS390x", "isSparc", "isX64", "isX86"),
         BITNESS("is32bit", "is64bit"),
         OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),