From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/8] syscalls/waitpid: implement waitpid_ret_test()
Date: Thu, 18 Aug 2016 18:15:22 +0300 [thread overview]
Message-ID: <57B5D10A.4070406@oracle.com> (raw)
In-Reply-To: <20160818104245.GA24254@rei.lan>
On 08/18/2016 01:42 PM, Cyril Hrubis wrote:
> Hi!
>> So you mean something like the attached function. Right?
>
> Yes.
>
>> With this code a failure will be presented as:
>>
>> [stas@kholmanskikh waitpid]$ ./waitpid07
>> tst_test.c:756: INFO: Timeout per run is 0h 05m 00s
>> waitpid07.c:51: FAIL: waitpid() returned 0, expected 666
>>
>> whereas with the original code:
>>
>> [stas@kholmanskikh waitpid]$ ./waitpid07
>> tst_test.c:756: INFO: Timeout per run is 0h 05m 00s
>> waitpid_common.h:97: FAIL: waitpid() returned 0, expected 666
>>
>> I.e. in the former case a user will be given the function which failed
>> and will need to go to its code to find the corresponding tst_res(TFAIL)
>> call, whereas with the original code he/she will be given the
>> tst_res(TFAIL) call, but will need to manually find a corresponding
>> function call in the test case sources. Yes, the former case is more
>> user friendly, but, to be honest, I don't think it's worth the added
>> complexity.
>
> The whole motivation for printing the file and line in the
> tst_res()/tst_brk() was to make it easier to analyse failures from test
> logs. I.e. somebody posts test failure logs on the ML and you can see
> what failed and where just by looking at the logs.
>
> Sure you can add a few more test prints, recompile and run the test and
> see what went wrong. But once you have to ask somebody at the other end
> to do that and run it on a specific hardware or wait for other tests to
> finish on a shared machine just to rerun the test, things get more
> complicated.
>
> So I would really want to keep the file and line tied closely to the
> place in the source where the failure occured.
>
> Here it could be done either by:
>
> * Passing the file and line as in the snippet you send in this email
> - here we pay a price by making the code more complex
>
> * Implementing the whole check as a macro
> - ugly but does the job
Like this (sorry for formatting):
#define WAITPID_RET_TEST(wp_pid, wp_status, wp_opts, wp_ret, wp_errno) \
do { \
if (waitpid_ret_test(wp_pid, wp_status, \
wp_opts, wp_ret, wp_errno)) { \
tst_res_(__FILE__, __LINE__, TFAIL, \
"waitpid_ret_test() failed"); \
return; \
} \
} while (0)
?
This will produce:
[stas@kholmanskikh waitpid]$ ./waitpid07
tst_test.c:756: INFO: Timeout per run is 0h 05m 00s
waitpid_common.h:97: FAIL: waitpid() returned 0, expected 666
waitpid07.c:51: FAIL: waitpid_ret_test() failed
Summary:
passed 0
failed 2
skipped 0
warnings 0
A similar operation would be required for reap_children().
>
> * Keeping the checks in the source code
> - we repeat the same pattern of code over and over there
>
> None of these is really good solution to the problem unfortunately.
>
>
>
> There may be a better solution, and I'm thinking of that one for quite
> some time. We may be as well able to generate the tests from templates
> which is something I would like to explore in the long term. But that
> approach has another set of problems on it's own.
>
next prev parent reply other threads:[~2016-08-18 15:15 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-10 8:40 [LTP] waitpid: new API (part 2) Stanislav Kholmanskikh
2016-08-10 8:40 ` [LTP] [PATCH 1/8] waitpid09: use the new API Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 2/8] waitpid10: " Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 3/8] syscalls/waitpid: implement waitpid_ret_test() Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 4/8] syscalls/waitpid: make reap_children() fail if errno is not ECHILD Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 5/8] waitpid11: update the description Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 6/8] waitpid12: use the new API Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 7/8] waitpid13: " Stanislav Kholmanskikh
2016-08-10 8:41 ` [LTP] [PATCH 8/8] waitpid08: test stopped children Stanislav Kholmanskikh
2016-08-16 13:03 ` Cyril Hrubis
2016-08-18 10:12 ` Stanislav Kholmanskikh
2016-08-18 10:48 ` Cyril Hrubis
2016-08-18 11:37 ` Stanislav Kholmanskikh
2016-08-16 13:24 ` [LTP] [PATCH 7/8] waitpid13: use the new API Cyril Hrubis
2016-08-16 13:20 ` [LTP] [PATCH 6/8] waitpid12: " Cyril Hrubis
2016-08-15 15:51 ` [LTP] [PATCH 5/8] waitpid11: update the description Cyril Hrubis
2016-08-15 15:49 ` [LTP] [PATCH 4/8] syscalls/waitpid: make reap_children() fail if errno is not ECHILD Cyril Hrubis
2016-08-15 15:27 ` [LTP] [PATCH 3/8] syscalls/waitpid: implement waitpid_ret_test() Cyril Hrubis
2016-08-18 9:54 ` Stanislav Kholmanskikh
2016-08-18 10:42 ` Cyril Hrubis
2016-08-18 15:15 ` Stanislav Kholmanskikh [this message]
2016-08-18 15:43 ` Cyril Hrubis
2016-08-18 15:54 ` Cyril Hrubis
2016-08-19 9:47 ` Stanislav Kholmanskikh
2016-08-22 17:38 ` Cyril Hrubis
2016-08-15 14:36 ` [LTP] [PATCH 2/8] waitpid10: use the new API Cyril Hrubis
2016-08-18 8:25 ` Stanislav Kholmanskikh
2016-08-18 8:33 ` Stanislav Kholmanskikh
2016-08-18 9:19 ` Cyril Hrubis
2016-08-15 13:55 ` [LTP] [PATCH 1/8] waitpid09: " Cyril Hrubis
2016-08-18 7:40 ` [LTP] [PATCH 1/8 V2] " 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=57B5D10A.4070406@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