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

Cyril Hrubis chrubis@suse.cz
Fri May 24 15:48:49 CEST 2019


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.

> 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.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list