changeset 52405:e9177e7749e7

8210039: move OSInfo to top level testlibrary Reviewed-by: serb, chegar, alanb, dfuchs
author iignatyev
date Tue, 04 Sep 2018 14:35:59 -0700
parents ab722555e66d
children 2e4cf4ca074c
files test/jdk/com/oracle/security/ucrypto/TestAES.java test/jdk/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java test/jdk/java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.html test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java test/jdk/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java test/jdk/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java test/jdk/java/awt/Desktop/8064934/bug8064934.java test/jdk/java/awt/FileDialog/8003399/bug8003399.java test/jdk/java/awt/FileDialog/8017487/bug8017487.java test/jdk/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html test/jdk/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java test/jdk/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html test/jdk/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java test/jdk/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java test/jdk/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.html test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.html test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.java test/jdk/java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java test/jdk/java/awt/MenuBar/8007006/bug8007006.java test/jdk/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java test/jdk/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java test/jdk/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java test/jdk/java/awt/Robot/RobotWheelTest/RobotWheelTest.java test/jdk/java/awt/TextArea/ScrollbarIntersectionTest/ScrollbarIntersectionTest.java test/jdk/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java test/jdk/java/awt/TrayIcon/8072769/bug8072769.java test/jdk/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html test/jdk/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java test/jdk/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java test/jdk/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html test/jdk/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java test/jdk/java/awt/dnd/ImageTransferTest/ImageTransferTest.java test/jdk/java/awt/event/KeyEvent/8020209/bug8020209.java test/jdk/java/awt/event/KeyEvent/DeadKey/DeadKeyMacOSXInputText.java test/jdk/java/awt/event/KeyEvent/DeadKey/deadKeyMacOSX.java test/jdk/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java test/jdk/java/awt/image/MultiResolutionImage/NSImageToMultiResolutionImageTest.java test/jdk/java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java test/jdk/javax/swing/JButton/4796987/bug4796987.java test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java test/jdk/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java test/jdk/javax/swing/JComboBox/4199622/bug4199622.java test/jdk/javax/swing/JFileChooser/4150029/bug4150029.html test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java test/jdk/javax/swing/JFileChooser/4524490/bug4524490.java test/jdk/javax/swing/JFileChooser/6840086/bug6840086.java test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java test/jdk/javax/swing/JFileChooser/8062561/bug8062561.java test/jdk/javax/swing/JFrame/8016356/bug8016356.java test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java test/jdk/javax/swing/JInternalFrame/4251301/bug4251301.java test/jdk/javax/swing/JLabel/6596966/bug6596966.java test/jdk/javax/swing/JMenu/6470128/bug6470128.java test/jdk/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java test/jdk/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java test/jdk/javax/swing/JPopupMenu/6827786/bug6827786.java test/jdk/javax/swing/JPopupMenu/7154841/bug7154841.java test/jdk/javax/swing/JScrollBar/bug4202954/bug4202954.java test/jdk/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java test/jdk/javax/swing/JSlider/6579827/bug6579827.java test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java test/jdk/javax/swing/JTabbedPane/6416920/bug6416920.java test/jdk/javax/swing/JTextArea/6940863/bug6940863.java test/jdk/javax/swing/UITest/UITest.java test/jdk/javax/swing/plaf/aqua/CustomComboBoxFocusTest.java test/jdk/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java test/jdk/jdk/net/Sockets/Test.java test/jdk/jdk/net/Sockets/policy.fail test/jdk/jdk/net/Sockets/policy.success test/jdk/lib/testlibrary/jdk/testlibrary/OSInfo.java test/jdk/sun/awt/dnd/8024061/bug8024061.java test/lib/jdk/test/lib/OSVersion.java test/lib/jdk/test/lib/Platform.java test/lib/jdk/test/lib/process/ProcessTools.java
diffstat 85 files changed, 637 insertions(+), 743 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/com/oracle/security/ucrypto/TestAES.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/com/oracle/security/ucrypto/TestAES.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,6 +39,7 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 
+import jdk.test.lib.OSVersion;
 import jdk.test.lib.Platform;
 import jdk.test.lib.Utils;
 
@@ -376,9 +377,6 @@
 
     // The cases on CFB128 mode have to be skipped on pre-S11.3.
     private static boolean isBadSolaris() {
-        return Platform.isSolaris()
-                && Platform.getOsVersionMajor() <= 5
-                && Platform.getOsVersionMinor() <= 11
-                && Utils.distro().compareTo("11.3") < 0;
+        return Platform.isSolaris() && OSVersion.current().compareTo(new OSVersion(11, 3)) < 0;
     }
 }
--- a/test/jdk/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,6 +29,7 @@
  * @author  Jaroslav Bachorik
  *
  * @library /lib/testlibrary
+ * @library /test/lib
  *
  * @build TestTotalSwap jdk.testlibrary.*
  * @run main TestTotalSwap
@@ -55,7 +56,7 @@
 import com.sun.management.OperatingSystemMXBean;
 import java.lang.management.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.OutputAnalyzer;
 
