From: Jan S. <jst...@re...> - 2013-05-21 10:22:28
|
----- Original Message ----- > From: "DAN LI" <li...@cn...> > To: "LTP list" <ltp...@li...> > Sent: Tuesday, 21 May, 2013 10:51:53 AM > Subject: [LTP] [PATCH] semctl01.c: Pass the correct parameter > > > For SEM_STAT, the semid argument is not a semaphore identifier, but instead > an > index into the kernel’s internal array that maintains information about all > semaphore sets on the system. > > Pass a correct index of the kernel' internal array intead of a semaphores id > when > testing feature SEM_STAT. > > Signed-off-by: DAN LI <li...@cn...> > --- Hi, that backup/restore of global variable in setup/cleanup funcs between testcases looks a bit odd to me. How about adding new field to test_case_t? +static int sem_index = 0; static struct test_case_t { + int *semid; ... - TEST(semctl(sem_id_1, TC[i].semnum, TC[i].cmd, + TEST(semctl(*(TC[i].semid), TC[i].semnum, TC[i].cmd, These you could initialise in TC[] definition to either &sem_id_1 or &sem_index and avoid all that backup/restore of sem_id_1. What do you think? Regards, Jan |