[PATCH] D29954: [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 09:55:38 PST 2017


It's not easy to write a test case for this. We need the extended period of
profile write to expose the faulty behavior. This is not easy for small
test programs.
I can register another atexit function that opens and locks the profile to
mimic this.
The flow is like:
main process:  __llvm_profile_write_file, open_profile, lock_profile,
close_profile, _exit
child process:    sleep
 __llvm_profile_write

But this is not really testing the code directly.
Another thing is since merge is only enabled with %m specifier, i need to
get the string expansion for %m, or I need to read the directory to find
the profile. This is quite cumbersome.

Or a simple version is just a test that using small profile and let the
race happen.
There are two outcomes: (1) if the main process exits before the child
process voiding the sigkill, we have the profile for the main process only.
(2) if the child process get time to void sigkill, we get merged profile.
The check would assert that 0-size profile should not happen.

Do you have better idea?


On Wed, Feb 15, 2017 at 9:38 AM, Rong Xu <xur at google.com> wrote:

>
>
> On Tue, Feb 14, 2017 at 1:05 PM, David Li via Phabricator <
> reviews at reviews.llvm.org> wrote:
>
>> davidxl added a comment.
>>
>> Can you create a test case? It can be put under the Linux subdir.
>>
>>
>> https://reviews.llvm.org/D29954
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170215/a0e96075/attachment.html>


More information about the llvm-commits mailing list