diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-01-02 19:00:16 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-01-03 15:49:32 -0600 |
| commit | b673734cce44dd28c1d4d1810da3069324466166 (patch) | |
| tree | ada7f6d994a1dbcf09e8b30b95f7b2c403a0a7f6 /src/test/WixToolsetTest.CoreIntegration | |
| parent | 643a5c5db1da6fb68fdc353bbbdbecaa1964425e (diff) | |
| download | wix-b673734cce44dd28c1d4d1810da3069324466166.tar.gz wix-b673734cce44dd28c1d4d1810da3069324466166.tar.bz2 wix-b673734cce44dd28c1d4d1810da3069324466166.zip | |
Implement command line for SuppressAllWarnings and WarningsAsError.
Make WixRunner.Execute default to setting WarningsAsError to make sure tests are not accidentally causing warnings.
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
7 files changed, 70 insertions, 2 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs index 5e08ca58..d85eb3bf 100644 --- a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs | |||
| @@ -55,6 +55,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 55 | var result = WixRunner.Execute(new[] | 55 | var result = WixRunner.Execute(new[] |
| 56 | { | 56 | { |
| 57 | "build", | 57 | "build", |
| 58 | "-sw1008", // this is expected for this test | ||
| 58 | Path.Combine(folder, "Package.wxs"), | 59 | Path.Combine(folder, "Package.wxs"), |
| 59 | Path.Combine(folder, "PackageComponents.wxs"), | 60 | Path.Combine(folder, "PackageComponents.wxs"), |
| 60 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | 61 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), |
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index 740d58c7..e26e197f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
| @@ -162,6 +162,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 162 | var result = WixRunner.Execute(new[] | 162 | var result = WixRunner.Execute(new[] |
| 163 | { | 163 | { |
| 164 | "build", | 164 | "build", |
| 165 | "-sw1079", // TODO: why does this test need to create a second cab which is empty? | ||
| 165 | Path.Combine(folder, "Package.wxs"), | 166 | Path.Combine(folder, "Package.wxs"), |
| 166 | Path.Combine(folder, "PackageComponents.wxs"), | 167 | Path.Combine(folder, "PackageComponents.wxs"), |
| 167 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | 168 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), |
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 11b1703c..b71b62cb 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs | |||
| @@ -357,6 +357,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 357 | var result = WixRunner.Execute(new[] | 357 | var result = WixRunner.Execute(new[] |
| 358 | { | 358 | { |
| 359 | "build", | 359 | "build", |
| 360 | "-sw1031", // this is expected for this test | ||
| 360 | Path.Combine(folder, "DefaultDir", "DefaultDir.wxs"), | 361 | Path.Combine(folder, "DefaultDir", "DefaultDir.wxs"), |
| 361 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | 362 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), |
| 362 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | 363 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), |
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs index 5a29eb9e..7ec0ea93 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiTransactionFixture.cs | |||
| @@ -26,6 +26,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 26 | var result = WixRunner.Execute(new[] | 26 | var result = WixRunner.Execute(new[] |
| 27 | { | 27 | { |
| 28 | "build", | 28 | "build", |
| 29 | "-sw1151", // this is expected for this test | ||
| 29 | Path.Combine(folder, "MsiTransaction", "X64AfterX86Bundle.wxs"), | 30 | Path.Combine(folder, "MsiTransaction", "X64AfterX86Bundle.wxs"), |
| 30 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | 31 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), |
| 31 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | 32 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
| @@ -55,6 +56,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 55 | var result = WixRunner.Execute(new[] | 56 | var result = WixRunner.Execute(new[] |
| 56 | { | 57 | { |
| 57 | "build", | 58 | "build", |
| 59 | "-sw1151", // this is expected for this test | ||
| 58 | Path.Combine(folder, "MsiTransaction", "X86AfterX64Bundle.wxs"), | 60 | Path.Combine(folder, "MsiTransaction", "X86AfterX64Bundle.wxs"), |
| 59 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), | 61 | Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), |
| 60 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | 62 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
diff --git a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs index 4a9344b9..4fc57c76 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs | |||
| @@ -61,7 +61,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 61 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 61 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 62 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | 62 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); |
| 63 | 63 | ||
| 64 | var result = WixRunner.Execute(new[] | 64 | var result = WixRunner.Execute(warningsAsErrors: false, new[] |
| 65 | { | 65 | { |
| 66 | "build", | 66 | "build", |
| 67 | Path.Combine(folder, "CanonicalizeName.wxs"), | 67 | Path.Combine(folder, "CanonicalizeName.wxs"), |
diff --git a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs index e18990d3..a6504cb9 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs | |||
| @@ -49,7 +49,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 49 | var baseFolder = fs.GetFolder(); | 49 | var baseFolder = fs.GetFolder(); |
| 50 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 50 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 51 | 51 | ||
| 52 | var result = WixRunner.Execute(new[] | 52 | var result = WixRunner.Execute(warningsAsErrors: false, new[] |
| 53 | { | 53 | { |
| 54 | "build", | 54 | "build", |
| 55 | Path.Combine(folder, "Package.wxs"), | 55 | Path.Combine(folder, "Package.wxs"), |
diff --git a/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs new file mode 100644 index 00000000..c5b6c261 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.CoreIntegration | ||
| 4 | { | ||
| 5 | using System.IO; | ||
| 6 | using WixBuildTools.TestSupport; | ||
| 7 | using WixToolset.Core.TestPackage; | ||
| 8 | using WixToolset.Data; | ||
| 9 | using Xunit; | ||
| 10 | |||
| 11 | public class WarningFixture | ||
| 12 | { | ||
| 13 | [Fact] | ||
| 14 | public void SuppressedWarningsWithWarningAsErrorsAreNotErrors() | ||
| 15 | { | ||
| 16 | var folder = TestData.Get(@"TestData\Payload"); | ||
| 17 | |||
| 18 | using (var fs = new DisposableFileSystem()) | ||
| 19 | { | ||
| 20 | var baseFolder = fs.GetFolder(); | ||
| 21 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 22 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
| 23 | |||
| 24 | var result = WixRunner.Execute(warningsAsErrors: true, new[] | ||
| 25 | { | ||
| 26 | "build", | ||
| 27 | "-sw1152", | ||
| 28 | Path.Combine(folder, "CanonicalizeName.wxs"), | ||
| 29 | "-intermediateFolder", intermediateFolder, | ||
| 30 | "-o", wixlibPath, | ||
| 31 | }); | ||
| 32 | |||
| 33 | result.AssertSuccess(); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | [Fact] | ||
| 38 | public void WarningsAsErrorsTreatsWarningsAsErrors() | ||
| 39 | { | ||
| 40 | var folder = TestData.Get(@"TestData\Payload"); | ||
| 41 | |||
| 42 | using (var fs = new DisposableFileSystem()) | ||
| 43 | { | ||
| 44 | var baseFolder = fs.GetFolder(); | ||
| 45 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 46 | var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); | ||
| 47 | |||
| 48 | var result = WixRunner.Execute(warningsAsErrors: true, new[] | ||
| 49 | { | ||
| 50 | "build", | ||
| 51 | Path.Combine(folder, "CanonicalizeName.wxs"), | ||
| 52 | "-intermediateFolder", intermediateFolder, | ||
| 53 | "-o", wixlibPath, | ||
| 54 | }); | ||
| 55 | |||
| 56 | Assert.Equal((int)WarningMessages.Ids.PathCanonicalized, result.ExitCode); | ||
| 57 | |||
| 58 | var message = Assert.Single(result.Messages); | ||
| 59 | Assert.Equal(MessageLevel.Warning, message.Level); // TODO: is this right? | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
