changeset 338:3159862dbcdb

Runners: better diagnostics when VM options are rejected.
author shade
date Thu, 17 Nov 2016 13:02:04 +0100
parents 474614a894d4
children 2e689d5a271a
files jcstress-core/src/main/java/org/openjdk/jcstress/JCStress.java jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/JCStress.java	Mon Oct 31 17:52:26 2016 +0100
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/JCStress.java	Thu Nov 17 13:02:04 2016 +0100
@@ -54,8 +54,13 @@
     }
 
     public void run() throws Exception {
-        VMSupport.initSupport();
         VMSupport.detectAvailableVMModes(opts.getJvmArgs());
+        if (VMSupport.getAvailableVMModes().isEmpty()) {
+            out.println("FATAL: No JVM modes to run with.");
+            return;
+        }
+
+        VMSupport.initFlags();
 
         opts.printSettingsOn(out);
 
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java	Mon Oct 31 17:52:26 2016 +0100
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java	Thu Nov 17 13:02:04 2016 +0100
@@ -46,7 +46,7 @@
         return THREAD_SPIN_WAIT_AVAILABLE;
     }
 
-    public static void initSupport() {
+    public static void initFlags() {
         System.out.println("Initializing and probing the target VM: ");
         System.out.println(" (all failures are non-fatal, but may affect testing accuracy)");
         System.out.println();
@@ -148,9 +148,11 @@
                 line.add(SimpleTestMain.class.getName());
                 tryWith(line.toArray(new String[0]));
                 AVAIL_JVM_MODES.add(mode);
-                System.out.printf("   [OK] %s%n", mode);
+                System.out.printf("----- [OK] %s%n", mode);
             } catch (VMSupportException e) {
-                System.out.printf("  [N/A] %s%n", mode);
+                System.out.printf("----- [N/A] %s%n", mode);
+                System.out.println(e.getMessage());
+                System.out.println();
             }
         }
         System.out.println();