Skip to content

Commit

Permalink
8347295: Fix WinResourceTest to make it work with WiX v4.0+
Browse files Browse the repository at this point in the history
Reviewed-by: almatvee
  • Loading branch information
Alexey Semenyuk committed Jan 10, 2025
1 parent 01c8ba2 commit 10f7142
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/jdk/tools/jpackage/windows/WinResourceTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand Down Expand Up @@ -30,6 +30,8 @@
import jdk.jpackage.test.Annotations.Test;
import jdk.jpackage.test.Annotations.Parameters;
import java.util.List;
import static jdk.jpackage.test.WindowsHelper.WixType.WIX3;
import static jdk.jpackage.test.WindowsHelper.getWixTypeFromVerboseJPackageOutput;

/**
* Test --resource-dir option. The test should set --resource-dir to point to
Expand Down Expand Up @@ -83,11 +85,18 @@ public void test() throws IOException {
.addBundleVerifier((cmd, result) -> {
// Assert jpackage picked custom main.wxs and failed as expected by
// examining its output
final String expectedWixErrorMsg;
if (getWixTypeFromVerboseJPackageOutput(result) == WIX3) {
expectedWixErrorMsg = "error CNDL0104 : Not a valid source file";
} else {
expectedWixErrorMsg = "error WIX0104: Not a valid source file";
}

TKit.assertTextStream(expectedLogMessage)
.predicate(String::startsWith)
.apply(JPackageCommand.stripTimestamps(
result.getOutput().stream()));
TKit.assertTextStream("error CNDL0104 : Not a valid source file")
TKit.assertTextStream(expectedWixErrorMsg)
.apply(result.getOutput().stream());
})
.setExpectedExitCode(1)
Expand Down

0 comments on commit 10f7142

Please sign in to comment.