Re: [PATCH for 4.14 2/3] membarrier: selftest: Test private expedited cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/26/2017 02:15 PM, Mathieu Desnoyers wrote:
> 
> 
> ----- On Sep 26, 2017, at 4:08 PM, Shuah Khan shuahkhan@xxxxxxxxx wrote:
> 
>> On Tue, Sep 26, 2017 at 1:55 PM, Mathieu Desnoyers
>> <mathieu.desnoyers@xxxxxxxxxxxx> wrote:
>>> ----- On Sep 26, 2017, at 3:41 PM, Shuah Khan shuahkhan@xxxxxxxxx wrote:
>>>
>>>> Hi Mathew,
>>>>
>>>> On Tue, Sep 26, 2017 at 11:51 AM, Mathieu Desnoyers
>>>> <mathieu.desnoyers@xxxxxxxxxxxx> wrote:
>>>>> Test the new MEMBARRIER_CMD_PRIVATE_EXPEDITED and
>>>>> MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED commands.
>>>>>
>>>>> Add checks expecting specific error values on system calls expected to
>>>>> fail.
>>>>>
>>>>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
>>>>> CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>>>>> CC: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
>>>>> CC: Boqun Feng <boqun.feng@xxxxxxxxx>
>>>>> CC: Andrew Hunter <ahh@xxxxxxxxxx>
>>>>> CC: Maged Michael <maged.michael@xxxxxxxxx>
>>>>> CC: gromer@xxxxxxxxxx
>>>>> CC: Avi Kivity <avi@xxxxxxxxxxxx>
>>>>> CC: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
>>>>> CC: Paul Mackerras <paulus@xxxxxxxxx>
>>>>> CC: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
>>>>> CC: Dave Watson <davejwatson@xxxxxx>
>>>>> CC: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
>>>>> CC: Will Deacon <will.deacon@xxxxxxx>
>>>>> CC: Andy Lutomirski <luto@xxxxxxxxxx>
>>>>> CC: linux-arch@xxxxxxxxxxxxxxx
>>>>> ---
>>>>>  .../testing/selftests/membarrier/membarrier_test.c | 109
>>>>
>>>> Did you run get_maintainers script on this patch? I am curious why
>>>> get_maintainers didn't include linux-kselftest@xxxxxxxxxxxxxxx and
>>>> shuah@xxxxxxxxxx
>>>
>>> My mistake. I'll add this script to my checklist before I send out
>>> patches.
>>>
>>> If OK with you, I can just add the ML in CC here.
>>>
>>
>> Please add everybody get_maintainers suggest for this patch as well.
>> If this patch is going through linux-kselftest, you will have to resend the
>> patch to me at some point, so I can pull it in.
>>
>> I am guessing this has dependency on the other patches in the series
>> and will go through the primary tree. In that case CC is just fine and I will
>> review it and Ack it.
> 
> Indeed, it has a dependency on another patch part of this
> series, which is aimed to go through Paul E. McKenney's tree.
> 
> Adding Greg, Alice, and Paul Elder in CC as suggested by get_maintainers.
> 
> Do you need me to re-send the series, or is this thread ok ?
> 

Okay with me. Looks good to me.

Acked-by: Shuah Khan <shuahkh@xxxxxxxxxxxxxxx>

thanks,
-- Shuah

