dynamically calculate TST_TOTAL rather than hardcoding it
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index 50d91cf..f034874 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -62,11 +62,6 @@
#include "ipcshm.h"
char *TCID = "shmctl01";
-#ifndef UCLINUX
-int TST_TOTAL = 4;
-#else
-int TST_TOTAL = 3;
-#endif
extern int Tst_count;
int shm_id_1 = -1;
@@ -122,6 +117,8 @@
{IPC_RMID, func_rmid, NULL}
};
+int TST_TOTAL = (sizeof(TC) / sizeof(*TC));
+
#define NEWMODE 0066
#ifdef UCLINUX
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
index 59ad25a..0de94af 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
@@ -55,7 +55,6 @@
#include <pwd.h>
char *TCID = "shmctl02";
-int TST_TOTAL = 7;
extern int Tst_count;
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
@@ -96,6 +95,8 @@
{&shm_id_2, SHM_UNLOCK, &buf, EPERM}
};
+int TST_TOTAL = (sizeof(TC) / sizeof(*TC));
+
int main(int ac, char **av)
{
int lc; /* loop counter */
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
index ce2fe4b..da84a12 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
@@ -62,7 +62,6 @@
#include <sys/wait.h>
char *TCID = "shmctl03";
-int TST_TOTAL = 3;
extern int Tst_count;
int exp_enos[] = {EACCES, EPERM, 0}; /* 0 terminated list of */
@@ -85,11 +84,13 @@
/* EPERM - IPC_SET - child doesn't have permission to change segment */
{&shm_id_1, IPC_SET, &buf, EPERM},
-
+
/* EPERM - IPC_RMID - child can not remove the segment */
{&shm_id_1, IPC_RMID, &buf, EPERM},
};
+int TST_TOTAL = (sizeof(TC) / sizeof(*TC));
+
int main(int ac, char **av)
{
char *msg; /* message returned from parse_opts */