[LTP] [PATCH v3] syscalls/prctl05.c: New test for prctl() with PR_{SET, GET}_NAME

Xiao Yang ice_yangxiao@163.com
Fri May 24 15:58:28 CEST 2019


On 05/24/2019 09:48 PM, Cyril Hrubis wrote:
> Hi!
>>> +	if (strcmp(tc->expname, buf))
>>> +		tst_res(TFAIL,
>>> +			"prctl(PR_GET_NAME) failed ,expected %s, got %s", tc->expname, buf);
>>> +	else
>>> +		tst_res(TPASS,
>>> +			"prctl(PR_GET_NAME) succeeded, thread name is %s", buf);
>> Hi Xu,
>>
>> It is not necessary to continue if buf mismatches tc->expname.
>>
>>> +
>>> +	tid = tst_syscall(__NR_gettid);
>>> +
>>> +	sprintf(PROC_NAME_PATH, "/proc/self/task/%d/comm", tid);
>>> +	SAFE_FILE_SCANF(PROC_NAME_PATH, "%s", comm_buf);
>> You didn't create multiple threads here so it seems simpler to use
>> /proc/self/comm
>> instead of /proc/self/task/<tid>/comm. do you think so?
>> Please see the following url for details:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt
> Actually we should check both.
Hi Cyril,

Thanks for your quick reply.

It's better to check both.
>> BTW:
>> Should we print three TPASS messages for one test?
>> Can we replace previous TPASS with TINFO and then print TPASS at the end?
> I think that it's cleaner to print PASS/FAIL message for each subtest.
OK, we can keep it as you said.

Best Regards,
Xiao Yang




More information about the ltp mailing list