From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Hrubis Date: Fri, 24 May 2019 15:48:49 +0200 Subject: [LTP] [PATCH v3] syscalls/prctl05.c: New test for prctl() with PR_{SET, GET}_NAME In-Reply-To: References: <70578dc6-1a6b-9ab1-1298-0539ae8562f9@163.com> <1558684246-2658-1-git-send-email-xuyang2018.jy@cn.fujitsu.com> Message-ID: <20190524134849.GB2251@rei> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it 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//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