Closed Bug 712155 Opened 8 years ago Closed 8 years ago

Maintenance service: Wait for service to stop before starting the next xpcshell test


(Toolkit :: Application Update, defect)

Windows 7
Not set





(Reporter: bbondy, Assigned: bbondy)



(2 files, 1 obsolete file)

If the service is already running (i.e. it is already processing a command) then we fallback to a UAC prompt.  When XPCShell tests run we don't allow a fallback so in this case an error code is written to the update.status file.

If you run 2 xpcshell tests for the maintenance service in a row, it has a small chance of failing due to the 2nd one not using the service.  This is because the 2nd one can start before the first one stopped.
Attached patch Patch v1. (obsolete) — Splinter Review
As per our previous discussion, this replaces the 1 second wait with calling the AUS test app to do a wait for the amount of time necessary for the service to stop.  It is capped at 10 seconds.
Attachment #582982 - Flags: review?(robert.bugzilla)
Comment on attachment 582982 [details] [diff] [review]
Patch v1.

>diff --git a/toolkit/mozapps/update/common/updatelogging.h b/toolkit/mozapps/update/common/updatelogging.h
>--- a/toolkit/mozapps/update/common/updatelogging.h
>+++ b/toolkit/mozapps/update/common/updatelogging.h
>@@ -41,37 +41,35 @@
> #include "updatedefines.h"
> #include <stdio.h>
> class UpdateLog
> {
> public:
>   static UpdateLog & GetPrimaryLog() 
>   {
>-    if (!primaryLog) {
>-      primaryLog = new UpdateLog();
>-    }
>-    return *primaryLog;
>+    static UpdateLog primvaryLog;
>+    return primvaryLog;

>diff --git a/toolkit/mozapps/update/test/TestAUSHelper.cpp b/toolkit/mozapps/update/test/TestAUSHelper.cpp
>--- a/toolkit/mozapps/update/test/TestAUSHelper.cpp
>+++ b/toolkit/mozapps/update/test/TestAUSHelper.cpp
>@@ -146,16 +146,72 @@ VerifyCertificateTrustForFile(LPCWSTR fi
>   // no UI
>   trustData.dwUIContext = 0;
>   trustData.pFile = &fileToCheck;
>   // Check if the file is signed by something that is trusted.
>   return WinVerifyTrust(NULL, &policyGUID, &trustData);
> }
>+ * Waits for a service to enter a stopped state.
>+ * This function does not stop the service, it just blocks until the service
>+ * is stopped.
>+ *
>+ * @param  serviceName The service to wait for.
>+ * @param  maxWaitMS   The maximum number of MS to wait
I'm ok with this but I think it is clearer and simpler just to use seconds with a test helper like this.

No reason for me to review this again unless you would like me to.
Attachment #582982 - Flags: review?(robert.bugzilla) → review+
Attached patch Base patch.Splinter Review
Implemented nits and also changed from ms to seconds.
Attachment #582982 - Attachment is obsolete: true
Attachment #582991 - Flags: review+
Attachment #583256 - Flags: review?(robert.bugzilla)
Attachment #582991 - Attachment description: Patch v2. → Base patch.
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in before you can comment on or make changes to this bug.