From a63f501b9238c6aae81c2e39fcc1852652116780 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Thu, 7 Nov 2024 22:10:59 +0000 Subject: [PATCH] 8343396: Use OperatingSystem, Architecture, and OSVersion in jpackage tests Reviewed-by: rriggs, almatvee --- .../tools/jpackage/helpers/jdk/jpackage/test/TKit.java | 9 ++++----- test/jdk/tools/jpackage/macosx/HostArchPkgTest.java | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index e332480e35a..02841a1a713 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -61,6 +61,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import static java.util.stream.Collectors.toSet; import java.util.stream.Stream; +import jdk.internal.util.OperatingSystem; import jdk.jpackage.test.Functional.ExceptionBox; import jdk.jpackage.test.Functional.ThrowingConsumer; import jdk.jpackage.test.Functional.ThrowingRunnable; @@ -68,8 +69,6 @@ import jdk.jpackage.test.Functional.ThrowingSupplier; public final class TKit { - private static final String OS = System.getProperty("os.name").toLowerCase(); - public static final Path TEST_SRC_ROOT = Functional.identity(() -> { Path root = Path.of(System.getProperty("test.src")); @@ -176,15 +175,15 @@ public final class TKit { } public static boolean isWindows() { - return (OS.contains("win")); + return OperatingSystem.isWindows(); } public static boolean isOSX() { - return (OS.contains("mac")); + return OperatingSystem.isMacOS(); } public static boolean isLinux() { - return ((OS.contains("nix") || OS.contains("nux"))); + return OperatingSystem.isLinux(); } public static boolean isLinuxAPT() { diff --git a/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java b/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java index 5829aba23cc..69e1cd6c42a 100644 --- a/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java +++ b/test/jdk/tools/jpackage/macosx/HostArchPkgTest.java @@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; +import jdk.internal.util.Architecture; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; @@ -73,7 +74,7 @@ public class HostArchPkgTest { "/installer-gui-script/options/@hostArchitectures", doc, XPathConstants.STRING); - if ("aarch64".equals(System.getProperty("os.arch"))) { + if (Architecture.isAARCH64()) { TKit.assertEquals(v, "arm64", "Check value of \"hostArchitectures\" attribute"); } else {