> 
>>
>> thanks,
>> -- Shuah
>>>>
>>>> Please make sure you send the patches to
>>>> ++++++++++++++++++---
>>>>>  1 file changed, 94 insertions(+), 15 deletions(-)
>>>>>
>>>>> diff --git a/tools/testing/selftests/membarrier/membarrier_test.c
>>>>> b/tools/testing/selftests/membarrier/membarrier_test.c
>>>>> index 21399fcf1a59..f85657374b59 100644
>>>>> --- a/tools/testing/selftests/membarrier/membarrier_test.c
>>>>> +++ b/tools/testing/selftests/membarrier/membarrier_test.c
>>>>> @@ -15,49 +15,119 @@ static int sys_membarrier(int cmd, int flags)
>>>>>  static int test_membarrier_cmd_fail(void)
>>>>>  {
>>>>>         int cmd = -1, flags = 0;
>>>>> +       const char *test_name = "sys membarrier invalid command";
>>>>>
>>>>>         if (sys_membarrier(cmd, flags) != -1) {
>>>>>                 ksft_exit_fail_msg(
>>>>> -                       "sys membarrier invalid command test: command = %d,
>>>>> flags = %d. Should fail, but passed\n",
>>>>> -                       cmd, flags);
>>>>> +                       "%s test: command = %d, flags = %d. Should fail, but
>>>>> passed\n",
>>>>> +                       test_name, cmd, flags);
>>>>> +       }
>>>>> +       if (errno != EINVAL) {
>>>>> +               ksft_exit_fail_msg(
>>>>> +                       "%s test: flags = %d. Should return (%d: \"%s\"), but
>>>>> returned (%d: \"%s\").\n",
>>>>> +                       test_name, flags, EINVAL, strerror(EINVAL),
>>>>> +                       errno, strerror(errno));
>>>>>         }
>>>>>
>>>>>         ksft_test_result_pass(
>>>>> -               "sys membarrier invalid command test: command = %d, flags = %d.
>>>>> Failed as expected\n",
>>>>> -               cmd, flags);
>>>>> +               "%s test: command = %d, flags = %d, errno = %d. Failed as
>>>>> expected\n",
>>>>> +               test_name, cmd, flags, errno);
>>>>>         return 0;
>>>>>  }
>>>>>
>>>>>  static int test_membarrier_flags_fail(void)
>>>>>  {
>>>>>         int cmd = MEMBARRIER_CMD_QUERY, flags = 1;
>>>>> +       const char *test_name = "sys membarrier MEMBARRIER_CMD_QUERY invalid
>>>>> flags";
>>>>>
>>>>>         if (sys_membarrier(cmd, flags) != -1) {
>>>>>                 ksft_exit_fail_msg(
>>>>> -                       "sys membarrier MEMBARRIER_CMD_QUERY invalid flags test:
>>>>> flags = %d. Should fail, but passed\n",
>>>>> -                       flags);
>>>>> +                       "%s test: flags = %d. Should fail, but passed\n",
>>>>> +                       test_name, flags);
>>>>> +       }
>>>>> +       if (errno != EINVAL) {
>>>>> +               ksft_exit_fail_msg(
>>>>> +                       "%s test: flags = %d. Should return (%d: \"%s\"), but
>>>>> returned (%d: \"%s\").\n",
>>>>> +                       test_name, flags, EINVAL, strerror(EINVAL),
>>>>> +                       errno, strerror(errno));
>>>>>         }
>>>>>
>>>>>         ksft_test_result_pass(
>>>>> -               "sys membarrier MEMBARRIER_CMD_QUERY invalid flags test: flags =
>>>>> %d. Failed as expected\n",
>>>>> -               flags);
>>>>> +               "%s test: flags = %d, errno = %d. Failed as expected\n",
>>>>> +               test_name, flags, errno);
>>>>>         return 0;
>>>>>  }
>>>>>
>>>>> -static int test_membarrier_success(void)
>>>>> +static int test_membarrier_shared_success(void)
>>>>>  {
>>>>>         int cmd = MEMBARRIER_CMD_SHARED, flags = 0;
>>>>> -       const char *test_name = "sys membarrier MEMBARRIER_CMD_SHARED\n";
>>>>> +       const char *test_name = "sys membarrier MEMBARRIER_CMD_SHARED";
>>>>> +
>>>>> +       if (sys_membarrier(cmd, flags) != 0) {
>>>>> +               ksft_exit_fail_msg(
>>>>> +                       "%s test: flags = %d, errno = %d\n",
>>>>> +                       test_name, flags, errno);
>>>>> +       }
>>>>> +
>>>>> +       ksft_test_result_pass(
>>>>> +               "%s test: flags = %d\n", test_name, flags);
>>>>> +       return 0;
>>>>> +}
>>>>> +
>>>>> +static int test_membarrier_private_expedited_fail(void)
>>>>> +{
>>>>> +       int cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED, flags = 0;
>>>>> +       const char *test_name = "sys membarrier MEMBARRIER_CMD_PRIVATE_EXPEDITED
>>>>> not registered failure";
>>>>> +
>>>>> +       if (sys_membarrier(cmd, flags) != -1) {
>>>>> +               ksft_exit_fail_msg(
>>>>> +                       "%s test: flags = %d. Should fail, but passed\n",
>>>>> +                       test_name, flags);
>>>>> +       }
>>>>> +       if (errno != EPERM) {
>>>>> +               ksft_exit_fail_msg(
>>>>> +                       "%s test: flags = %d. Should return (%d: \"%s\"), but
>>>>> returned (%d: \"%s\").\n",
>>>>> +                       test_name, flags, EPERM, strerror(EPERM),
>>>>> +                       errno, strerror(errno));
>>>>> +       }
>>>>> +
>>>>> +       ksft_test_result_pass(
>>>>> +               "%s test: flags = %d, errno = %d\n",
>>>>> +               test_name, flags, errno);
>>>>> +       return 0;
>>>>> +}
>>>>> +
>>>>> +static int test_membarrier_register_private_expedited_success(void)
>>>>> +{
>>>>> +       int cmd = MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, flags = 0;
>>>>> +       const char *test_name = "sys membarrier
>>>>> MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED";
>>>>>
>>>>>         if (sys_membarrier(cmd, flags) != 0) {
>>>>>                 ksft_exit_fail_msg(
>>>>> -                       "sys membarrier MEMBARRIER_CMD_SHARED test: flags =
>>>>> %d\n",
>>>>> -                       flags);
>>>>> +                       "%s test: flags = %d, errno = %d\n",
>>>>> +                       test_name, flags, errno);
>>>>>         }
>>>>>
>>>>>         ksft_test_result_pass(
>>>>> -               "sys membarrier MEMBARRIER_CMD_SHARED test: flags = %d\n",
>>>>> -               flags);
>>>>> +               "%s test: flags = %d\n",
>>>>> +               test_name, flags);
>>>>> +       return 0;
>>>>> +}
>>>>> +
>>>>> +static int test_membarrier_private_expedited_success(void)
>>>>> +{
>>>>> +       int cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED, flags = 0;
>>>>> +       const char *test_name = "sys membarrier
>>>>> MEMBARRIER_CMD_PRIVATE_EXPEDITED";
>>>>> +
>>>>> +       if (sys_membarrier(cmd, flags) != 0) {
>>>>> +               ksft_exit_fail_msg(
>>>>> +                       "%s test: flags = %d, errno = %d\n",
>>>>> +                       test_name, flags, errno);
>>>>> +       }
>>>>> +
>>>>> +       ksft_test_result_pass(
>>>>> +               "%s test: flags = %d\n",
>>>>> +               test_name, flags);
>>>>>         return 0;
>>>>>  }
>>>>>
>>>>> @@ -71,7 +141,16 @@ static int test_membarrier(void)
>>>>>         status = test_membarrier_flags_fail();
>>>>>         if (status)
>>>>>                 return status;
>>>>> -       status = test_membarrier_success();
>>>>> +       status = test_membarrier_shared_success();
>>>>> +       if (status)
>>>>> +               return status;
>>>>> +       status = test_membarrier_private_expedited_fail();
>>>>> +       if (status)
>>>>> +               return status;
>>>>> +       status = test_membarrier_register_private_expedited_success();
>>>>> +       if (status)
>>>>> +               return status;
>>>>> +       status = test_membarrier_private_expedited_success();
>>>>>         if (status)
>>>>>                 return status;
>>>>>         return 0;
>>>>> --
>>>>> 2.11.0
>>>
>>> --
>>> Mathieu Desnoyers
>>> EfficiOS Inc.
>>> http://www.efficios.com
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux