[LTP] [PATCH] swapon02: Simplify code, add copyright, modify docparse

Yang Xu (Fujitsu) xuyang2018.jy@fujitsu.com
Wed Nov 29 06:26:00 CET 2023


Hi, Xiao Yang

>On 2023/10/19 14:47, Yang Xu wrote:
>> Simplify permission-related test code, making structures look simpler
>>
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>>   testcases/kernel/syscalls/swapon/swapon02.c | 57 +++++++--------------
>>   1 file changed, 18 insertions(+), 39 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c
>> index d34c17a80..2c9e39986 100644
>> --- a/testcases/kernel/syscalls/swapon/swapon02.c
>> +++ b/testcases/kernel/syscalls/swapon/swapon02.c
>> @@ -1,17 +1,17 @@
>>   // SPDX-License-Identifier: GPL-2.0-or-later
>> -
>>   /*
>>    * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
>> + * Copyright (c) Linux Test Project, 2003-2023
>>    */
>>
>>   /*\
>>    * [Description]
>>    *
>>    * This test case checks whether swapon(2) system call returns
>> - *  1. ENOENT when the path does not exist
>> - *  2. EINVAL when the path exists but is invalid
>> - *  3. EPERM when user is not a superuser
>> - *  4. EBUSY when the specified path is already being used as a swap area
>> + * - ENOENT when the path does not exist.
>> + * - EINVAL when the path exists but is invalid.
>> + * - EPERM when user is not a superuser.
>> + * - EBUSY when the specified path is already being used as a swap area.
>>    */
>>
>>   #include <errno.h>
>> @@ -21,36 +21,20 @@
>>   #include "lapi/syscalls.h"
>>   #include "libswap.h"
>>
>> -static void setup01(void);
>> -static void cleanup01(void);
>> -
...
>> -
>>   static void setup(void)
>>   {
>>        struct passwd *nobody;
>> @@ -79,24 +63,19 @@ void cleanup(void)

>Hi Yang

>It looks good to me. one minor hint:
>static void cleanup() should be better.
>Reviewed-by: Xiao Yang <yangx.jy@fujitsu.com>

>Best Regards,
>Xiao Yang

OK. I'll modify it.

Best Regards,
Yang Xu


More information about the ltp mailing list