Skip to content

8334238: Enhance AddLShortcutTest jpackage test #26584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
db88a85
LinuxHelper: fix a typo
alexeysemenyukoracle Jul 23, 2025
66f527c
AdditionalLauncher: add AdditionalLauncher.PropertyFile() ctor; AppIm…
alexeysemenyukoracle Jul 24, 2025
53ea833
Introduce MsiDatabase; Implement launcher shortcut verification in MS…
alexeysemenyukoracle Jul 23, 2025
54f2d0e
LauncherIconVerifier: add verifyFileInAppImageOnly() to control if to…
alexeysemenyukoracle Jul 28, 2025
05a79ec
Remove redundant shortcut verification code: it duplicates code in Wi…
alexeysemenyukoracle Jul 24, 2025
d34229f
Simplify AdditionalLauncher.PropertyFile
alexeysemenyukoracle Jul 24, 2025
4cc2f3d
Add missing CommandArguments.verifyMutable() calls.
alexeysemenyukoracle Jul 25, 2025
840d464
WindowsHelper: fix a typo
alexeysemenyukoracle Jul 26, 2025
769fd7f
AddLauncherTest, UpgradeTest, WinShortcutVerifier, ConfigFilesStasher…
alexeysemenyukoracle Jul 24, 2025
06cf7ae
Use JPackageCommand.createMutableCopy()
alexeysemenyukoracle Jul 26, 2025
d5caa5c
Decouple additional launcher configuration and verification in the Ad…
alexeysemenyukoracle Jul 27, 2025
5357688
PerUserCfgTest: follow-up changes in AdditionalLauncher
alexeysemenyukoracle Jul 26, 2025
777830c
LauncherAsServiceVerifier: follow-up for the changes in the Additiona…
alexeysemenyukoracle Jul 27, 2025
1dc3781
Rework .desktop files verification: Always verify .desktop files are …
alexeysemenyukoracle Jul 28, 2025
ff1c5d2
PrintEnv: support `--print-workdir` CLI option and `jpackage.test.app…
alexeysemenyukoracle Jul 30, 2025
02ac3e7
LinuxHelper: add getInvokeShortcutSpecs(); add DesktopFile type to st…
alexeysemenyukoracle Jul 30, 2025
6d62ef7
WinShortcutVerifier: add getInvokeShortcutSpecs(); streamline expectL…
alexeysemenyukoracle Jul 30, 2025
1829a15
AddLShortcutTest: add testStartupDirectory() tests to exercise combin…
alexeysemenyukoracle Jul 30, 2025
3ba7bf7
WinShortcutVerifier: fix bad merge
alexeysemenyukoracle Jul 31, 2025
e7822ea
AddLShortcutTest: make it work on Linux
alexeysemenyukoracle Jul 31, 2025
b75a974
LinuxHelper: Use `gtk-launch` command to launch .desktop files
alexeysemenyukoracle Jul 31, 2025
8d8e7d8
LauncherShortcut: bugfix
alexeysemenyukoracle Jul 31, 2025
eb1570a
LauncherShortcut: make it work with the current variant of jpackage w…
alexeysemenyukoracle Jul 31, 2025
2e7e746
AdditionalLauncher: bugfix
alexeysemenyukoracle Jul 31, 2025
2d754ee
Consistent log message format
alexeysemenyukoracle Aug 1, 2025
67bea7d
Bash script to clean jpackage test log files to reduce noise in diff-s
alexeysemenyukoracle Aug 1, 2025
b5da807
Fix a typo
alexeysemenyukoracle Aug 1, 2025
a56e55a
LinuxHelper: allow empty lines in .desktop files
alexeysemenyukoracle Aug 1, 2025
9a4ec0f
WinShortcutVerifier: make it a better fit for JDK-8308349
alexeysemenyukoracle Aug 1, 2025
36410b7
LinuxHelper: bugfix
alexeysemenyukoracle Aug 1, 2025
24ce3ed
AddLShortcutTest: modify
alexeysemenyukoracle Aug 1, 2025
98b916e
LinuxHelper: bugfix
alexeysemenyukoracle Aug 1, 2025
c8f034f
AddLShortcutTest: make it a better fit for JDK-8308349
alexeysemenyukoracle Aug 1, 2025
c280a9f
clean_test_output.sh: better
alexeysemenyukoracle Aug 1, 2025
6f42811
JPackageCommand: remove path to the unpacked directory from the argum…
alexeysemenyukoracle Aug 1, 2025
b4fcbdb
JPackageCommand: verify names of additional launcher are precisely re…
alexeysemenyukoracle Aug 2, 2025
975a493
LauncherShortcut: add appImageFilePropertyName()
alexeysemenyukoracle Aug 2, 2025
1403066
Use java.time.Duration and java.time.Instant in TKit.waitForFileCreat…
alexeysemenyukoracle Aug 4, 2025
a95677f
Use TKit.waitForFileCreated() to await for test output file
alexeysemenyukoracle Aug 4, 2025
7b86ad1
LinuxHelper: fix a typo
alexeysemenyukoracle Jul 23, 2025
39851db
AdditionalLauncher: add AdditionalLauncher.PropertyFile() ctor; AppIm…
alexeysemenyukoracle Jul 24, 2025
33e85f2
Introduce MsiDatabase; Implement launcher shortcut verification in MS…
alexeysemenyukoracle Jul 23, 2025
476bbf5
LauncherIconVerifier: add verifyFileInAppImageOnly() to control if to…
alexeysemenyukoracle Jul 28, 2025
184ce26
Remove redundant shortcut verification code: it duplicates code in Wi…
alexeysemenyukoracle Jul 24, 2025
095f8dc
Simplify AdditionalLauncher.PropertyFile
alexeysemenyukoracle Jul 24, 2025
ce9114f
Add missing CommandArguments.verifyMutable() calls.
alexeysemenyukoracle Jul 25, 2025
0775aa6
WindowsHelper: fix a typo
alexeysemenyukoracle Jul 26, 2025
fcdb5b0
AddLauncherTest, UpgradeTest, WinShortcutVerifier, ConfigFilesStasher…
alexeysemenyukoracle Jul 24, 2025
7131578
Use JPackageCommand.createMutableCopy()
alexeysemenyukoracle Jul 26, 2025
adc8e14
Decouple additional launcher configuration and verification in the Ad…
alexeysemenyukoracle Jul 27, 2025
512f9f9
PerUserCfgTest: follow-up changes in AdditionalLauncher
alexeysemenyukoracle Jul 26, 2025
1d54092
LauncherAsServiceVerifier: follow-up for the changes in the Additiona…
alexeysemenyukoracle Jul 27, 2025
fd50c91
Rework .desktop files verification: Always verify .desktop files are …
alexeysemenyukoracle Jul 28, 2025
251033b
PrintEnv: support `--print-workdir` CLI option and `jpackage.test.app…
alexeysemenyukoracle Jul 30, 2025
6156136
LinuxHelper: add getInvokeShortcutSpecs(); add DesktopFile type to st…
alexeysemenyukoracle Jul 30, 2025
f877049
WinShortcutVerifier: add getInvokeShortcutSpecs(); streamline expectL…
alexeysemenyukoracle Jul 30, 2025
27ed69b
AddLShortcutTest: add testStartupDirectory() tests to exercise combin…
alexeysemenyukoracle Jul 30, 2025
c76aacd
WinShortcutVerifier: fix bad merge
alexeysemenyukoracle Jul 31, 2025
869a0f6
AddLShortcutTest: make it work on Linux
alexeysemenyukoracle Jul 31, 2025
527b010
LinuxHelper: Use `gtk-launch` command to launch .desktop files
alexeysemenyukoracle Jul 31, 2025
d24a167
LauncherShortcut: bugfix
alexeysemenyukoracle Jul 31, 2025
4e08a42
LauncherShortcut: make it work with the current variant of jpackage w…
alexeysemenyukoracle Jul 31, 2025
442fc74
AdditionalLauncher: bugfix
alexeysemenyukoracle Jul 31, 2025
2dcae64
Consistent log message format
alexeysemenyukoracle Aug 1, 2025
7be8ad0
Bash script to clean jpackage test log files to reduce noise in diff-s
alexeysemenyukoracle Aug 1, 2025
9d55c1c
Fix a typo
alexeysemenyukoracle Aug 1, 2025
1c7e011
LinuxHelper: allow empty lines in .desktop files
alexeysemenyukoracle Aug 1, 2025
d7a1dc2
WinShortcutVerifier: make it a better fit for JDK-8308349
alexeysemenyukoracle Aug 1, 2025
63a2088
LinuxHelper: bugfix
alexeysemenyukoracle Aug 1, 2025
3cd7f7a
AddLShortcutTest: modify
alexeysemenyukoracle Aug 1, 2025
317354f
LinuxHelper: bugfix
alexeysemenyukoracle Aug 1, 2025
9617f83
AddLShortcutTest: make it a better fit for JDK-8308349
alexeysemenyukoracle Aug 1, 2025
0139d14
clean_test_output.sh: better
alexeysemenyukoracle Aug 1, 2025
73836c0
JPackageCommand: remove path to the unpacked directory from the argum…
alexeysemenyukoracle Aug 1, 2025
e80aba5
JPackageCommand: verify names of additional launcher are precisely re…
alexeysemenyukoracle Aug 2, 2025
3e63c20
LauncherShortcut: add appImageFilePropertyName()
alexeysemenyukoracle Aug 2, 2025
ff64379
Use java.time.Duration and java.time.Instant in TKit.waitForFileCreat…
alexeysemenyukoracle Aug 4, 2025
e4cdb22
Use TKit.waitForFileCreated() to await for test output file
alexeysemenyukoracle Aug 4, 2025
4742b3d
Merge branch 'JDK-8334238' of https://github.com/alexeysemenyukoracle…
alexeysemenyukoracle Aug 6, 2025
eb23b4a
Merge branch 'master' into JDK-8334238
alexeysemenyukoracle Aug 6, 2025
2d31e6a
TKit: bugfix
alexeysemenyukoracle Aug 6, 2025
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
33 changes: 28 additions & 5 deletions test/jdk/tools/jpackage/apps/PrintEnv.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,38 @@
* questions.
*/

