lib: keep the test id hidden in LTP library
To avoid introducing wrong tid's typos radically, this patch keep the tid
hidden in library by moving out '.tid' variable from the test struct.
Meanwhile, adding a newly string '.scall' to support LTP can get the correct
syscall name for timer management library.
Signed-off-by: Li Wang <liwang@redhat.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 3b774f1..54e42b7 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -41,6 +41,7 @@
struct tst_test *tst_test;
+static const char *tid;
static int iterations = 1;
static float duration = -1;
static pid_t main_pid, lib_pid;
@@ -77,7 +78,7 @@
if (access("/dev/shm", F_OK) == 0) {
snprintf(shm_path, sizeof(shm_path), "/dev/shm/ltp_%s_%d",
- tst_test->tid, getpid());
+ tid, getpid());
} else {
char *tmpdir;
@@ -86,7 +87,7 @@
tmpdir = tst_get_tmpdir();
snprintf(shm_path, sizeof(shm_path), "%s/ltp_%s_%d",
- tmpdir, tst_test->tid, getpid());
+ tmpdir, tid, getpid());
free(tmpdir);
}
@@ -688,12 +689,11 @@
assert_test_fn();
+ tid = get_tid(argv);
+
if (tst_test->sample)
tst_test = tst_timer_test_setup(tst_test);
- if (!tst_test->tid)
- tst_test->tid = get_tid(argv);
-
parse_opts(argc, argv);
if (tst_test->needs_root && geteuid() != 0)
@@ -972,7 +972,7 @@
do_setup(argc, argv);
- TCID = tst_test->tid;
+ TCID = tid;
SAFE_SIGNAL(SIGALRM, alarm_handler);
SAFE_SIGNAL(SIGUSR1, heartbeat_handler);