Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions test/jdk/tools/jpackage/share/AppContentTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand Down Expand Up @@ -34,6 +34,7 @@
import java.util.Collection;
import java.util.List;

import jdk.internal.util.OSVersion;

/**
* Tests generation of packages with input folder containing empty folders.
Expand Down Expand Up @@ -79,6 +80,17 @@ public AppContentTest(String... testPathArgs) {
@Test
public void test() throws Exception {

// On macOS signing may or may not work for modified app bundles.
// It works on macOS 15 and up, but fails on macOS below 15.
final int expectedJPackageExitCode;
final boolean isMacOS15 = (OSVersion.current().compareTo(
new OSVersion(15, 0, 0)) > 0);
if (testPathArgs.contains(TEST_BAD) || (TKit.isOSX() && !isMacOS15)) {
expectedJPackageExitCode = 1;
} else {
expectedJPackageExitCode = 0;
}

new PackageTest().configureHelloApp()
.addInitializer(cmd -> {
for (String arg : testPathArgs) {
Expand All @@ -97,9 +109,7 @@ public void test() throws Exception {
}

})
// On macOS we always signing app image and signing will fail, since
// test produces invalid app bundle.
.setExpectedExitCode(testPathArgs.contains(TEST_BAD) || TKit.isOSX() ? 1 : 0)
.setExpectedExitCode(expectedJPackageExitCode)
.run();
}
}