Re: [LTP] [PATCH v1 1/3] Rewrite eventfd2_01 test using new LTP API

Andrea Cervesato via ltp
2023-03-15T09:10:32Z

Hi,

On 3/15/23 00:40, Wei Gao wrote:
> On Wed, Mar 08, 2023 at 02:23:33PM +0100, Andrea Cervesato wrote:
>> From: Andrea Cervesato <andrea.cervesato@suse.com>
>>
>> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
>> ---
>> testcases/kernel/syscalls/eventfd2/eventfd2.h | 18 +++
>> .../kernel/syscalls/eventfd2/eventfd2_01.c | 148 ++++--------------
>> 2 files changed, 51 insertions(+), 115 deletions(-)
>> create mode 100644 testcases/kernel/syscalls/eventfd2/eventfd2.h
>>
>> diff --git a/testcases/kernel/syscalls/eventfd2/eventfd2.h b/testcases/kernel/syscalls/eventfd2/eventfd2.h
>> new file mode 100644
>> index 000000000..5350820b8
>> --- /dev/null
>> +++ b/testcases/kernel/syscalls/eventfd2/eventfd2.h
>> @@ -0,0 +1,18 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright (C) 2023 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
>> + */
>> +
>> +#include "tst_test.h"
>> +#include "lapi/syscalls.h"
>> +
>> +static inline int eventfd2(unsigned int count, unsigned int flags)
>> +{
>> + int ret;
>> +
>> + ret = tst_syscall(__NR_eventfd2, count, flags);
>> + if (ret == -1)
>> + tst_brk(TBROK | TERRNO, "eventfd2");
>> +
>> + return ret;
>> +}
> Normally we need put file or store this file into some lib directory?

Common pattern is usually to add a header file (if needed) with the name
of the testing suite in the folder name of that suite.

Andrea