8343396: Use OperatingSystem, Architecture, and OSVersion in jpackage tests
Reviewed-by: rriggs, almatvee
This commit is contained in:
parent
84c99fb91f
commit
a63f501b92
@ -61,6 +61,7 @@ import java.util.function.Supplier;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import static java.util.stream.Collectors.toSet;
|
import static java.util.stream.Collectors.toSet;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import jdk.internal.util.OperatingSystem;
|
||||||
import jdk.jpackage.test.Functional.ExceptionBox;
|
import jdk.jpackage.test.Functional.ExceptionBox;
|
||||||
import jdk.jpackage.test.Functional.ThrowingConsumer;
|
import jdk.jpackage.test.Functional.ThrowingConsumer;
|
||||||
import jdk.jpackage.test.Functional.ThrowingRunnable;
|
import jdk.jpackage.test.Functional.ThrowingRunnable;
|
||||||
@ -68,8 +69,6 @@ import jdk.jpackage.test.Functional.ThrowingSupplier;
|
|||||||
|
|
||||||
public final class TKit {
|
public final class TKit {
|
||||||
|
|
||||||
private static final String OS = System.getProperty("os.name").toLowerCase();
|
|
||||||
|
|
||||||
public static final Path TEST_SRC_ROOT = Functional.identity(() -> {
|
public static final Path TEST_SRC_ROOT = Functional.identity(() -> {
|
||||||
Path root = Path.of(System.getProperty("test.src"));
|
Path root = Path.of(System.getProperty("test.src"));
|
||||||
|
|
||||||
@ -176,15 +175,15 @@ public final class TKit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWindows() {
|
public static boolean isWindows() {
|
||||||
return (OS.contains("win"));
|
return OperatingSystem.isWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOSX() {
|
public static boolean isOSX() {
|
||||||
return (OS.contains("mac"));
|
return OperatingSystem.isMacOS();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLinux() {
|
public static boolean isLinux() {
|
||||||
return ((OS.contains("nix") || OS.contains("nux")));
|
return OperatingSystem.isLinux();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLinuxAPT() {
|
public static boolean isLinuxAPT() {
|
||||||
|
@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
|||||||
import javax.xml.xpath.XPath;
|
import javax.xml.xpath.XPath;
|
||||||
import javax.xml.xpath.XPathConstants;
|
import javax.xml.xpath.XPathConstants;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
import jdk.internal.util.Architecture;
|
||||||
import jdk.jpackage.test.JPackageCommand;
|
import jdk.jpackage.test.JPackageCommand;
|
||||||
import jdk.jpackage.test.PackageTest;
|
import jdk.jpackage.test.PackageTest;
|
||||||
import jdk.jpackage.test.PackageType;
|
import jdk.jpackage.test.PackageType;
|
||||||
@ -73,7 +74,7 @@ public class HostArchPkgTest {
|
|||||||
"/installer-gui-script/options/@hostArchitectures",
|
"/installer-gui-script/options/@hostArchitectures",
|
||||||
doc, XPathConstants.STRING);
|
doc, XPathConstants.STRING);
|
||||||
|
|
||||||
if ("aarch64".equals(System.getProperty("os.arch"))) {
|
if (Architecture.isAARCH64()) {
|
||||||
TKit.assertEquals(v, "arm64",
|
TKit.assertEquals(v, "arm64",
|
||||||
"Check value of \"hostArchitectures\" attribute");
|
"Check value of \"hostArchitectures\" attribute");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user