[LTP] [PATCH v2] set_tid_address01: refactor with new LTP API

Petr Vorel pvorel@suse.cz
Thu Jan 9 12:30:09 CET 2025


> Hi Ma Xinjian, Avinesh,

> ...
> > +	TEST(tst_syscall(__NR_set_tid_address, &newtid));
> > +	if (TST_RET == getpid())
> > +		tst_res(TPASS, "set_tid_address call succeeded: as expected %ld", TST_RET);
> > +	else
> > +		tst_res(TFAIL | TTERRNO, "set_tid_address call failed: expected %d, but got %ld", getpid(), TST_RET);

> I wanted to replace this with:

> TST_EXP_EQ_LI(tst_syscall(__NR_set_tid_address, &newtid), getpid());

> But that TST_EXP_EQ_LI() not use TTERRNO.

> Maybe use this?

> 	TST_EXP_PID(tst_syscall(__NR_set_tid_address, &newtid));
> 	TST_EXP_EQ_LI(TST_RET, getpid());

OK, this is the correct one liner:
TST_EXP_VAL(tst_syscall(__NR_set_tid_address, &newtid), getpid());

Any objection to merge with change below?

Kind regards,
Petr

> Kind regards,
> Petr

+++ testcases/kernel/syscalls/set_tid_address/set_tid_address01.c
@@ -16,11 +16,7 @@ static void verify_set_tid_address(void)
 {
 	int newtid = -1;
 
-	TEST(tst_syscall(__NR_set_tid_address, &newtid));
-	if (TST_RET == getpid())
-		tst_res(TPASS, "set_tid_address call succeeded: as expected %ld", TST_RET);
-	else
-		tst_res(TFAIL | TTERRNO, "set_tid_address call failed: expected %d, but got %ld", getpid(), TST_RET);
+	TST_EXP_VAL(tst_syscall(__NR_set_tid_address, &newtid), getpid());
 }
 
 static struct tst_test test = {


More information about the ltp mailing list