import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class PrintEnv {

public static void main(String[] args) {
List<String> lines = printArgs(args);
lines.forEach(System.out::println);
Optional.ofNullable(System.getProperty("jpackage.test.appOutput")).map(Path::of).ifPresentOrElse(outputFilePath -> {
Optional.ofNullable(outputFilePath.getParent()).ifPresent(dir -> {
try {
Files.createDirectories(dir);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
});
try {
Files.write(outputFilePath, lines);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}, () -> {
lines.forEach(System.out::println);
});
}

private static List<String> printArgs(String[] args) {
Expand All @@ -45,11 +65,13 @@ private static List<String> printArgs(String[] args) {
} else if (arg.startsWith(PRINT_SYS_PROP)) {
String name = arg.substring(PRINT_SYS_PROP.length());
lines.add(name + "=" + System.getProperty(name));
} else if (arg.startsWith(PRINT_MODULES)) {
} else if (arg.equals(PRINT_MODULES)) {
lines.add(ModuleFinder.ofSystem().findAll().stream()
.map(ModuleReference::descriptor)
.map(ModuleDescriptor::name)
.collect(Collectors.joining(",")));
} else if (arg.equals(PRINT_WORK_DIR)) {
lines.add("$CD=" + Path.of("").toAbsolutePath());
} else {
throw new IllegalArgumentException();
}
Expand All @@ -58,7 +80,8 @@ private static List<String> printArgs(String[] args) {
return lines;
}

private final static String PRINT_ENV_VAR = "--print-env-var=";
private final static String PRINT_SYS_PROP = "--print-sys-prop=";
private final static String PRINT_MODULES = "--print-modules";
private static final String PRINT_ENV_VAR = "--print-env-var=";
private static final String PRINT_SYS_PROP = "--print-sys-prop=";
private static final String PRINT_MODULES = "--print-modules";
private static final String PRINT_WORK_DIR = "--print-workdir";
}
87 changes: 87 additions & 0 deletions test/jdk/tools/jpackage/clean_test_output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

# Copyright (c) 2025, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.

#
# Filters output produced by running jpackage test(s).
#

set -eu
set -o pipefail


sed_inplace_option=-i
sed_version_string=$(sed --version 2>&1 | head -1 || true)
if [ "${sed_version_string#sed (GNU sed)}" != "$sed_version_string" ]; then
# GNU sed, the default
:
elif [ "${sed_version_string#sed: illegal option}" != "$sed_version_string" ]; then
# Macos sed
sed_inplace_option="-i ''"
else
echo 'WARNING: Unknown sed variant, assume it is GNU compatible'
fi


filterFile () {
local expressions=(
# Strip leading log message timestamp `[19:33:44.713] `
-e 's/^\[[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]\{3\}\] //'

# Strip log message timestamps `[19:33:44.713]`
-e 's/\[[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]\{3\}\]//g'

# Convert variable part of R/O directory path timestamp `#2025-07-24T16:38:13.3589878Z`
-e 's/#[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]\{1,\}Z/#<ts>Z/'

# Strip variable part of temporary directory name `jdk.jpackage5060841750457404688`
-e 's|\([\/]\)jdk\.jpackage[0-9]\{1,\}\b|\1jdk.jpackage|g'

# Convert PID value `[PID: 131561]`
-e 's/\[PID: [0-9]\{1,\}\]/[PID: <pid>]/'

# Strip a warning message `Windows Defender may prevent jpackage from functioning`
-e '/Windows Defender may prevent jpackage from functioning/d'

# Convert variable part of test output directory `out-6268`
-e 's|\bout-[0-9]\{1,\}\b|out-N|g'

# Convert variable part of test summary `[ OK ] IconTest(AppImage, ResourceDirIcon, DefaultIcon).test; checks=39`
-e 's/^\(.*\bchecks=\)[0-9]\{1,\}\(\r\{0,1\}\)$/\1N\2/'

# Convert variable part of ldd output `libdl.so.2 => /lib64/libdl.so.2 (0x00007fbf63c81000)`
-e 's/(0x[[:xdigit:]]\{1,\})$/(0xHEX)/'

# Convert variable part of rpmbuild output `Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.CMO6a9`
-e 's|/rpm-tmp\...*$|/rpm-tmp.V|'

# Convert variable part of stack trace entry `at jdk.jpackage.test.JPackageCommand.execute(JPackageCommand.java:863)`
-e 's/^\(.*\b\.java:\)[0-9]\{1,\}\()\r\{0,1\}\)$/\1N\2/'
)

sed $sed_inplace_option "$1" "${expressions[@]}"
}


for f in "$@"; do
filterFile "$f"
done
Loading