From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 03/11] Add TST_TRACE
Date: Thu, 25 Aug 2016 15:09:22 +0300 [thread overview]
Message-ID: <57BEDFF2.9020309@oracle.com> (raw)
In-Reply-To: <20160825111517.GC10490@rei.lan>
On 08/25/2016 02:15 PM, Cyril Hrubis wrote:
> Hi!
>> +'TST_TRACE' can make the analysis of such situations easier. It's a macro which
>> +inserts a call to 'tst_res(TINFO, ...)' in case its argument is not zero.
> ^
> "evaluates to non-zero"
>
> would be more clear in
> this case
>
Ok.
>> +In this call to 'tst_res(TINFO, ...)' the file and line will be expanded using
>> +the actual location of 'TST_TRACE'.
>> +
>> +[source,c]
>> +-------------------------------------------------------------------------------
>> +#include "tst_test.h"
>> +
>> +if (TST_TRACE(do_action())) {
>> + ...
>> +}
>> +-------------------------------------------------------------------------------
>
> Maybe we should also include example test output here. Otherise the
> description looks good to me.
Ok. Will add one.
>
>> 2.3.1 Basic shell test structure
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> diff --git a/include/tst_test.h b/include/tst_test.h
>> index 3e2ff5b..eb3f751 100644
>> --- a/include/tst_test.h
>> +++ b/include/tst_test.h
>> @@ -59,6 +59,10 @@ pid_t safe_fork(const char *filename, unsigned int lineno);
>> #define SAFE_FORK() \
>> safe_fork(__FILE__, __LINE__)
>>
>> +#define TST_TRACE(expr) \
>> + ({int ret = expr; \
>> + ret != 0 ? tst_res(TINFO, #expr " failed"), ret : ret; })
>> +
>
> I would format this to something as:
>
> #define TST_TRACE(expr) \
> ({int ret = expr; \
> ret != 0 ? tst_res(TINFO, #expr " failed"), ret : ret; }) \
>
> But that is very minor.
No problem, will do it.
>
next prev parent reply other threads:[~2016-08-25 12:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 12:27 [LTP] waitpid: new API (part 2) V2 Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 01/11] waitpid09: use the new API Stanislav Kholmanskikh
2016-08-25 10:49 ` Cyril Hrubis
2016-08-24 12:27 ` [LTP] [PATCH V2 02/11] waitpid10: " Stanislav Kholmanskikh
2016-08-25 11:09 ` Cyril Hrubis
2016-08-24 12:27 ` [LTP] [PATCH V2 03/11] Add TST_TRACE Stanislav Kholmanskikh
2016-08-25 11:15 ` Cyril Hrubis
2016-08-25 12:09 ` Stanislav Kholmanskikh [this message]
2016-08-24 12:27 ` [LTP] [PATCH V2 04/11] syscalls/waitpid: call reap_children() via TST_TRACE() Stanislav Kholmanskikh
2016-08-25 11:20 ` Cyril Hrubis
2016-08-25 11:56 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 05/11] syscalls/waitpid: implement waitpid_ret_test() Stanislav Kholmanskikh
2016-08-25 11:28 ` Cyril Hrubis
2016-08-25 12:00 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 06/11] syscalls/waitpid: make reap_children() fail if errno is not ECHILD Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 07/11] waitpid11: update the description Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 08/11] waitpid12: use the new API Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 09/11] syscalls/waitpid: adapt reap_children() to test stopped children Stanislav Kholmanskikh
2016-08-25 11:39 ` Cyril Hrubis
2016-08-25 12:02 ` Stanislav Kholmanskikh
2016-08-24 12:27 ` [LTP] [PATCH V2 10/11] waitpid13: use the new API Stanislav Kholmanskikh
2016-08-25 12:07 ` Cyril Hrubis
2016-08-24 12:27 ` [LTP] [PATCH V2 11/11] waitpid08: test stopped children Stanislav Kholmanskikh
2016-08-25 12:08 ` Cyril Hrubis
2016-08-26 9:06 ` Stanislav Kholmanskikh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57BEDFF2.9020309@oracle.com \
--to=stanislav.kholmanskikh@oracle.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox