8343396: Use OperatingSystem, Architecture, and OSVersion in jpackage tests

Reviewed-by: rriggs, almatvee
This commit is contained in:
Alexey Semenyuk 2024-11-07 22:10:59 +00:00
parent 84c99fb91f
commit a63f501b92
2 changed files with 6 additions and 6 deletions

View File

@ -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() {

View File

@ -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 {