Skip to content

Commit a63f501

Browse files
author
Alexey Semenyuk
committed
8343396: Use OperatingSystem, Architecture, and OSVersion in jpackage tests
Reviewed-by: rriggs, almatvee
1 parent 84c99fb commit a63f501

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@
6161
import java.util.stream.Collectors;
6262
import static java.util.stream.Collectors.toSet;
6363
import java.util.stream.Stream;
64+
import jdk.internal.util.OperatingSystem;
6465
import jdk.jpackage.test.Functional.ExceptionBox;
6566
import jdk.jpackage.test.Functional.ThrowingConsumer;
6667
import jdk.jpackage.test.Functional.ThrowingRunnable;
6768
import jdk.jpackage.test.Functional.ThrowingSupplier;
6869

6970
public final class TKit {
7071

71-
private static final String OS = System.getProperty("os.name").toLowerCase();
72-
7372
public static final Path TEST_SRC_ROOT = Functional.identity(() -> {
7473
Path root = Path.of(System.getProperty("test.src"));
7574

@@ -176,15 +175,15 @@ static String getCurrentDefaultAppName() {
176175
}
177176

178177
public static boolean isWindows() {
179-
return (OS.contains("win"));
178+
return OperatingSystem.isWindows();
180179
}
181180

182181
public static boolean isOSX() {
183-
return (OS.contains("mac"));
182+
return OperatingSystem.isMacOS();
184183
}
185184

186185
public static boolean isLinux() {
187-
return ((OS.contains("nix") || OS.contains("nux")));
186+
return OperatingSystem.isLinux();
188187
}
189188

190189
public static boolean isLinuxAPT() {

test/jdk/tools/jpackage/macosx/HostArchPkgTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javax.xml.xpath.XPath;
2929
import javax.xml.xpath.XPathConstants;
3030
import javax.xml.xpath.XPathFactory;
31+
import jdk.internal.util.Architecture;
3132
import jdk.jpackage.test.JPackageCommand;
3233
import jdk.jpackage.test.PackageTest;
3334
import jdk.jpackage.test.PackageType;
@@ -73,7 +74,7 @@ private static void verifyHostArch(JPackageCommand cmd) throws Exception {
7374
"/installer-gui-script/options/@hostArchitectures",
7475
doc, XPathConstants.STRING);
7576

76-
if ("aarch64".equals(System.getProperty("os.arch"))) {
77+
if (Architecture.isAARCH64()) {
7778
TKit.assertEquals(v, "arm64",
7879
"Check value of \"hostArchitectures\" attribute");
7980
} else {

0 commit comments

Comments
 (0)