@@ -110,56 +111,48 @@
     }
 
     private static long getSwapSizeFromOs() throws Throwable {
-        OSInfo.OSType os = OSInfo.getOSType();
-
-        switch (os) {
+        if (Platform.isLinux()) {
             // total       used       free     shared    buffers     cached
             // Mem:    16533540864 13638467584 2895073280  534040576 1630248960 6236909568
             // -/+ buffers/cache: 5771309056 10762231808
             // Swap:   15999168512          0 15999168512
-
-            case LINUX: {
-                String swapSizeStr = ProcessTools.executeCommand("free", "-b")
-                                        .firstMatch("Swap:\\s+([0-9]+)\\s+.*", 1);
-                return Long.parseLong(swapSizeStr);
-            }
-            case SOLARIS: {
-                // swapfile             dev   swaplo blocks   free
-                // /dev/dsk/c0t0d0s1   136,1      16 1638608 1600528
-                OutputAnalyzer out= ProcessTools.executeCommand(
+            String swapSizeStr = ProcessTools.executeCommand("free", "-b")
+                                             .firstMatch("Swap:\\s+([0-9]+)\\s+.*", 1);
+            return Long.parseLong(swapSizeStr);
+        } else if (Platform.isSolaris()) {
+            // swapfile             dev   swaplo blocks   free
+            // /dev/dsk/c0t0d0s1   136,1      16 1638608 1600528
+            OutputAnalyzer out= ProcessTools.executeCommand(
                     "/usr/sbin/swap",
                     "-l"
-                );
+            );
 
-                long swapSize = 0;
+            long swapSize = 0;
 
-                for (String line : out.asLines()) {
-                    if (line.contains("swapfile")) continue;
+            for (String line : out.asLines()) {
+                if (line.contains("swapfile")) continue;
 
-                    String[] vals = line.split("\\s+");
-                    if (vals.length == 5) {
-                        swapSize += Long.parseLong(vals[3]) * 512; // size is reported in 512b blocks
-                    }
+                String[] vals = line.split("\\s+");
+                if (vals.length == 5) {
+                    swapSize += Long.parseLong(vals[3]) * 512; // size is reported in 512b blocks
                 }
+            }
 
-                return swapSize;
-            }
-            case MACOSX: {
-                // total = 8192.00M used = 7471.11M free = 720.89M (encrypted)
-                String swapSizeStr = ProcessTools.executeCommand(
+            return swapSize;
+        } else if (Platform.isOSX()) {
+            // total = 8192.00M used = 7471.11M free = 720.89M (encrypted)
+            String swapSizeStr = ProcessTools.executeCommand(
                     "/usr/sbin/sysctl",
                     "-n",
                     "vm.swapusage"
-                ).firstMatch("total\\s+=\\s+([0-9]+(\\.[0-9]+)?[Mm]?).*", 1);
-                if (swapSizeStr.toLowerCase().endsWith("m")) {
-                    swapSizeStr = swapSizeStr.substring(0, swapSizeStr.length() - 1);
-                    return (long)(Double.parseDouble(swapSizeStr) * 1024 * 1024); // size in MB
-                }
-                return (long)(Double.parseDouble(swapSizeStr) * 1024 * 1024);
+            ).firstMatch("total\\s+=\\s+([0-9]+(\\.[0-9]+)?[Mm]?).*", 1);
+            if (swapSizeStr.toLowerCase().endsWith("m")) {
+                swapSizeStr = swapSizeStr.substring(0, swapSizeStr.length() - 1);
+                return (long)(Double.parseDouble(swapSizeStr) * 1024 * 1024); // size in MB
             }
-            default: {
-                System.err.println("Unsupported operating system: " + os);
-            }
+            return (long)(Double.parseDouble(swapSizeStr) * 1024 * 1024);
+        } else {
+            System.err.println("Unsupported operating system: " + Platform.getOsName());
         }
 
         return -1;
--- a/test/jdk/java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,15 +28,15 @@
   @summary awt Choice doesn't fire ItemStateChange when selecting item after select() call
   @author Oleg Pekhovskiy: area=awt-choice
   @library ../../regtesthelpers
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @modules java.desktop/sun.awt
   @build Util
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @run main ItemStateChangeTest
 */
 
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Util;
-import jdk.testlibrary.OSInfo;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -51,7 +51,7 @@
 
     public ItemStateChangeTest() {
 
-        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
+        if (!Platform.isWindows()) {
             return;
         }
 
--- a/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2004, 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
@@ -28,8 +28,8 @@
   @bug 5044150
   @summary Tests that pupup doesn't popdown if no space to display under 
   @author ssi@sparc.spb.su
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run applet PopupPosTest.html
   -->
 <head>
--- a/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -26,8 +26,8 @@
   @bug 5044150
   @summary Tests that pupup doesn't popdown if no space to display under
   @author andrei.dmitriev area=awt.choice
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run applet PopupPosTest.html
 */
 
@@ -35,13 +35,13 @@
 import java.awt.*;
 import java.awt.event.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class PopupPosTest extends Applet
 {
     public void start ()
     {
-        if(OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+        if (Platform.isOSX()) {
             // On OS X, popup isn't under the mouse
             return;
         }
--- a/test/jdk/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -26,15 +26,15 @@
   @bug 6399679
   @summary Choice is not invalidated when the frame gets resized programmatically when the drop-down is visible
   @author andrei.dmitriev area=awt.choice
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run main ResizeAutoClosesChoice
 */
 
 import java.awt.*;
 import java.awt.event.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class ResizeAutoClosesChoice
 {
@@ -46,7 +46,7 @@
     static Button button = new Button("This button causes Frame to be resized on pack()");
     public static void main(String args[]) throws Exception
     {
-        if(OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+        if (Platform.isOSX()) {
             System.out.println("Not for OS OX");
             return;
         }
--- a/test/jdk/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -34,16 +34,17 @@
 import java.awt.image.BaseMultiResolutionImage;
 import java.awt.image.BufferedImage;
 import javax.swing.JApplet;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 /**
  * @test
  * @bug 8028212
  * @summary [macosx] Custom Cursor HiDPI support
  * @author Alexander Scherbatiy
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/sun.awt.image
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @run applet/manual=yesno MultiResolutionCursorTest.html
  */
 public class MultiResolutionCursorTest extends JApplet {
@@ -58,7 +59,7 @@
         // etc.
         this.setLayout(new BorderLayout());
 
-        if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+        if (Platform.isOSX()) {
             String[] instructions = {
                 "Verify that high resolution custom cursor is used"
                 + " on HiDPI displays.",
--- a/test/jdk/java/awt/Desktop/8064934/bug8064934.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Desktop/8064934/bug8064934.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -27,16 +27,17 @@
  * @requires (os.family == "windows")
  * @summary Incorrect Exception message from java.awt.Desktop.open()
  * @author Dmitry Markov
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/sun.awt
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @run main bug8064934
  */
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import java.awt.*;
 import java.io.File;
 import java.io.IOException;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 public class bug8064934 {
     private static final String NO_ASSOCIATION_ERROR_MESSAGE = "Error message: No application is associated with" +
@@ -44,7 +45,7 @@
 
     public static void main(String[] args) {
         // This test is intended only for Windows
-        if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) != OSInfo.OSType.WINDOWS) {
+        if (!AccessController.doPrivileged((PrivilegedAction<Boolean>) Platform::isWindows)) {
             System.out.println("The test is for Windows platform only");
             return;
         }
--- a/test/jdk/java/awt/FileDialog/8003399/bug8003399.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/FileDialog/8003399/bug8003399.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -25,12 +25,13 @@
    @bug 8003399
    @summary JFileChooser gives wrong path to selected file when saving to Libraries folder on Windows 7
    @author Semyon Sadetsky
-   @library /lib/testlibrary
-   @build jdk.testlibrary.OSInfo
+   @library /test/lib
+   @build jdk.test.lib.OSVersion jdk.test.lib.Platform
    @run main bug8003399
   */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
+import jdk.test.lib.OSVersion;
 
 import javax.swing.filechooser.FileSystemView;
 import java.io.File;
@@ -38,8 +39,8 @@
 public class bug8003399 {
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
-                OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_VISTA) > 0 ) {
+        if (Platform.isWindows() &&
+                OSVersion.current().compareTo(OSVersion.WINDOWS_VISTA) > 0 ) {
             FileSystemView fsv = FileSystemView.getFileSystemView();
             for (File file : fsv.getFiles(fsv.getHomeDirectory(), false)) {
                 if(file.isDirectory()) {
--- a/test/jdk/java/awt/FileDialog/8017487/bug8017487.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/FileDialog/8017487/bug8017487.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -26,13 +26,14 @@
    @summary filechooser in Windows-Libraries folder: columns are mixed up
    @author Semyon Sadetsky
    @modules java.desktop/sun.awt.shell
-   @library /lib/testlibrary
-   @build jdk.testlibrary.OSInfo
+   @library /test/lib
+   @build jdk.test.lib.OSVersion jdk.test.lib.Platform
    @run main bug8017487
   */
 
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
+import jdk.test.lib.OSVersion;
 
 import sun.awt.shell.ShellFolder;
 import sun.awt.shell.ShellFolderColumnInfo;
@@ -42,8 +43,8 @@
 public class bug8017487
 {
     public static void main(String[] p_args) throws Exception {
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
-                OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_VISTA) > 0 ) {
+        if (Platform.isWindows() &&
+                OSVersion.current().compareTo(OSVersion.WINDOWS_VISTA) > 0 ) {
             test();
             System.out.println("ok");
         }
--- a/test/jdk/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 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
@@ -28,9 +28,9 @@
   @summary We should support "apple.awt.fileDialogForDirectories" property.
   @author Sergey Bylokhov area=awt.filedialog
   @library ../../regtesthelpers
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @build Sysout
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @run applet/manual=yesno FileDialogForDirectories.html
   -->
 <head>
--- a/test/jdk/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -22,7 +22,7 @@
  */
 
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Sysout;
 
 import java.applet.Applet;
@@ -39,7 +39,7 @@
 
     @Override
     public void init() {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             Sysout.createDialogWithInstructions(new String[]{
                     "Press PASS, this test is for MacOS X only."});
             return;
--- a/test/jdk/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 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
@@ -28,9 +28,9 @@
   @summary Support apple.awt.use-file-dialog-packages property.
   @author Petr Pchelko area=awt.filedialog
   @library ../../regtesthelpers
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @build Sysout
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @run applet/manual=yesno FileDialogForPackages.html
   -->
 <head>
--- a/test/jdk/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -22,7 +22,7 @@
  */
 
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Sysout;
 
 import java.applet.Applet;
@@ -41,7 +41,7 @@
 
     @Override
     public void init() {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             Sysout.createDialogWithInstructions(new String[]{
                     "Press PASS, this test is for MacOS X only."});
             return;
--- a/test/jdk/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -38,7 +38,7 @@
 import javax.swing.JPopupMenu;
 import javax.swing.WindowConstants;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 /**
  * @test
@@ -47,8 +47,8 @@
  * @summary Focus request & mouse click being performed nearly synchronously
  *          shouldn't break the focus subsystem
  * @author  anton.tarasov@sun.com: area=awt-focus
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main MouseClickRequestFocusRaceTest
  */
 public class MouseClickRequestFocusRaceTest {
@@ -149,7 +149,7 @@
             throw new RuntimeException("The focus owner is not in the focused window!");
         }
 
-        if (!OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+        if (!Platform.isOSX()) {
             // Try to close native focused window
             robot.keyPress(KeyEvent.VK_ALT);
             robot.keyPress(KeyEvent.VK_F4);
--- a/test/jdk/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,12 +27,12 @@
  * @bug 8026143
  * @summary [macosx] Maximized state could be inconsistent between peer and frame
  * @author Petr Pchelko
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main MaximizedByPlatform
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 import java.awt.*;
 
@@ -41,7 +41,7 @@
     private static Rectangle availableScreenBounds;
 
     public static void main(String[] args) {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             // Test only for macosx. Pass
             return;
         }
--- a/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2006, 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
@@ -28,8 +28,8 @@
   @bug        6346690
   @summary    Tests that key_typed is consumed after mnemonic key_pressed is handled for a menu item.
   @author     anton.tarasov@sun.com: area=awt-focus
-  @library   ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library    /test/lib
+  @build      jdk.test.lib.Platform
   @run        applet ConsumeNextMnemonicKeyTypedTest.html
   -->
 <head>
--- a/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -26,11 +26,13 @@
   @bug       6346690
   @summary   Tests that key_typed is consumed after mnemonic key_pressed is handled for a menu item.
   @author    anton.tarasov@sun.com: area=awt-focus
-  @library   ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library   /test/lib
+  @build     jdk.test.lib.Platform
   @run       applet ConsumeNextMnemonicKeyTypedTest.html
 */
 
+import jdk.test.lib.Platform;
+
 import java.awt.*;
 import javax.swing.*;
 import java.awt.event.*;
@@ -116,7 +118,7 @@
 
         robot.waitForIdle();
 
-        if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             robot.keyPress(KeyEvent.VK_CONTROL);
         }
         robot.keyPress(KeyEvent.VK_ALT);
@@ -124,7 +126,7 @@
         robot.delay(100);
         robot.keyRelease(KeyEvent.VK_F);
         robot.keyRelease(KeyEvent.VK_ALT);
-        if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             robot.keyRelease(KeyEvent.VK_CONTROL);
         }
 
--- a/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2006, 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
@@ -29,9 +29,9 @@
   @summary    Submenu should be shown by mnemonic key press.
   @author     anton.tarasov@...: area=awt.focus
   @library    ../../../regtesthelpers
-  @library    ../../../../../lib/testlibrary
+  @library    /test/lib
   @build      Util
-  @build      jdk.testlibrary.OSInfo
+  @build      jdk.test.lib.Platform
   @run        applet SubMenuShowTest.html
   -->
 <head>
--- a/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -35,8 +35,9 @@
 import java.applet.Applet;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.lang.reflect.InvocationTargetException;
+
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Util;
-import jdk.testlibrary.OSInfo;
 
 public class SubMenuShowTest extends Applet {
     Robot robot;
@@ -85,7 +86,7 @@
 
         frame.setVisible(true);
 
-        boolean isMacOSX = (OSInfo.getOSType() == OSInfo.OSType.MACOSX);
+        boolean isMacOSX = Platform.isOSX();
         if (isMacOSX) {
             robot.keyPress(KeyEvent.VK_CONTROL);
         }
--- a/test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2013, 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
@@ -27,8 +27,8 @@
   @bug 6299858
   @summary PIT. Focused border not shown on List if selected item is removed, XToolkit
   @author Dmitry.Cherepanov@SUN.COM area=awt.list
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run applet FirstItemRemoveTest.html
   -->
 <head>
--- a/test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -29,6 +29,8 @@
   @run applet FirstItemRemoveTest.html
 */
 
+import jdk.test.lib.Platform;
+
 import java.applet.Applet;
 import java.awt.*;
 import java.awt.event.*;
@@ -65,7 +67,7 @@
 
     private void test(){
 
-        if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             System.err.println("Skipped. This test is not for OS X.");
             return;
         }
--- a/test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
@@ -28,8 +28,8 @@
   @bug 6190768 6190778
   @summary Tests that triggering events on AWT list by pressing CTRL + HOME, CTRL + END, PG-UP, PG-DOWN similar Motif behavior
   @author Dmitry.Cherepanov@SUN.COM area=awt.list
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run applet KeyEventsTest.html
   -->
 <head>
--- a/test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -26,8 +26,8 @@
   @bug 6190768 6190778
   @summary Tests that triggering events on AWT list by pressing CTRL + HOME, CTRL + END, PG-UP, PG-DOWN similar Motif behavior
   @author Dmitry.Cherepanov@SUN.COM area=awt.list
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run applet KeyEventsTest.html
 */
 
@@ -43,7 +43,7 @@
 import java.util.Set;
 import java.lang.reflect.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class KeyEventsTest extends Applet implements ItemListener, FocusListener, KeyListener
 {
@@ -273,9 +273,9 @@
       throws InterruptedException, InvocationTargetException {
 
         boolean isWin = false;
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+        if (Platform.isWindows()) {
             isWin = true;
-        }else if(OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        } else if (Platform.isOSX()) {
             System.out.println("Not for OS X");
             return;
         }
--- a/test/jdk/java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java	Tue Sep 04 14:35:59 2018 -0700
@@ -28,9 +28,9 @@
   @summary REG: Menu does not disappear when clicked, keeping Choice's drop-down open, XToolkit
   @author andrei.dmitriev: area=awt.menu
   @library ../../regtesthelpers
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @modules java.desktop/sun.awt
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @build Util
   @run main OpensWithNoGrab
 */
@@ -38,7 +38,7 @@
 import java.awt.*;
 import java.awt.event.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Util;
 
 public class OpensWithNoGrab
@@ -46,8 +46,7 @@
     final static int delay = 50;
     private static void init()
     {
-        if (!(OSInfo.getOSType().equals(OSInfo.OSType.LINUX)
-                || OSInfo.getOSType().equals(OSInfo.OSType.SOLARIS))) {
+        if (!(Platform.isLinux() || Platform.isSolaris())) {
             System.out.println("This test is for XAWT/Motif only");
             OpensWithNoGrab.pass();
         }
--- a/test/jdk/java/awt/MenuBar/8007006/bug8007006.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/MenuBar/8007006/bug8007006.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,22 +27,22 @@
  * @bug 8007006
  * @summary [macosx] Closing subwindow loses main window menus.
  * @author Leonid Romanov
- * @library ../../../../lib/testlibrary
- * @build ExtendedRobot jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build ExtendedRobot jdk.test.lib.Platform
  * @run main bug8007006
  */
 
 import java.awt.*;
 import java.awt.event.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class bug8007006 {
     private static Frame frame1;
     private static Frame frame2;
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
--- a/test/jdk/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -33,7 +33,7 @@
 import java.awt.event.ActionListener;
 import java.awt.event.InputEvent;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 /**
  * @test
@@ -41,8 +41,8 @@
  * @bug 6263470
  * @summary Tries to change font of MenuBar. Test passes if the font has changed
  * fails otherwise.
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @author Vyacheslav.Baranov: area=menu
  * @run main MenuBarSetFont
  */
@@ -68,7 +68,7 @@
 
     public static void main(final String[] args) throws Exception {
 
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             System.err.println("This test is not for OS X. Menu.setFont() is not supported on OS X.");
             return;
         }
--- a/test/jdk/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -27,12 +27,12 @@
   @bug 6315717
   @summary verifies that modifiers are correct for extra buttons
   @author Andrei Dmitriev : area=awt.mouse
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run main MouseModifiersUnitTest_Extra
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -66,14 +66,14 @@
     static int [] modifiersExStandardCTRL;
     static int [] modifiersExStandardALT;
 
-    private final static String SHIFT_MODIFIER = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ?
+    private final static String SHIFT_MODIFIER = Platform.isOSX() ?
                                                 "\u21e7" : "Shift";
 
-    private final static String ALT_MODIFIER = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ?
+    private final static String ALT_MODIFIER = Platform.isOSX() ?
                                                 "\u2325" : "Alt";
 
 
-    private final static String CTRL_MODIFIER = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ?
+    private final static String CTRL_MODIFIER = Platform.isOSX() ?
                                                 "\u2303" : "Ctrl";
 
 
--- a/test/jdk/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,8 +28,8 @@
   @summary Frame is not created on the specified GraphicsDevice with two
 monitors
   @author Oleg Pekhovskiy
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run main MultiScreenInsetsTest
  */
 
@@ -40,14 +40,14 @@
 import java.awt.Insets;
 import java.awt.Rectangle;
 import java.awt.Toolkit;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class MultiScreenInsetsTest {
     private static final int SIZE = 100;
 
     public static void main(String[] args) throws InterruptedException {
-        OSInfo.OSType type = OSInfo.getOSType();
-        if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) {
+        if (!Platform.isLinux() && !Platform.isSolaris()) {
             System.out.println("This test is for Solaris and Linux only..." +
                                "skipping!");
             return;
--- a/test/jdk/java/awt/Robot/RobotWheelTest/RobotWheelTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Robot/RobotWheelTest/RobotWheelTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,7 +24,8 @@
 import java.awt.Frame;
 import java.awt.Rectangle;
 import java.awt.Robot;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 /*
  * @test 1.2 98/08/05
@@ -32,8 +33,8 @@
  * @bug 4373478 8079255
  * @summary Test mouse wheel functionality of Robot
  * @author bchristi: area=Robot
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main RobotWheelTest
  */
 public class RobotWheelTest {
@@ -45,7 +46,7 @@
 
         Frame frame = null;
         try {
-            int wheelSign = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ? -1 : 1;
+            int wheelSign = Platform.isOSX() ? -1 : 1;
 
             frame = new Frame();
             frame.setSize(200, 200);
--- a/test/jdk/java/awt/TextArea/ScrollbarIntersectionTest/ScrollbarIntersectionTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/TextArea/ScrollbarIntersectionTest/ScrollbarIntersectionTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -28,15 +28,15 @@
   @summary Tests that mouse click at the are of intersection of two
    scrollbars for text area doesn't trigger any scrolling
   @author artem.ananiev@sun.com: area=awt.text
-  @library ../../../../lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run main ScrollbarIntersectionTest
 */
 
 import java.awt.*;
 import java.awt.event.*;
-import jdk.testlibrary.OSInfo;
 
+import jdk.test.lib.Platform;
 
 public class ScrollbarIntersectionTest
 {
@@ -134,7 +134,7 @@
 
     public static void main( String args[] ) throws InterruptedException
     {
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             // On OS X, this area is commandeered by the system,
             // and frame would be wildly resized
             System.out.println("Not for OS X");
--- a/test/jdk/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,16 +26,18 @@
  * @bug 7129133
  * @summary [macosx] Accelerators are displayed as Meta instead of the Command symbol
  * @author leonid.romanov@oracle.com
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug7129133
  */
 
+import jdk.test.lib.Platform;
+
 import java.awt.*;
 
 public class bug7129133 {
     public static void main(String[] args) throws Exception {
-        if (jdk.testlibrary.OSInfo.getOSType() != jdk.testlibrary.OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
--- a/test/jdk/java/awt/TrayIcon/8072769/bug8072769.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/TrayIcon/8072769/bug8072769.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -27,12 +27,12 @@
    @requires (os.family == "windows")
    @summary System tray icon title freezes java
    @author Semyon Sadetsky
-   @library ../../../../lib/testlibrary
-   @build jdk.testlibrary.OSInfo
+   @library /test/lib
+   @build jdk.test.lib.Platform
    @run main bug8072769
   */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 import javax.swing.*;
 import java.awt.*;
@@ -41,7 +41,7 @@
 public class bug8072769 {
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+        if (Platform.isWindows()) {
             if (SystemTray.isSupported()) {
                 test();
             } else {
--- a/test/jdk/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,7 +1,7 @@
 <html>
 
 <!--
- Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2014, 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
@@ -28,9 +28,9 @@
   @bug 6284070
   @summary Tests that ActionEvent is generated when a tray icon is double-clicked
   @library ../../regtesthelpers
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @build Sysout
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @author artem.ananiev: area=awt.tray
   @run applet/manual=yesno DblClickActionEventTest.html
   -->
--- a/test/jdk/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,7 +37,7 @@
 import java.awt.event.*;
 import java.awt.image.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Sysout;
 
 public class DblClickActionEventTest extends Applet {
@@ -50,7 +50,7 @@
         traySupported = SystemTray.isSupported();
         if (traySupported) {
             String clickInstruction;
-            if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            if (Platform.isOSX()) {
                 clickInstruction = "right";
             } else {
                 clickInstruction = "left";
--- a/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,7 +1,7 @@
 <html>
 
 <!--
- Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2014, 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
@@ -29,9 +29,9 @@
   @summary Tests that no NPE is thrown when the tray icon is disposed from the
   handler of action event caused by clicking on this icon.
   @library ../../regtesthelpers
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @build Sysout
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @author artem.ananiev: area=awt.tray
   @run applet/manual=yesno DisposeInActionEventTest.html
   -->
--- a/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,7 +38,7 @@
 import java.awt.*;
 import java.awt.image.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.Sysout;
 
 public class DisposeInActionEventTest extends Applet {
@@ -59,7 +59,7 @@
             };
         } else {
             String clickInstruction;
-            if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            if (Platform.isOSX()) {
                 clickInstruction = "right";
             } else {
                 clickInstruction = "left";
--- a/test/jdk/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,13 +28,15 @@
  * @summary WIN: Provide a way to format HTML on drop
  * @author Denis Fokin: area=datatransfer
  * @requires (os.family == "windows")
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @build HtmlTransferable PutAllHtmlFlavorsOnClipboard
  * @build PutOnlyAllHtmlFlavorOnClipboard PutSelectionAndFragmentHtmlFlavorsOnClipboard
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @run main HTMLDataFlavorTest
  */
 
+import jdk.test.lib.Platform;
+
 import java.awt.*;
 import java.awt.datatransfer.*;
 import java.io.*;
@@ -47,7 +49,7 @@
 
     public static void main(String[] args) throws IOException, UnsupportedFlavorException {
 
-        if (jdk.testlibrary.OSInfo.getOSType() != jdk.testlibrary.OSInfo.OSType.WINDOWS) {
+        if (!Platform.isWindows()) {
             System.err.println("This test is for MS Windows only. Considered passed.");
             return;
         }
--- a/test/jdk/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 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
@@ -30,10 +30,10 @@
   @author mikhail.cherkasov@oracle.com
   @library ../../regtesthelpers
   @library ../../regtesthelpers/process
-  @library ../../../../lib/testlibrary
+  @library /test/lib
   @build Util
   @build ProcessResults ProcessCommunicator
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @run applet/othervm MissedHtmlAndRtfBug.html
 -->
 
--- a/test/jdk/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,10 +28,10 @@
 import java.io.File;
 import java.util.ArrayList;
 
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
 import test.java.awt.regtesthelpers.process.ProcessResults;
 import test.java.awt.regtesthelpers.Util;
-import jdk.testlibrary.OSInfo;
 
 import static java.lang.Thread.sleep;
 
@@ -42,8 +42,7 @@
     }//End  init()
 
     public void start() {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX
-                && OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
+        if (!Platform.isOSX() && !Platform.isWindows()) {
             System.out.println("This test is for Windows and Mac only. Passed.");
             return;
         }
--- a/test/jdk/java/awt/dnd/ImageTransferTest/ImageTransferTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/dnd/ImageTransferTest/ImageTransferTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -27,16 +27,16 @@
  * @bug 4397404 4720930 8197926
  * @summary tests that images of all supported native image formats are
  * transferred properly
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @library ../../regtesthelpers/process/
- * @build jdk.testlibrary.OSInfo ProcessResults ProcessCommunicator
+ * @build jdk.test.lib.Platform ProcessResults ProcessCommunicator
  * @author gas@sparc.spb.su area=Clipboard
  * @run main/timeout=240 ImageTransferTest
  */
 
+import jdk.test.lib.Platform;
 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
 import test.java.awt.regtesthelpers.process.ProcessResults;
-import jdk.testlibrary.OSInfo;
 
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
@@ -174,8 +174,7 @@
                 (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
         java.util.List<String> ln =
                 sfm.getNativesForFlavor(DataFlavor.imageFlavor);
-        if (OSInfo.OSType.WINDOWS.equals(OSInfo.getOSType()) &&
-            !ln.contains("METAFILEPICT"))
+        if (Platform.isWindows() &&  !ln.contains("METAFILEPICT"))
         {
             // for test failing on JDK without this fix
             ln.add("METAFILEPICT");
--- a/test/jdk/java/awt/event/KeyEvent/8020209/bug8020209.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/event/KeyEvent/8020209/bug8020209.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -27,15 +27,15 @@
  * @bug 8020209
  * @summary [macosx] Mac OS X key event confusion for "COMMAND PLUS"
  * @author leonid.romanov@oracle.com
- * @library ../../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug8020209
  */
 
 import java.awt.*;
 import java.awt.event.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class bug8020209 {
     static volatile int listenerCallCounter = 0;
@@ -47,7 +47,7 @@
     };
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
--- a/test/jdk/java/awt/event/KeyEvent/DeadKey/DeadKeyMacOSXInputText.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/event/KeyEvent/DeadKey/DeadKeyMacOSXInputText.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -27,8 +27,8 @@
  * @bug 7199180
  * @summary [macosx] Dead keys handling for input methods
  * @author alexandr.scherbatiy area=awt.event
- * @library ../../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main DeadKeyMacOSXInputText
  */
 
@@ -37,7 +37,7 @@
 import java.awt.event.KeyEvent;
 import javax.swing.JTextField;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class DeadKeyMacOSXInputText {
 
@@ -45,7 +45,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             return;
         }
 
--- a/test/jdk/java/awt/event/KeyEvent/DeadKey/deadKeyMacOSX.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/event/KeyEvent/DeadKey/deadKeyMacOSX.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -27,8 +27,8 @@
  * @bug 7196547
  * @summary Dead Key implementation for KeyEvent on Mac OS X
  * @author alexandr.scherbatiy area=awt.event
- * @library ../../../../../lib/testlibrary
- * @build  jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build  jdk.test.lib.Platform
  * @run main deadKeyMacOSX
  */
 
@@ -36,7 +36,7 @@
 import java.awt.event.*;
 import java.awt.event.KeyEvent;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class deadKeyMacOSX {
 
@@ -44,7 +44,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             return;
         }
 
--- a/test/jdk/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,14 +28,14 @@
   @summary   Tests that key events with modifiers are not swallowed.
   @author    anton.tarasov: area=awt.focus
   @library   ../../../regtesthelpers
-  @library ../../../../../lib/testlibrary
+  @library /test/lib
   @modules java.desktop/sun.awt
-  @build jdk.testlibrary.OSInfo
+  @build jdk.test.lib.Platform
   @build     Util
   @run       main SwallowKeyEvents
 */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import java.awt.AWTException;
 import java.awt.Frame;
 import java.awt.Robot;
@@ -54,7 +54,7 @@
     static Robot r;
 
     public static void main(String[] args) {
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+        if (Platform.isWindows()) {
             System.out.println("Skipped. Test not for MS Windows.");
             return;
         }
--- a/test/jdk/java/awt/image/MultiResolutionImage/NSImageToMultiResolutionImageTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/image/MultiResolutionImage/NSImageToMultiResolutionImageTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,7 +24,8 @@
 import java.awt.Image;
 import java.awt.Toolkit;
 import java.awt.image.MultiResolutionImage;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 /*
  * @test
@@ -32,8 +33,8 @@
  * @summary [macosx] Get MultiResolution image from native system
  * @author Alexander Scherbatiy
  * @modules java.desktop/sun.awt.image
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main NSImageToMultiResolutionImageTest
  */
 
@@ -41,7 +42,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             return;
         }
 
--- a/test/jdk/java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -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
@@ -28,8 +28,8 @@
   @summary Check if multiresolution image behaves properly
            on HiDPI + non-HiDPI display pair.
   @author a.stepanov
-  @library /lib/testlibrary
-  @build jdk.testlibrary.OSInfo
+  @library /test/lib
+  @build jdk.test.lib.Platform
   @run applet/manual=yesno MultiDisplayTest.html
 */
 
@@ -38,8 +38,8 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
-import jdk.testlibrary.OSInfo;
 
+import jdk.test.lib.Platform;
 
 public class MultiDisplayTest extends Applet {
 
@@ -50,9 +50,7 @@
         generateImage(1, Color.BLACK), generateImage(2, Color.BLUE)});
 
     private static boolean checkOS() {
-        OSInfo.OSType os = OSInfo.getOSType();
-        return (os.equals(OSInfo.OSType.WINDOWS) ||
-            os.equals(OSInfo.OSType.MACOSX));
+        return Platform.isWindows() || Platform.isOSX();
     }
 
     public void init() { this.setLayout(new BorderLayout()); }
--- a/test/jdk/javax/swing/JButton/4796987/bug4796987.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JButton/4796987/bug4796987.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,15 +28,16 @@
  * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F
  * @author Alexander Scherbatiy
  * @library ../../regtesthelpers
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/com.sun.java.swing.plaf.windows
  *          java.desktop/sun.awt
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.OSVersion jdk.test.lib.Platform
  * @build Util
  * @run main bug4796987
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
+import jdk.test.lib.OSVersion;
 import java.awt.*;
 import javax.swing.*;
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
@@ -47,8 +48,8 @@
     private static JButton button2;
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS
-                && OSInfo.getWindowsVersion() == OSInfo.WINDOWS_XP) {
+        if (Platform.isWindows()
+                && OSVersion.current().equals(OSVersion.WINDOWS_XP)) {
             UIManager.setLookAndFeel(new WindowsLookAndFeel());
             testButtonBorder();
         }
--- a/test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -25,9 +25,9 @@
  * @bug 4449413
  * @summary Tests that checkbox and radiobuttons' check marks are visible when background is black
  * @author Ilya Boyandin
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/sun.awt
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @run applet/manual=yesno bug4449413.html
  */
 
@@ -35,7 +35,8 @@
 import javax.swing.plaf.metal.*;
 import java.awt.event.*;
 import java.awt.*;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug4449413 extends JApplet {
 
@@ -44,7 +45,7 @@
 
         try {
 
-            if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            if (Platform.isOSX()) {
                 UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
             }
 
--- a/test/jdk/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,13 +28,14 @@
 import javax.swing.JCheckBox;
 import javax.swing.JComponent;
 import javax.swing.SwingUtilities;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 /* @test
  * @bug 8032667
  * @summary [macosx] Components cannot be rendered in HiDPI to BufferedImage
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug8032667_image_diff
  */
 public class bug8032667_image_diff {
@@ -44,7 +45,7 @@
 
     public static void main(String[] args) throws Exception {
 
-        if(!OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())){
+        if (!Platform.isOSX()) {
             return;
         }
 
--- a/test/jdk/javax/swing/JComboBox/4199622/bug4199622.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JComboBox/4199622/bug4199622.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,14 +28,14 @@
    @requires (os.family == "windows")
    @summary RFE: JComboBox shouldn't send ActionEvents for keyboard navigation
    @author Vladislav Karnaukhov
-   @library ../../../../lib/testlibrary
+   @library /test/lib
    @modules java.desktop/com.sun.java.swing.plaf.windows
-   @build jdk.testlibrary.OSInfo
+   @build jdk.test.libr.Platform
    @run main bug4199622
  */
 
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 import javax.swing.*;
 import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -229,7 +229,7 @@
         }
         doTest();
 
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+        if (Platform.isWindows()) {
             try {
                 SwingUtilities.invokeAndWait(new Runnable() {
                     @Override
--- a/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.html	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.html	Tue Sep 04 14:35:59 2018 -0700
@@ -1,6 +1,6 @@
 <html>
 <!--
- Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 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
@@ -27,8 +27,8 @@
  @bug 4150029 8006087
  @summary BackSpace keyboard button does not lead to parent directory
  @author Oleg Mokhovikov
- @library ../../../../lib/testlibrary
- @build jdk.testlibrary.OSInfo
+ @library /test/lib
+ @build jdk.test.lib.Platform
  @run applet/manual=done bug4150029.html
 -->
 
--- a/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -27,6 +27,8 @@
    author Oleg Mokhovikov
 */
 
+import jdk.test.lib.Platform;
+
 import javax.swing.*;
 import java.io.File;
 import java.io.IOException;
@@ -35,7 +37,7 @@
     private boolean res;
 
     public void init() {
-        if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             try {
                 UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
             } catch (Exception e) {
--- a/test/jdk/javax/swing/JFileChooser/4524490/bug4524490.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/4524490/bug4524490.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,15 +28,16 @@
  * @summary Tests if in JFileChooser, ALT+L does not bring focus to 'Files' selection list in Motif LAF
  * @author Konstantin Eremin
  * @library ../../regtesthelpers
- * @library ../../../../lib/testlibrary
- * @build Util jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build Util jdk.test.lib.Platform
  * @run main bug4524490
  */
 import java.awt.Robot;
 import java.awt.Toolkit;
 import java.awt.event.KeyEvent;
 import javax.swing.*;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug4524490 {
 
@@ -58,7 +59,7 @@
 
         robot.waitForIdle();
 
-        if (OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())) {
+        if (Platform.isOSX()) {
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_L);
         } else {
             Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_L);
--- a/test/jdk/javax/swing/JFileChooser/6840086/bug6840086.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/6840086/bug6840086.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -25,13 +25,13 @@
    @bug 6840086
    @summary JFileChooser lacks icons on top right when running on Windows 7
    @author Pavel Porvatov
-   @library ../../../../lib/testlibrary
+   @library /test/lib
    @modules java.desktop/sun.awt.shell
-   @build jdk.testlibrary.OSInfo
+   @build jdk.test.lib.Platform
    @run main bug6840086
 */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import sun.awt.shell.ShellFolder;
 
 import java.awt.*;
@@ -46,7 +46,7 @@
     };
 
     public static void main(String[] args) {
-        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
+        if (!Platform.isWindows()) {
             System.out.println("The test was skipped because it is sensible only for Windows.");
 
             return;
--- a/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java	Tue Sep 04 14:35:59 2018 -0700
@@ -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
@@ -27,8 +27,8 @@
  * @bug 8041694
  * @summary JFileChooser removes trailing spaces in the selected directory name
  * @author Anton Litvinov
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug8041694
  */
 
@@ -45,7 +45,7 @@
 import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.plaf.metal.MetalLookAndFeel;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class bug8041694 {
     private static volatile File dir1;
@@ -59,7 +59,7 @@
             Robot robot = new Robot();
 
             dir1 = Files.createTempDirectory("bug8041694").toFile();
-            if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+            if (Platform.isWindows()) {
                 dir2 = new File(String.format(
                     "\\\\?\\%s\\d ", dir1.getAbsolutePath().replace('/', '\\')));
             } else {
--- a/test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/8046391/bug8046391.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,15 +27,14 @@
  * @requires (os.family == "windows")
  * @summary JFileChooser hangs if displayed in Windows L&F
  * @author Alexey Ivanov
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/com.sun.java.swing.plaf.windows
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @run main/othervm/timeout=10 bug8046391
 */
 
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
-import jdk.testlibrary.OSInfo;
-import jdk.testlibrary.OSInfo.OSType;
+import jdk.test.lib.Platform;
 
 import javax.swing.JFileChooser;
 import javax.swing.SwingUtilities;
@@ -45,8 +44,7 @@
 public class bug8046391  {
 
     public static void main(String[] args) throws Exception {
-        OSType type = OSInfo.getOSType();
-        if (type != OSType.WINDOWS) {
+        if (!Platform.isWindows()) {
             System.out.println("This test is for Windows only... skipping!");
             return;
         }
--- a/test/jdk/javax/swing/JFileChooser/8062561/bug8062561.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/8062561/bug8062561.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,7 +21,7 @@
  * questions.
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import java.awt.Robot;
 import java.awt.event.KeyEvent;
 import java.io.File;
@@ -39,9 +39,9 @@
  * @key headful
  * @requires (os.family == "windows")
  * @summary File system view returns null default directory
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/sun.awt
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @run main/othervm bug8062561 GENERATE_POLICY
  * @run main/othervm/policy=security.policy bug8062561 CHECK_DEFAULT_DIR run
  */
@@ -119,7 +119,7 @@
             throw new RuntimeException("Security manager should be null!");
         }
 
-        if (!OSInfo.getOSType().equals(OSInfo.OSType.WINDOWS)) {
+        if (!Platform.isWindows()) {
             return;
         }
 
--- a/test/jdk/javax/swing/JFrame/8016356/bug8016356.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFrame/8016356/bug8016356.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -28,8 +28,8 @@
  * @summary Any swing frame resizes ugly.
  * @author Oleg Pekhovskiy
  * @requires (os.family == "windows")
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug8016356
  */
 
@@ -47,7 +47,8 @@
 import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.SwingUtilities;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug8016356 {
     private static JFrame frame;
@@ -60,7 +61,7 @@
     public static void main(String[] args) throws Exception {
 
         // Windows only test
-        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+        if (Platform.isWindows()) {
 
             // Retrieving top edge of Desktop
             GraphicsConfiguration grConf = GraphicsEnvironment
--- a/test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,7 +27,8 @@
 
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 /**
  * @test
@@ -35,8 +36,8 @@
  * @bug 7124513
  * @summary We should support NSTexturedBackgroundWindowMask style on OSX.
  * @author Sergey Bylokhov
- * @library ../../../../lib/testlibrary
- * @build ExtendedRobot jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build ExtendedRobot jdk.test.lib.Platform
  * @run main NSTexturedJFrame
  */
 
@@ -51,7 +52,7 @@
     private static ExtendedRobot robot;
 
     public static void main(final String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("This test is for OSX, considered passed.");
             return;
         }
--- a/test/jdk/javax/swing/JInternalFrame/4251301/bug4251301.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JInternalFrame/4251301/bug4251301.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,8 +24,8 @@
    @bug 4251301
    @summary Keybinding for show/hide the system menu.
    @author Andrey Pikalev
-   @library ../../../../lib/testlibrary
-   @build jdk.testlibrary.OSInfo
+   @library /test/lib
+   @build jdk.test.lib.Platform
    @run main/manual bug4251301
 */
 
@@ -34,13 +34,13 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.beans.*;
-import jdk.testlibrary.OSInfo;
 
+import jdk.test.lib.Platform;
 
 public class bug4251301 {
     static Test test = new Test();
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             System.out.println("This test is not applicable for MacOS. Passed.");
             return;
         }
--- a/test/jdk/javax/swing/JLabel/6596966/bug6596966.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JLabel/6596966/bug6596966.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -27,8 +27,8 @@
  * @bug 6596966
  * @summary Some JFileChooser mnemonics do not work with sticky keys
  * @library ../../regtesthelpers
- * @library ../../../../lib/testlibrary
- * @build Util jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build Util jdk.test.lib.Platform
  * @run main bug6596966
  * @author Pavel Porvatov
  */
@@ -39,7 +39,7 @@
 import java.util.ArrayList;
 import javax.swing.*;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class bug6596966 {
     private static JFrame frame;
@@ -78,7 +78,7 @@
 
 
         int keyMask = InputEvent.ALT_MASK;
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             keyMask = InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
         }
         ArrayList<Integer> keys = Util.getKeyCodesFromKeyMask(keyMask);
--- a/test/jdk/javax/swing/JMenu/6470128/bug6470128.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JMenu/6470128/bug6470128.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -27,15 +27,16 @@
  * @bug 6470128
  * @summary Escape Key causes JMenu Selection to Disappear
  * @author Alexander Potochkin
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug6470128
  */
 
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.KeyEvent;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug6470128 {
     static JFrame frame;
@@ -66,14 +67,14 @@
         Robot robot = new Robot();
         robot.setAutoDelay(10);
         robot.waitForIdle();
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             robot.keyPress(KeyEvent.VK_CONTROL);
         }
         robot.keyPress(KeyEvent.VK_ALT);
         robot.keyPress(KeyEvent.VK_M);
         robot.keyRelease(KeyEvent.VK_M);
         robot.keyRelease(KeyEvent.VK_ALT);
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             robot.keyRelease(KeyEvent.VK_CONTROL);
         }
         robot.keyPress(KeyEvent.VK_ENTER);
--- a/test/jdk/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,12 +28,12 @@
  * @summary [macosx] ActionListener called twice for JMenuItem using ScreenMenuBar
  * @author vera.akulova@oracle.com
  * @modules java.desktop/java.awt:open
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main ActionListenerCalledTwiceTest
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
@@ -56,7 +56,7 @@
     static volatile int listenerCallCounter = 0;
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("This test is for MacOS only." +
                     " Automatically passed on other platforms.");
             return;
--- a/test/jdk/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -26,11 +26,13 @@
  * @bug 7186371
  * @summary [macosx] Main menu shortcuts not displayed
  * @author vera.akulova@oracle.com
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main/manual ShortcutNotDisplayedTest
  */
 
+import jdk.test.lib.Platform;
+
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
@@ -41,7 +43,7 @@
     static final String PASS_COMMAND = "pass";
 
     public static void main(String[] args) throws Exception {
-        if (jdk.testlibrary.OSInfo.getOSType() != jdk.testlibrary.OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
--- a/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,15 +27,16 @@
 import java.awt.TextArea;
 import javax.swing.JApplet;
 import javax.swing.JOptionPane;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 /**
  * @test
  * @bug 8024926 8040279
  * @summary [macosx] AquaIcon HiDPI support
  * @author Alexander Scherbatiy
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run applet/manual=yesno bug8024926.html
  */
 public class bug8024926 extends JApplet {
@@ -48,7 +49,7 @@
         this.setLayout(new BorderLayout());
 
 
-        if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+        if (Platform.isOSX()) {
             String[] instructions = {
                 "Verify that high resolution system icons are used"
                 + " in JOptionPane on HiDPI displays.",
--- a/test/jdk/javax/swing/JPopupMenu/6827786/bug6827786.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JPopupMenu/6827786/bug6827786.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -28,13 +28,14 @@
  * @summary Tests duplicate mnemonics
  * @author Peter Zhelezniakov
  * @library ../../regtesthelpers
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @modules java.desktop/sun.awt
- * @build jdk.testlibrary.OSInfo
+ * @build jdk.test.lib.Platform
  * @build Util
  * @run main bug6827786
  */
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 import java.awt.*;
 import java.awt.event.KeyEvent;
 import javax.swing.*;
@@ -70,7 +71,7 @@
         checkfocus();
 
         // select menu
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_F);
         } else {
             Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_F);
--- a/test/jdk/javax/swing/JPopupMenu/7154841/bug7154841.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JPopupMenu/7154841/bug7154841.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,8 +27,8 @@
  * @bug 7154841
  * @summary JPopupMenu is overlapped by a Dock on Mac OS X
  * @author Petr Pchelko
- * @library ../../../../lib/testlibrary
- * @build ExtendedRobot jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build ExtendedRobot jdk.test.lib.Platform
  * @run main bug7154841
  */
 
@@ -37,7 +37,8 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseMotionAdapter;
 import java.util.concurrent.atomic.AtomicReference;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug7154841 {
 
@@ -68,7 +69,7 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             return; // Test only for Mac OS X
         }
 
--- a/test/jdk/javax/swing/JScrollBar/bug4202954/bug4202954.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JScrollBar/bug4202954/bug4202954.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,9 +24,9 @@
    @test
    @key headful
    @bug 4202954
-   @library ../../../../lib/testlibrary
+   @library /test/lib
    @library ../../regtesthelpers
-   @build Util jdk.testlibrary.OSInfo
+   @build Util jdk.test.lib.Platform
    @author Michael C. Albers
    @run main bug4202954
  */
@@ -34,13 +34,14 @@
 import java.awt.*;
 import java.awt.event.InputEvent;
 import javax.swing.*;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug4202954 {
     static JScrollPane buttonScrollPane;
     static Robot robot;
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
         }
 
--- a/test/jdk/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -31,7 +31,7 @@
 import javax.swing.JTextArea;
 import javax.swing.SwingUtilities;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 /**
  * @test
@@ -39,8 +39,8 @@
  * @bug 8033000 8147994
  * @author Alexander Scherbatiy
  * @summary No Horizontal Mouse Wheel Support In BasicScrollPaneUI
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main HorizontalMouseWheelOnShiftPressed
  */
 public class HorizontalMouseWheelOnShiftPressed {
@@ -52,7 +52,7 @@
     private static JFrame frame;
 
     static {
-        delta = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ? -30 : 30;
+        delta = Platform.isOSX() ? -30 : 30;
     }
 
     public static void main(String[] args) throws Exception {
--- a/test/jdk/javax/swing/JSlider/6579827/bug6579827.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JSlider/6579827/bug6579827.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -26,20 +26,21 @@
  * @requires (os.family == "windows")
  * @summary vista : JSlider on JColorchooser is not properly render or can't be seen completely
  * @author Pavel Porvatov
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.OSVersion jdk.test.lib.Platform
    @run main bug6579827
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
+import jdk.test.lib.OSVersion;
 
 import javax.swing.*;
 import java.awt.*;
 
 public class bug6579827 {
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS ||
-                OSInfo.getWindowsVersion() != OSInfo.WINDOWS_VISTA) {
+        if (!Platform.isWindows() ||
+                !OSVersion.current().equals(OSVersion.WINDOWS_VISTA)) {
             System.out.println("This test is only for Windows Vista. Skipped.");
 
             return;
--- a/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -27,9 +27,9 @@
  * @bug 4624207
  * @summary JTabbedPane mnemonics don't work from outside the tabbed pane
  * @author Oleg Mokhovikov
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
  * @library ../../regtesthelpers
- * @build Util jdk.testlibrary.OSInfo
+ * @build Util jdk.test.lib.Platform
  * @run main bug4624207
  */
 import javax.swing.*;
@@ -40,7 +40,7 @@
 import java.awt.event.FocusListener;
 import java.awt.event.KeyEvent;
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 public class bug4624207 implements ChangeListener, FocusListener {
 
@@ -101,7 +101,7 @@
 
         robot.waitForIdle();
 
-        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+        if (Platform.isOSX()) {
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_B);
         } else {
             Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_B);
--- a/test/jdk/javax/swing/JTabbedPane/6416920/bug6416920.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JTabbedPane/6416920/bug6416920.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -27,8 +27,8 @@
  * @summary Ensures that selected tab is painted properly in the scroll tab layout
  *         under WindowsLookAndFeel in Windows' "Windows XP" theme.
  * @author Mikhail Lapshin
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug6416920
  */
 
@@ -37,14 +37,15 @@
 import javax.swing.SwingConstants;
 import java.awt.Rectangle;
 import java.awt.Insets;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug6416920 extends BasicTabbedPaneUI {
     public AccessibleTabbedPaneLayout layout = new AccessibleTabbedPaneLayout();
 
     public static void main(String[] args) {
 
-        if(OSInfo.getOSType() != OSInfo.OSType.WINDOWS){
+        if (!Platform.isWindows()) {
             return;
         }
 
--- a/test/jdk/javax/swing/JTextArea/6940863/bug6940863.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/JTextArea/6940863/bug6940863.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -28,12 +28,12 @@
  * @summary Textarea within scrollpane shows vertical scrollbar
  * @author Pavel Porvatov
  * @requires (os.family == "windows")
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug6940863
  */
 
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
 
 import javax.swing.*;
 import java.awt.*;
@@ -59,7 +59,7 @@
     });
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
+        if (!Platform.isWindows()) {
             System.out.println("The test is suitable only for Windows OS. Skipped");
             return;
         }
--- a/test/jdk/javax/swing/UITest/UITest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/UITest/UITest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,80 +28,68 @@
  *          GTK is not on Windows and Mac.
  * added as tabs
  * @author Scott Violet
- * @library ../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main UITest
  */
 import javax.swing.*;
 import javax.swing.UIManager.LookAndFeelInfo;
-import jdk.testlibrary.OSInfo;
-import jdk.testlibrary.OSInfo.OSType;
+
+import jdk.test.lib.Platform;
 
 public class UITest {
 
     public static void main(String[] args) {
-        OSType os = OSInfo.getOSType();
         LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
+        if (Platform.isWindows()) {
+            // Make sure we don't have GTK.
+            if (hasLAF("gtk", lafInfo)) {
+                throw new RuntimeException("On windows, but GTK is present");
+            }
 
-        switch (os) {
-            case WINDOWS:
+            // Make sure we don't have Aqua.
+            if (hasLAF("mac", lafInfo)) {
+                throw new RuntimeException("On windows, but Aqua is present");
+            }
 
-                // Make sure we don't have GTK.
-                if (hasLAF("gtk", lafInfo)) {
-                    throw new RuntimeException("On windows, but GTK is present");
-                }
+            // Make sure we have Windows.
+            if (!hasLAF("windows", lafInfo)) {
+                throw new RuntimeException("On windows and don't have Windows");
+            }
+        } else if (Platform.isOSX()) {
+            // Make sure we don't have GTK.
+            if (hasLAF("gtk", lafInfo)) {
+                throw new RuntimeException("On mac, but GTK is present");
+            }
 
-                // Make sure we don't have Aqua.
-                if (hasLAF("mac", lafInfo)) {
-                    throw new RuntimeException("On windows, but Aqua is present");
-                }
+            // Make sure we don't have Windows.
+            if (hasLAF("windows", lafInfo)) {
+                throw new RuntimeException("On mac, but Windows is present");
+            }
 
-                // Make sure we have Windows.
-                if (!hasLAF("windows", lafInfo)) {
-                    throw new RuntimeException("On windows and don't have Windows");
-                }
+            // Make sure we have Aqua.
+            if (!hasLAF("mac", lafInfo)) {
+                throw new RuntimeException("On mac and don't have Aqua");
+            }
+        } else {
+            // Not windows and mac
 
-                break;
+            // Make sure we don't have Windows.
+            if (hasLAF("windows", lafInfo)) {
+                throw new RuntimeException("Not on windows and have Windows");
+            }
 
-            case MACOSX:
+            // Make sure we don't have Aqua.
+            if (hasLAF("mac", lafInfo)) {
+                throw new RuntimeException("Not on mac and have Aqua");
+            }
 
-                // Make sure we don't have GTK.
-                if (hasLAF("gtk", lafInfo)) {
-                    throw new RuntimeException("On mac, but GTK is present");
-                }
-
-                // Make sure we don't have Windows.
-                if (hasLAF("windows", lafInfo)) {
-                    throw new RuntimeException("On mac, but Windows is present");
-                }
-
-                // Make sure we have Aqua.
-                if (!hasLAF("mac", lafInfo)) {
-                    throw new RuntimeException("On mac and don't have Aqua");
-                }
-
-                break;
-
-            default:
-                // Not windows and mac
-
-                // Make sure we don't have Windows.
-                if (hasLAF("windows", lafInfo)) {
-                    throw new RuntimeException("Not on windows and have Windows");
-                }
-
-                // Make sure we don't have Aqua.
-                if (hasLAF("mac", lafInfo)) {
-                    throw new RuntimeException("Not on mac and have Aqua");
-                }
-
-                // Make sure we have GTK.
-                if (!hasLAF("gtk", lafInfo)) {
-                    throw new RuntimeException(
-                            "Not on Windows and Mac and don't have GTK!");
-                }
+            // Make sure we have GTK.
+            if (!hasLAF("gtk", lafInfo)) {
+                throw new RuntimeException(
+                        "Not on Windows and Mac and don't have GTK!");
+            }
         }
-
     }
 
     public static boolean hasLAF(String name, LookAndFeelInfo[] lafInfo) {
--- a/test/jdk/javax/swing/plaf/aqua/CustomComboBoxFocusTest.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/plaf/aqua/CustomComboBoxFocusTest.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -27,8 +27,8 @@
  * @bug     8073001 8081764
  * @summary Test verifies that combo box with custom editor renders
  *          focus ring around arrow button correctly.
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run     main CustomComboBoxFocusTest
  */
 
@@ -54,14 +54,15 @@
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 import javax.swing.SwingUtilities;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class CustomComboBoxFocusTest {
 
     private static CustomComboBoxFocusTest test = null;
 
     public static void main(String[] args) {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+        if (!Platform.isOSX()) {
             System.out.println("Only Mac platform test. Test is skipped for other OS.");
             return;
         }
--- a/test/jdk/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,8 +28,8 @@
  * @summary With JDK 1.7 text field does not obtain focus when using mnemonic Alt/Key combin
  * @author Semyon Sadetsky
  * @requires (os.family == "windows")
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug7172652
  */
 
@@ -38,7 +38,8 @@
 import javax.swing.event.ChangeListener;
 import java.awt.*;
 import java.awt.event.KeyEvent;
-import jdk.testlibrary.OSInfo;
+
+import jdk.test.lib.Platform;
 
 public class bug7172652  {
 
@@ -47,7 +48,7 @@
     private static Boolean selected;
 
     public static void main(String[] args) throws Exception {
-        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
+        if (!Platform.isWindows()) {
             System.out.println("ok");
             return;
         }
--- a/test/jdk/jdk/net/Sockets/Test.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/jdk/net/Sockets/Test.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,17 +25,17 @@
  * @test
  * @bug 8032808 8044773
  * @modules jdk.net
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
+ * @build jdk.test.lib.OSVersion jdk.test.lib.Platform
  * @run main/othervm -Xcheck:jni Test success
  * @run main/othervm/policy=policy.fail -Xcheck:jni Test fail
  * @run main/othervm/policy=policy.success -Xcheck:jni Test success
  */
 
-import jdk.net.ExtendedSocketOptions;
 import jdk.net.SocketFlow;
 import jdk.net.Sockets;
-import jdk.testlibrary.OSInfo;
+import jdk.test.lib.Platform;
+import jdk.test.lib.OSVersion;
 
 import java.io.IOException;
 import java.net.*;
@@ -53,7 +53,6 @@
 
     static boolean expectSuccess;
     private static final boolean expectSupport = checkExpectedOptionSupport();
-    private static final double solarisVersionToCheck = 11.2;
 
     public static void main(String[] args) throws Exception {
 
@@ -190,9 +189,10 @@
     }
 
     private static boolean checkExpectedOptionSupport() {
-        if (OSInfo.getOSType().equals(OSInfo.OSType.SOLARIS)) {
-            double solarisVersion = OSInfo.getSolarisVersion();
-            if (solarisVersion >= solarisVersionToCheck) {
+        if (Platform.isSolaris()) {
+            OSVersion solarisVersion = OSVersion.current();
+            OSVersion solarisVersionToCheck = new OSVersion(11, 2);
+            if (solarisVersion.compareTo(solarisVersionToCheck) >= 0) {
                 System.out.println("This Solaris version (" + solarisVersion
                         + ") should support SO_FLOW_SLA option");
                 return true;
--- a/test/jdk/jdk/net/Sockets/policy.fail	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/jdk/net/Sockets/policy.fail	Tue Sep 04 14:35:59 2018 -0700
@@ -1,8 +1,10 @@
-grant {
-    permission java.util.PropertyPermission "os.name", "read";
+grant codeBase "file:${test.classes}/../../../../test/lib/-" {
+    permission java.util.PropertyPermission "*", "read";
+    permission java.io.FilePermission "/etc/release", "read";
     permission java.io.FilePermission "<<ALL FILES>>", "execute";
-    permission java.util.PropertyPermission "line.separator", "read";
-    permission java.io.FilePermission "/etc/release", "read";
-    permission java.net.SocketPermission "127.0.0.1", "connect,accept" ;
-    permission java.net.SocketPermission "localhost", "listen" ;
 };
+
+grant codeBase "file:${test.classes}/*" {
+    permission java.net.SocketPermission "127.0.0.1", "connect,accept";
+    permission java.net.SocketPermission "localhost", "listen";
+};
--- a/test/jdk/jdk/net/Sockets/policy.success	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/jdk/net/Sockets/policy.success	Tue Sep 04 14:35:59 2018 -0700
@@ -1,10 +1,12 @@
-grant {
-    permission java.util.PropertyPermission "os.name", "read";
+grant codeBase "file:${test.classes}/../../../../test/lib/-" {
+    permission java.util.PropertyPermission "*", "read";
+    permission java.io.FilePermission "/etc/release", "read";
     permission java.io.FilePermission "<<ALL FILES>>", "execute";
-    permission java.util.PropertyPermission "line.separator", "read";
-    permission java.io.FilePermission "/etc/release", "read";
-    permission java.net.SocketPermission "127.0.0.1", "connect,accept" ;
-    permission java.net.SocketPermission "localhost", "listen" ;
+};
+
+grant codeBase "file:${test.classes}/*" {
+    permission java.net.SocketPermission "127.0.0.1", "connect,accept";
+    permission java.net.SocketPermission "localhost", "listen";
     permission jdk.net.NetworkPermission "setOption.SO_FLOW_SLA";
     permission jdk.net.NetworkPermission "getOption.SO_FLOW_SLA";
 };
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/OSInfo.java	Tue Sep 04 15:00:08 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.Map;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.InputStreamReader;
-
-import static jdk.testlibrary.OSInfo.OSType.*;
-
-/**
- * @author Pavel Porvatov
- * copied to testlibrary by yan
- */
-public class OSInfo {
-    public static enum OSType {
-        WINDOWS,
-        LINUX,
-        SOLARIS,
-        MACOSX,
-        UNKNOWN
-    }
-
-    /*
-       The map windowsVersionMap must contain all windows version constants except WINDOWS_UNKNOWN,
-       and so the method getWindowsVersion() will return the constant for known OS.
-       It allows compare objects by "==" instead of "equals".
-     */
-    public static final WindowsVersion WINDOWS_UNKNOWN = new WindowsVersion(-1, -1);
-    public static final WindowsVersion WINDOWS_95 = new WindowsVersion(4, 0);
-    public static final WindowsVersion WINDOWS_98 = new WindowsVersion(4, 10);
-    public static final WindowsVersion WINDOWS_ME = new WindowsVersion(4, 90);
-    public static final WindowsVersion WINDOWS_2000 = new WindowsVersion(5, 0);
-    public static final WindowsVersion WINDOWS_XP = new WindowsVersion(5, 1);
-    public static final WindowsVersion WINDOWS_2003 = new WindowsVersion(5, 2);
-    public static final WindowsVersion WINDOWS_VISTA = new WindowsVersion(6, 0);
-
-    private static final String OS_NAME = "os.name";
-    private static final String OS_VERSION = "os.version";
-
-    private final static Map<String, WindowsVersion> windowsVersionMap = new HashMap<String, OSInfo.WindowsVersion>();
-
-    static {
-        windowsVersionMap.put(WINDOWS_95.toString(), WINDOWS_95);
-        windowsVersionMap.put(WINDOWS_98.toString(), WINDOWS_98);
-        windowsVersionMap.put(WINDOWS_ME.toString(), WINDOWS_ME);
-        windowsVersionMap.put(WINDOWS_2000.toString(), WINDOWS_2000);
-        windowsVersionMap.put(WINDOWS_XP.toString(), WINDOWS_XP);
-        windowsVersionMap.put(WINDOWS_2003.toString(), WINDOWS_2003);
-        windowsVersionMap.put(WINDOWS_VISTA.toString(), WINDOWS_VISTA);
-    }
-
-    private static final PrivilegedAction<OSType> osTypeAction = new PrivilegedAction<OSType>() {
-        public OSType run() {
-            return getOSType();
-        }
-    };
-
-    private OSInfo() {
-        // Don't allow to create instances
-    }
-
-    /**
-     * Returns type of operating system.
-     */
-    public static OSType getOSType() throws SecurityException {
-        String osName = System.getProperty(OS_NAME);
-
-        if (osName != null) {
-            if (osName.contains("Windows")) {
-                return WINDOWS;
-            }
-
-            if (osName.contains("Linux")) {
-                return LINUX;
-            }
-
-            if (osName.contains("Solaris") || osName.contains("SunOS")) {
-                return SOLARIS;
-            }
-
-            if (osName.contains("OS X")) {
-                return MACOSX;
-            }
-
-            // determine another OS here
-        }
-
-        return UNKNOWN;
-    }
-
-    public static PrivilegedAction<OSType> getOSTypeAction() {
-        return osTypeAction;
-    }
-
-    public static WindowsVersion getWindowsVersion() throws SecurityException {
-        String osVersion = System.getProperty(OS_VERSION);
-
-        if (osVersion == null) {
-            return WINDOWS_UNKNOWN;
-        }
-
-        synchronized (windowsVersionMap) {
-            WindowsVersion result = windowsVersionMap.get(osVersion);
-
-            if (result == null) {
-                // Try parse version and put object into windowsVersionMap
-                String[] arr = osVersion.split("\\.");
-
-                if (arr.length == 2) {
-                    try {
-                        result = new WindowsVersion(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]));
-                    } catch (NumberFormatException e) {
-                        return WINDOWS_UNKNOWN;
-                    }
-                } else {
-                    return WINDOWS_UNKNOWN;
-                }
-
-                windowsVersionMap.put(osVersion, result);
-            }
-
-            return result;
-        }
-    }
-
-    public static double getSolarisVersion() {
-        try {
-            OutputAnalyzer output = ProcessTools.executeProcess("uname", "-v");
-            System.out.println("'uname -v' finished with code "
-                    + output.getExitValue());
-            return Double.parseDouble(output.getOutput());
-        } catch (Exception e) {
-            System.out.println("First attempt failed with: " + e.getMessage());
-        }
-
-        //Try to get Solaris version from /etc/release
-        try (BufferedReader in =
-                     new BufferedReader(new FileReader("/etc/release"))) {
-            String line = in.readLine().trim().split(" ")[2];
-            return Double.parseDouble(line);
-        } catch (Exception e) {
-            System.out.println("Second attempt failed with: " + e.getMessage());
-        }
-
-        throw new RuntimeException("Unable to get Solaris version");
-    }
-
-    public static class WindowsVersion implements Comparable<WindowsVersion> {
-        private final int major;
-
-        private final int minor;
-
-        private WindowsVersion(int major, int minor) {
-            this.major = major;
-            this.minor = minor;
-        }
-
-        public int getMajor() {
-            return major;
-        }
-
-        public int getMinor() {
-            return minor;
-        }
-
-        public int compareTo(WindowsVersion o) {
-            int result = major - o.getMajor();
-
-            if (result == 0) {
-                result = minor - o.getMinor();
-            }
-
-            return result;
-        }
-
-        public boolean equals(Object obj) {
-            return obj instanceof WindowsVersion && compareTo((WindowsVersion) obj) == 0;
-        }
-
-        public int hashCode() {
-            return 31 * major + minor;
-        }
-
-        public String toString() {
-            return major + "." + minor;
-        }
-    }
-}
-
--- a/test/jdk/sun/awt/dnd/8024061/bug8024061.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/jdk/sun/awt/dnd/8024061/bug8024061.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,8 +27,8 @@
  * @bug 8024061
  * @summary Checks that no exception is thrown if dragGestureRecognized
  *          takes a while to complete.
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
  * @run main bug8024061
  */
 import java.awt.*;
@@ -56,8 +56,8 @@
 import java.util.concurrent.TimeUnit;
 
 import javax.swing.*;
-import jdk.testlibrary.OSInfo;
 
+import jdk.test.lib.Platform;
 
 /**
  * If dragGestureRecognized() takes a while to complete and if user performs a drag quickly,
@@ -114,8 +114,7 @@
     }
 
     public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
-        OSInfo.OSType type = OSInfo.getOSType();
-        if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) {
+        if (!Platform.isLinux() && !Platform.isSolaris()) {
             System.out.println("This test is for Linux and Solaris only... " +
                                "skipping!");
             return;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/OSVersion.java	Tue Sep 04 14:35:59 2018 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1997, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib;
+
+import java.util.Arrays;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+public final class OSVersion implements Comparable<OSVersion> {
+    public static final OSVersion WINDOWS_95 = new OSVersion(4, 0);
+    public static final OSVersion WINDOWS_98 = new OSVersion(4, 10);
+    public static final OSVersion WINDOWS_ME = new OSVersion(4, 90);
+    public static final OSVersion WINDOWS_2000 = new OSVersion(5, 0);
+    public static final OSVersion WINDOWS_XP = new OSVersion(5, 1);
+    public static final OSVersion WINDOWS_2003 = new OSVersion(5, 2);
+    public static final OSVersion WINDOWS_VISTA = new OSVersion(6, 0);
+
+    private final int[] versionTokens;
+
+    public static OSVersion current() {
+        if (Platform.isSolaris()) {
+            return new OSVersion(getSolarisVersion());
+        }
+        return new OSVersion(Platform.getOsVersion());
+    }
+
+    public OSVersion(int major, int minor) {
+        versionTokens = new int[] {major, minor};
+    }
+
+    public OSVersion(String version) {
+        Pattern onlyDigits = Pattern.compile("^\\d+$");
+        this.versionTokens = Arrays.stream(version.split("-")[0].split("\\."))
+                                   .filter(onlyDigits.asPredicate())
+                                   .mapToInt(Integer::parseInt)
+                                   .toArray();
+    }
+
+    private static String getSolarisVersion() {
+        try {
+            return Utils.distro();
+        } catch (Throwable e) {
+            System.out.println("First attempt failed with: " + e.getMessage());
+        }
+
+        // Try to get Solaris version from /etc/release
+        try (BufferedReader in = new BufferedReader(AccessController.doPrivileged(
+                (PrivilegedExceptionAction<FileReader>) () -> new FileReader("/etc/release")))) {
+            return in.readLine().trim().split(" ")[2];
+        } catch (PrivilegedActionException e) {
+            System.out.println("Second attempt failed with: " + e.getException().getMessage());
+        } catch (Exception e) {
+            System.out.println("Second attempt failed with: " + e.getMessage());
+        }
+
+        throw new RuntimeException("Unable to get Solaris version");
+    }
+
+    @Override
+    public int compareTo(OSVersion o) {
+        return Arrays.compare(this.versionTokens, o.versionTokens);
+    }
+
+    @Override
+    public int hashCode() {
+        return Arrays.hashCode(versionTokens);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        OSVersion osVersion = (OSVersion) o;
+        return Arrays.equals(versionTokens, osVersion.versionTokens);
+    }
+
+    @Override
+    public String toString() {
+        return Arrays.stream(versionTokens)
+                     .mapToObj(String::valueOf)
+                     .collect(Collectors.joining("."));
+    }
+}
+
--- a/test/lib/jdk/test/lib/Platform.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/lib/jdk/test/lib/Platform.java	Tue Sep 04 14:35:59 2018 -0700
@@ -26,26 +26,30 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 
 public class Platform {
-    public  static final String vmName      = System.getProperty("java.vm.name");
-    public  static final String vmInfo      = System.getProperty("java.vm.info");
-    private static final String osVersion   = System.getProperty("os.version");
-    private static       String[] osVersionTokens;
+    public  static final String vmName      = privilegedGetProperty("java.vm.name");
+    public  static final String vmInfo      = privilegedGetProperty("java.vm.info");
+    private static final String osVersion   = privilegedGetProperty("os.version");
     private static       int osVersionMajor = -1;
     private static       int osVersionMinor = -1;
-    private static final String osName      = System.getProperty("os.name");
-    private static final String dataModel   = System.getProperty("sun.arch.data.model");
-    private static final String vmVersion   = System.getProperty("java.vm.version");
-    private static final String jdkDebug    = System.getProperty("jdk.debug");
-    private static final String osArch      = System.getProperty("os.arch");
-    private static final String userName    = System.getProperty("user.name");
-    private static final String compiler    = System.getProperty("sun.management.compiler");
+    private static final String osName      = privilegedGetProperty("os.name");
+    private static final String dataModel   = privilegedGetProperty("sun.arch.data.model");
+    private static final String vmVersion   = privilegedGetProperty("java.vm.version");
+    private static final String jdkDebug    = privilegedGetProperty("jdk.debug");
+    private static final String osArch      = privilegedGetProperty("os.arch");
+    private static final String userName    = privilegedGetProperty("user.name");
+    private static final String compiler    = privilegedGetProperty("sun.management.compiler");
+
+    private static String privilegedGetProperty(String key) {
+        return AccessController.doPrivileged((
+                PrivilegedAction<String>) () -> System.getProperty(key));
+    }
 
     public static boolean isClient() {
         return vmName.endsWith(" Client VM");
@@ -129,7 +133,7 @@
 
     // Os version support.
     private static void init_version() {
-        osVersionTokens = osVersion.split("\\.");
+        String[] osVersionTokens = osVersion.split("\\.");
         try {
             if (osVersionTokens.length > 0) {
                 osVersionMajor = Integer.parseInt(osVersionTokens[0]);
@@ -160,45 +164,6 @@
         return osVersionMinor;
     }
 
-    /**
-     * Compares the platform version with the supplied version. The
-     * version must be of the form a[.b[.c[.d...]]] where a, b, c, d, ...
-     * are decimal integers.
-     *
-     * @throws NullPointerException if the parameter is null
-     * @throws NumberFormatException if there is an error parsing either
-     *         version as split into component strings
-     * @return -1, 0, or 1 according to whether the platform version is
-     *         less than, equal to, or greater than the supplied version
-     */
-    public static int compareOsVersion(String version) {
-        if (osVersionTokens == null) init_version();
-
-        Objects.requireNonNull(version);
-
-        List<Integer> s1 = Arrays
-            .stream(osVersionTokens)
-            .map(Integer::valueOf)
-            .collect(Collectors.toList());
-        List<Integer> s2 = Arrays
-            .stream(version.split("\\."))
-            .map(Integer::valueOf)
-            .collect(Collectors.toList());
-
-        int count = Math.max(s1.size(), s2.size());
-        for (int i = 0; i < count; i++) {
-            int i1 = i < s1.size() ? s1.get(i) : 0;
-            int i2 = i < s2.size() ? s2.get(i) : 0;
-            if (i1 > i2) {
-                return 1;
-            } else if (i2 > i1) {
-                return -1;
-            }
-        }
-
-        return 0;
-    }
-
     public static boolean isDebugBuild() {
         return (jdkDebug.toLowerCase().contains("debug"));
     }
@@ -294,10 +259,15 @@
         // SELinux deny_ptrace:
         File deny_ptrace = new File("/sys/fs/selinux/booleans/deny_ptrace");
         if (deny_ptrace.exists()) {
-            try (RandomAccessFile file = new RandomAccessFile(deny_ptrace, "r")) {
+            try (RandomAccessFile file = AccessController.doPrivileged(
+                    (PrivilegedExceptionAction<RandomAccessFile>) () -> new RandomAccessFile(deny_ptrace, "r"))) {
                 if (file.readByte() != '0') {
                     return false;
                 }
+            } catch (PrivilegedActionException e) {
+                @SuppressWarnings("unchecked")
+                IOException t = (IOException) e.getException();
+                throw t;
             }
         }
 
@@ -308,7 +278,8 @@
         // 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
         File ptrace_scope = new File("/proc/sys/kernel/yama/ptrace_scope");
         if (ptrace_scope.exists()) {
-            try (RandomAccessFile file = new RandomAccessFile(ptrace_scope, "r")) {
+            try (RandomAccessFile file = AccessController.doPrivileged(
+                    (PrivilegedExceptionAction<RandomAccessFile>) () -> new RandomAccessFile(ptrace_scope, "r"))) {
                 byte yama_scope = file.readByte();
                 if (yama_scope == '3') {
                     return false;
@@ -317,6 +288,10 @@
                 if (!userName.equals("root") && yama_scope != '0') {
                     return false;
                 }
+            } catch (PrivilegedActionException e) {
+                @SuppressWarnings("unchecked")
+                IOException t = (IOException) e.getException();
+                throw t;
             }
         }
         // Otherwise expect to be permitted:
--- a/test/lib/jdk/test/lib/process/ProcessTools.java	Tue Sep 04 15:00:08 2018 -0700
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java	Tue Sep 04 14:35:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -40,6 +40,9 @@
 import java.util.function.Predicate;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.Utils;
@@ -69,7 +72,7 @@
      * @throws IOException If an I/O error occurs.
      */
     public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException {
-        return getOutput(processBuilder.start());
+        return getOutput(privilegedStart(processBuilder));
     }
 
     /**
@@ -201,7 +204,7 @@
                                        TimeUnit unit)
     throws IOException, InterruptedException, TimeoutException {
         System.out.println("["+name+"]:" + processBuilder.command().stream().collect(Collectors.joining(" ")));
-        Process p = processBuilder.start();
+        Process p = privilegedStart(processBuilder);
         StreamPumper stdout = new StreamPumper(p.getInputStream());
         StreamPumper stderr = new StreamPumper(p.getErrorStream());
 
@@ -393,7 +396,7 @@
         Process p = null;
         boolean failed = false;
         try {
-            p = pb.start();
+            p = privilegedStart(pb);
             output = new OutputAnalyzer(p);
             p.waitFor();
 
@@ -495,6 +498,17 @@
         return analyzer;
     }
 
+    private static Process privilegedStart(ProcessBuilder pb) throws IOException {
+        try {
+            return AccessController.doPrivileged(
+                (PrivilegedExceptionAction<Process>) () -> pb.start());
+        } catch (PrivilegedActionException e) {
+            @SuppressWarnings("unchecked")
+            IOException t = (IOException) e.getException();
+            throw t;
+        }
+    }
+
     private static class ProcessImpl extends Process {
 
         private final Process p;