Bug 206858 - Reset the application bundle identifier between test runs
Summary: Reset the application bundle identifier between test runs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-27 17:50 PST by Brent Fulgham
Modified: 2020-01-28 13:02 PST (History)
7 users (show)

See Also:


Attachments
Patch (1.42 KB, patch)
2020-01-27 17:52 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (2.77 KB, patch)
2020-01-28 09:51 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (9.28 KB, patch)
2020-01-28 12:15 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch for landing (9.28 KB, patch)
2020-01-28 12:39 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2020-01-27 17:50:09 PST
In Bug 205316 we added new infrastructure to allow us to switch Application Bundle Identifier for testing purposes.

Unfortunately, this is creating some "crashes" on our bots (without stack traces) because of the following code:

    if (m_hasSetApplicationBundleIdentifier) {
        // Exit if the application bundle identifier has already been set, since it can only be set once.
        exit(1);
    }

This is a problem, because WKTR streams test input, and may interleave ‘com.apple.mail’ tests with “no-bundle-id” tests, which triggers this exit.

We should clear the bundle identifier state once a test ends, so that it is in a good state for the next test run.
Comment 1 Brent Fulgham 2020-01-27 17:50:27 PST
<rdar://problem/58844002>
Comment 2 Brent Fulgham 2020-01-27 17:52:57 PST
Created attachment 388951 [details]
Patch
Comment 3 Per Arne Vollan 2020-01-28 08:30:44 PST
Comment on attachment 388951 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388951&action=review

Thanks for tracking this down!

> Tools/WebKitTestRunner/TestController.cpp:1089
> +    setApplicationBundleIdentifier(String());

I wonder if this could hit an assert since it would set the bundle identifier after it has been queried?
Comment 4 Maciej Stachowiak 2020-01-28 09:31:00 PST
Comment on attachment 388951 [details]
Patch

Need to fix the build errors on gtk, wee, wincairo and win, assuming they are caused by this patch. Otherwise looks good.
Comment 5 Brent Fulgham 2020-01-28 09:51:25 PST
Created attachment 389019 [details]
Patch
Comment 6 Brent Fulgham 2020-01-28 09:58:13 PST
(In reply to Maciej Stachowiak from comment #4)
> Comment on attachment 388951 [details]
> Patch
> 
> Need to fix the build errors on gtk, wee, wincairo and win, assuming they
> are caused by this patch. Otherwise looks good.

Done.
Comment 7 Brent Fulgham 2020-01-28 09:58:43 PST
(In reply to Per Arne Vollan from comment #3)
> Comment on attachment 388951 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=388951&action=review
> 
> Thanks for tracking this down!
> 
> > Tools/WebKitTestRunner/TestController.cpp:1089
> > +    setApplicationBundleIdentifier(String());
> 
> I wonder if this could hit an assert since it would set the bundle
> identifier after it has been queried?

I think you are right. I think I need to make a 'clear' method that will reset that value too. These tests run on device in Release build, so I didn't notice this.
Comment 8 Per Arne Vollan 2020-01-28 10:50:31 PST
(In reply to Brent Fulgham from comment #7)
> (In reply to Per Arne Vollan from comment #3)
> > Comment on attachment 388951 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=388951&action=review
> > 
> > Thanks for tracking this down!
> > 
> > > Tools/WebKitTestRunner/TestController.cpp:1089
> > > +    setApplicationBundleIdentifier(String());
> > 
> > I wonder if this could hit an assert since it would set the bundle
> > identifier after it has been queried?
> 
> I think you are right. I think I need to make a 'clear' method that will
> reset that value too. These tests run on device in Release build, so I
> didn't notice this.

We pass the bundle identifier on to the Networking and WebContent process when they are started as well. There might be a risk of ending up with different bundle identifiers for the various processes. Would it be possible to find a way of exiting more "cleanly", so that it will not get picked up as a crash by the scripts? Is this based on return value?
Comment 9 Brent Fulgham 2020-01-28 12:15:12 PST
Created attachment 389048 [details]
Patch
Comment 10 Per Arne Vollan 2020-01-28 12:23:03 PST
Comment on attachment 389048 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=389048&action=review

Looks good! Should we also delete the code which exits, and the associated flag? R=me.

> Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm:72
> +    applicationBundleIdentifierOverride() = String();

emptyString()?
Comment 11 Brent Fulgham 2020-01-28 12:39:19 PST
Comment on attachment 389048 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=389048&action=review

>> Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm:72
>> +    applicationBundleIdentifierOverride() = String();
> 
> emptyString()?

Good idea.
Comment 12 Brent Fulgham 2020-01-28 12:39:37 PST
Created attachment 389050 [details]
Patch for landing
Comment 13 Brent Fulgham 2020-01-28 12:40:24 PST
(In reply to Per Arne Vollan from comment #10)
> Comment on attachment 389048 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=389048&action=review
> 
> Looks good! Should we also delete the code which exits, and the associated
> flag? R=me.

No -- I think it's good to guard against something attempting to set the bundle identifier twice, or for us forgetting to clear it.
Comment 14 WebKit Commit Bot 2020-01-28 13:02:37 PST
Comment on attachment 389050 [details]
Patch for landing

Clearing flags on attachment: 389050

Committed r255271: <https://trac.webkit.org/changeset/255271>
Comment 15 WebKit Commit Bot 2020-01-28 13:02:39 PST
All reviewed patches have been landed.  Closing bug.