[LTP] [PATCH 3/3] dio_sparse: Fix child exit code

Martin Doucha mdoucha@suse.cz
Wed Sep 14 11:44:32 CEST 2022


On 14. 09. 22 11:37, Cyril Hrubis wrote:
> Hi!
>> dio_sparse currently ignores all child failures because children never
>> exit with non-zero code. Fix child exit status.
>>
>> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
>> ---
>>   testcases/kernel/io/ltp-aiodio/common.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/testcases/kernel/io/ltp-aiodio/common.h b/testcases/kernel/io/ltp-aiodio/common.h
>> index 68465dc54..6265831af 100644
>> --- a/testcases/kernel/io/ltp-aiodio/common.h
>> +++ b/testcases/kernel/io/ltp-aiodio/common.h
>> @@ -78,9 +78,9 @@ static inline void io_read(const char *filename, int filesize, volatile int *run
>>   			if (r > 0) {
>>   				bufoff = check_zero(buff, r);
>>   				if (bufoff) {
>> -					tst_res(TINFO, "non-zero read at offset %zu",
>> +					tst_brk(TBROK,
>> +						"non-zero read at offset %zu",
>>   						offset + (bufoff - buff));
> 
> Ah, this is the fix. I would go for tst_res(TFAIL, ""); and return 1;
> otherwise this looks fine applied over the previous changes.

If I returned from io_read(), I'd have to rewrite the calls in 
dio_sparse.c and aiodio_sparse.c to exit(io_read()). Otherwise testrun() 
in LTP library would always force the exit code to 0. This is less work 
and you won't need to remember LTP library implementation details when 
you reuse io_read() in a new test.

Should I send a v2 for tst_validate_children() or will you delete the 
if(WCOREDUMP()) branch and merge it now?

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic



More information about the ltp mailing list