Print some environment information at the start of SWTBot
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 20 Jan 2016 05:43:34 +0000 (00:43 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 20 Jan 2016 19:15:15 +0000 (14:15 -0500)
This will help us investigate failing tests in the case where the
environment differs from what is known to work.

Change-Id: I4b6cf42355050bf57d420a5a95df4e1b35618fe2
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/64723
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java

index 71995f8cc0f049378d5cdc27eb85b563c9f4666e..bb11e1d4d5449d8eb430c2e56adef45dd423d746 100644 (file)
@@ -77,6 +77,7 @@ public final class SWTBotUtils {
 
     private static final String WINDOW_MENU = "Window";
     private static final String PREFERENCES_MENU_ITEM = "Preferences";
+    private static boolean fPrintedEnvironment = false;
 
     private SWTBotUtils() {
     }
@@ -263,6 +264,7 @@ public final class SWTBotUtils {
 
         SWTWorkbenchBot bot = new SWTWorkbenchBot();
         UIThreadRunnable.syncExec(() -> {
+            printEnvironment();
 
             // There seems to be problems on some system where the main shell is
             // not in focus initially. This was seen using Xvfb and Xephyr on some occasions.
@@ -277,6 +279,35 @@ public final class SWTBotUtils {
         });
     }
 
+    private static void printEnvironment() {
+        if (fPrintedEnvironment) {
+            return;
+        }
+
+        // Print some information about the environment that could affect test outcome
+        Rectangle bounds = Display.getDefault().getBounds();
+        System.out.println("Display size: " + bounds.width + "x" + bounds.height);
+
+        String osVersion = System.getProperty("os.version");
+        if (osVersion != null) {
+            System.out.println("OS version=" + osVersion);
+        }
+        String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version");
+        if (gtkVersion != null) {
+            System.out.println("GTK version=" + gtkVersion);
+            String overlayScrollbar = System.getenv("LIBOVERLAY_SCROLLBAR");
+            if (overlayScrollbar != null) {
+                System.out.println("LIBOVERLAY_SCROLLBAR=" + overlayScrollbar);
+            }
+            String ubuntuMenuProxy = System.getenv("UBUNTU_MENUPROXY");
+            if (ubuntuMenuProxy != null) {
+                System.out.println("UBUNTU_MENUPROXY=" + ubuntuMenuProxy);
+            }
+        }
+
+        fPrintedEnvironment = true;
+    }
+
     /**
      * If the test is running in the UI thread then fail
      */
This page took 0.026554 seconds and 5 git commands to generate.