Fix bug in TestBA where it should only plan after the last detect.
Sean Hall committed
Jan 28, 2021 at 10:58 UTC
25974affb2c78a3816ff0167ec0e756daa9d7345
1 file changed
+18
-12
src/Utilities/TestBA/TestBA.cs
+18
-12
@@ -25,6 +25,7 @@ namespace WixToolset.Test.BA
25
26
private string updateBundlePath;
27
28
+ private int redetectCount;
29
private int sleepDuringCache;
30
private int cancelCacheAtProgress;
31
private int sleepDuringExecute;
@@ -105,18 +106,14 @@ namespace WixToolset.Test.BA
106
this.dummyWindow.CreateControl();
107
this.appContext = new ApplicationContext();
108
108
- int redetectCount = 0;
109
+ this.redetectCount = 0;
110
string redetect = this.ReadPackageAction(null, "RedetectCount");
110
- if (String.IsNullOrEmpty(redetect) || !Int32.TryParse(redetect, out redetectCount))
111
+ if (String.IsNullOrEmpty(redetect) || !Int32.TryParse(redetect, out this.redetectCount))
112
{
112
- redetectCount = 0;
113
+ this.redetectCount = 0;
114
}
115
115
- do
116
- {
117
- this.Engine.Detect();
118
- this.Log("Completed detection phase: {0} re-runs remaining", redetectCount);
119
- } while (0 < redetectCount--);
116
+ this.Engine.Detect();
117
118
Application.Run(this.appContext);
119
this.Engine.Quit(this.result & 0xFFFF); // return plain old Win32 error, not HRESULT.
@@ -125,7 +122,7 @@ namespace WixToolset.Test.BA
122
protected override void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args)
123
{
124
this.Log("OnDetectUpdateBegin");
128
- if ((LaunchAction.UpdateReplaceEmbedded == this.action)|(LaunchAction.UpdateReplace == this.action))
125
+ if (LaunchAction.UpdateReplaceEmbedded == this.action || LaunchAction.UpdateReplace == this.action)
126
{
127
args.Skip = false;
128
}
@@ -167,9 +164,18 @@ namespace WixToolset.Test.BA
164
{
165
this.result = args.Status;
166
170
- if (Hresult.Succeeded(this.result) && (this.UpdateAvailable | (!((LaunchAction.UpdateReplaceEmbedded == this.action) | (LaunchAction.UpdateReplace == this.action)))))
171
- {
172
- this.Engine.Plan(this.action);
167
+ if (Hresult.Succeeded(this.result) &&
168
+ (this.UpdateAvailable || LaunchAction.UpdateReplaceEmbedded != this.action && LaunchAction.UpdateReplace != this.action))
169
+ {
170
+ if (this.redetectCount > 0)
171
+ {
172
+ this.Log("Completed detection phase: {0} re-runs remaining", this.redetectCount--);
173
+ this.Engine.Detect();
174
+ }
175
+ else
176
+ {
177
+ this.Engine.Plan(this.action);
178
+ }
179
}
180
else
181
{