<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 1, 2019 at 7:01 PM Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
----- Original Message -----<br>
> Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
> Cc: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br>
> ---<br>
>  include/tst_safe_macros.h                        | 16 ++++++++++++++++<br>
>  testcases/kernel/security/umip/umip_basic_test.c |  2 ++<br>
>  testcases/kernel/syscalls/ipc/shmat/shmat01.c    | 16 +++-------------<br>
>  3 files changed, 21 insertions(+), 13 deletions(-)<br>
> <br>
> diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h<br>
> index 53a888c80..110e2984f 100644<br>
> --- a/include/tst_safe_macros.h<br>
> +++ b/include/tst_safe_macros.h<br>
> @@ -394,6 +394,22 @@ static inline int safe_setrlimit(const char *file, const<br>
> int lineno,<br>
>  #define SAFE_SETRLIMIT(resource, rlim) \<br>
>       safe_setrlimit(__FILE__, __LINE__, (resource), (rlim))<br>
>  <br>
> +/*<br>
> + * Crash is expected, avoid dumping corefile.<br>
> + * 1 is a special value, that disables core-to-pipe.<br>
> + * At the same time it is small enough value for<br>
> + * core-to-file, so it skips creating cores as well.<br>
> + */<br>
> +static inline void tst_no_corefile(void)<br>
> +{<br>
> +       struct rlimit r;<br>
> +<br>
> +       r.rlim_cur = 1;<br>
> +       r.rlim_max = 1;<br>
> +       SAFE_SETRLIMIT(RLIMIT_CORE, &r);<br>
> +       tst_res(TINFO, "Avoid dumping corefile in following test");<br>
<br>
I'm fine with helper func. Maybe I'd print also current pid.<br>
It could be little spammy if there are many children, but we could<br>
address that later (if needed) with a parameter to control verbosity.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">To add a parameter (int verbose) sounds good to me.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Btw, should we add some note/comment in the document(test-writing-guidelines.txt)? I take a rough look but not sure which line is the best position for that.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>