[LTP] [PATCH v2 1/2] tst_test_macros: add TST_EXP_FAIL_SILENT

Jan Stancek jstancek@redhat.com
Mon Feb 7 10:17:36 CET 2022


On Sat, Feb 5, 2022 at 4:07 AM Li Wang <liwang@redhat.com> wrote:
>
>
>
> On Fri, Feb 4, 2022 at 9:14 PM Jan Stancek <jstancek@redhat.com> wrote:
>>
>> This variant does not print TPASS messages when
>> SCALL fails as expected.
>>
>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
>> ---
>>  doc/c-test-api.txt        |  3 +++
>>  include/tst_test_macros.h | 15 ++++++++++-----
>>  2 files changed, 13 insertions(+), 5 deletions(-)
>>
>> diff --git a/doc/c-test-api.txt b/doc/c-test-api.txt
>> index 6f4de3f80f95..9119e094dbfd 100644
>> --- a/doc/c-test-api.txt
>> +++ b/doc/c-test-api.txt
>> @@ -298,6 +298,9 @@ The 'TST_EXP_FAIL2()' is the same as 'TST_EXP_FAIL()' except the return value is
>>  expected to be non-negative integer if call passes. These macros build upon the
>>  +TEST()+ macro and associated variables.
>>
>> +'TST_EXP_FAIL_SILENT()' and 'TST_EXP_FAIL2_SILENT()' variants are less verbose
>> +and do not print TPASS messages when SCALL fails as expected.
>> +
>>  [source,c]
>>  -------------------------------------------------------------------------------
>>  TEST(socket(AF_INET, SOCK_RAW, 1));
>> diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
>> index ec8c38523344..f7de8d00a666 100644
>> --- a/include/tst_test_macros.h
>> +++ b/include/tst_test_macros.h
>> @@ -163,7 +163,7 @@ extern void *TST_RET_PTR;
>>                         TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__);     \
>>         } while (0)                                                            \
>>
>> -#define TST_EXP_FAIL_(PASS_COND, SCALL, SSCALL, ERRNO, ...)                    \
>> +#define TST_EXP_FAIL_(SILENT, PASS_COND, SCALL, SSCALL, ERRNO, ...)            \
>
>
> I think maybe the better way is to define TST_EXP_FAIL_SILENT_
> but not add a new SILENT parameter. So that it keeps consistent with
> the existing TST_EXP_PASS_SILENT_ macros.

It looked like smaller change, but I can update it (Along with the
suggestion to create/delete more directories)



More information about the ltp mailing list