diff options
author | Ronald Martin <cpuwzd@comcast.net> | 2021-02-12 22:37:15 -0500 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-02-19 14:57:41 -0800 |
commit | 9dd02e0c1bb6463de5d79f14ce06d078ef876a32 (patch) | |
tree | 96a3f60f31990d9c0a6ffb5c4d8d2430b277f695 /src/test | |
parent | 0ce3a9b66da80c505fd8901df88d31b0ad43dac6 (diff) | |
download | wix-9dd02e0c1bb6463de5d79f14ce06d078ef876a32.tar.gz wix-9dd02e0c1bb6463de5d79f14ce06d078ef876a32.tar.bz2 wix-9dd02e0c1bb6463de5d79f14ce06d078ef876a32.zip |
Checkks all custom actions for cycles. Version 3. Fixes wixtoolset/issues#6201
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs | 37 | ||||
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/CustomActionCycleWithTail.wxs | 20 |
2 files changed, 51 insertions, 6 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs index 65f4be31..7980ea61 100644 --- a/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs | |||
@@ -11,7 +11,7 @@ namespace WixToolsetTest.CoreIntegration | |||
11 | 11 | ||
12 | public class CustomActionFixture | 12 | public class CustomActionFixture |
13 | { | 13 | { |
14 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6201")] | 14 | [Fact] |
15 | public void CanDetectCustomActionCycle() | 15 | public void CanDetectCustomActionCycle() |
16 | { | 16 | { |
17 | var folder = TestData.Get(@"TestData"); | 17 | var folder = TestData.Get(@"TestData"); |
@@ -22,8 +22,8 @@ namespace WixToolsetTest.CoreIntegration | |||
22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
23 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | 23 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); |
24 | 24 | ||
25 | var result = WixRunner.Execute(new[] | 25 | var exception = Assert.Throws<WixException>(() => WixRunner.Execute(new[] |
26 | { | 26 | { |
27 | "build", | 27 | "build", |
28 | Path.Combine(folder, "CustomAction", "CustomActionCycle.wxs"), | 28 | Path.Combine(folder, "CustomAction", "CustomActionCycle.wxs"), |
29 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | 29 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), |
@@ -31,10 +31,35 @@ namespace WixToolsetTest.CoreIntegration | |||
31 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | 31 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), |
32 | "-intermediateFolder", intermediateFolder, | 32 | "-intermediateFolder", intermediateFolder, |
33 | "-o", msiPath | 33 | "-o", msiPath |
34 | }); | 34 | })); |
35 | |||
36 | Assert.Equal("The InstallExecuteSequence table contains an action 'Action1' that is scheduled to come before or after action 'Action3', which is also scheduled to come before or after action 'Action1'. Please remove this circular dependency by changing the Before or After attribute for one of the actions.", exception.Message); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | [Fact] | ||
41 | public void CanDetectCustomActionCycleWithTail() | ||
42 | { | ||
43 | var folder = TestData.Get(@"TestData"); | ||
44 | |||
45 | using (var fs = new DisposableFileSystem()) | ||
46 | { | ||
47 | var baseFolder = fs.GetFolder(); | ||
48 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
49 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
50 | |||
51 | var exception = Assert.Throws<WixException>(() => WixRunner.Execute(new[] | ||
52 | { | ||
53 | "build", | ||
54 | Path.Combine(folder, "CustomAction", "CustomActionCycleWithTail.wxs"), | ||
55 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
56 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
57 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
58 | "-intermediateFolder", intermediateFolder, | ||
59 | "-o", msiPath | ||
60 | })); | ||
35 | 61 | ||
36 | var warnings = result.Messages.Where(m => m.Level == MessageLevel.Warning).ToArray(); | 62 | Assert.Equal("The InstallExecuteSequence table contains an action 'Action2' that is scheduled to come before or after action 'Action4', which is also scheduled to come before or after action 'Action2'. Please remove this circular dependency by changing the Before or After attribute for one of the actions.", exception.Message); |
37 | Assert.False(result.ExitCode == 0 && warnings.Length == 0); | ||
38 | } | 63 | } |
39 | } | 64 | } |
40 | 65 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/CustomActionCycleWithTail.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/CustomActionCycleWithTail.wxs new file mode 100644 index 00000000..c64ef143 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/CustomActionCycleWithTail.wxs | |||
@@ -0,0 +1,20 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Fragment> | ||
3 | <ComponentGroup Id="ProductComponents"> | ||
4 | <ComponentGroupRef Id="MinimalComponentGroup" /> | ||
5 | </ComponentGroup> | ||
6 | |||
7 | <Binary Id="Binary1" SourceFile="test.txt" /> | ||
8 | <CustomAction Id="Action1" DllEntry="EntryPoint1" BinaryRef="Binary1" /> | ||
9 | <CustomAction Id="Action2" DllEntry="EntryPoint2" BinaryRef="Binary1" /> | ||
10 | <CustomAction Id="Action3" DllEntry="EntryPoint3" BinaryRef="Binary1" /> | ||
11 | <CustomAction Id="Action4" DllEntry="EntryPoint4" BinaryRef="Binary1" /> | ||
12 | |||
13 | <InstallExecuteSequence> | ||
14 | <Custom Action="Action1" After="Action2" /> | ||
15 | <Custom Action="Action2" After="Action3" /> | ||
16 | <Custom Action="Action3" After="Action4" /> | ||
17 | <Custom Action="Action4" After="Action2" /> | ||
18 | </InstallExecuteSequence> | ||
19 | </Fragment> | ||
20 | </Wix> \ No newline at end of file | ||