* [LTP] [PATCH] syscalls/prctl: Use TST_ASSERT_STR/INT
@ 2020-04-20 9:51 Yang Xu
2020-04-28 14:32 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Yang Xu @ 2020-04-20 9:51 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
testcases/kernel/syscalls/prctl/prctl05.c | 17 ++---------------
testcases/kernel/syscalls/prctl/prctl08.c | 16 +---------------
2 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/testcases/kernel/syscalls/prctl/prctl05.c b/testcases/kernel/syscalls/prctl/prctl05.c
index 1f979007f..ae390fdfc 100644
--- a/testcases/kernel/syscalls/prctl/prctl05.c
+++ b/testcases/kernel/syscalls/prctl/prctl05.c
@@ -28,18 +28,6 @@ static struct tcase {
{"prctl05_test_xxxxx", "prctl05_test_xx"}
};
-static void check_proc_comm(char *path, char *name)
-{
- char comm_buf[20];
-
- SAFE_FILE_SCANF(path, "%s", comm_buf);
- if (strcmp(name, comm_buf))
- tst_res(TFAIL,
- "%s has %s, expected %s", path, comm_buf, name);
- else
- tst_res(TPASS, "%s sets to %s", path, comm_buf);
-}
-
static void verify_prctl(unsigned int n)
{
char buf[20];
@@ -71,9 +59,8 @@ static void verify_prctl(unsigned int n)
tid = tst_syscall(__NR_gettid);
sprintf(comm_path, "/proc/self/task/%d/comm", tid);
- check_proc_comm(comm_path, tc->expname);
-
- check_proc_comm("/proc/self/comm", tc->expname);
+ TST_ASSERT_STR(comm_path, tc->expname);
+ TST_ASSERT_STR("/proc/self/comm", tc->expname);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/prctl/prctl08.c b/testcases/kernel/syscalls/prctl/prctl08.c
index fd8ccb6ad..9a1b34c17 100644
--- a/testcases/kernel/syscalls/prctl/prctl08.c
+++ b/testcases/kernel/syscalls/prctl/prctl08.c
@@ -53,19 +53,6 @@ static void check_reset_timerslack(char *message)
check_get_timerslack(message, origin_value);
}
-static void check_proc_timerslack(char *message, unsigned long value)
-{
- unsigned long proc_value;
-
- SAFE_FILE_SCANF(PROC_TIMERSLACK_PATH, "%lu", &proc_value);
- if (proc_value == value)
- tst_res(TPASS, "%s %s got %lu expectedly",
- message, PROC_TIMERSLACK_PATH, proc_value);
- else
- tst_res(TFAIL, "%s %s expected %lu got %lu",
- message, PROC_TIMERSLACK_PATH, value, proc_value);
-}
-
static void check_get_timerslack(char *message, unsigned long value)
{
TEST(prctl(PR_GET_TIMERSLACK));
@@ -77,8 +64,7 @@ static void check_get_timerslack(char *message, unsigned long value)
message, value, TST_RET);
if (proc_flag)
- check_proc_timerslack(message, value);
-
+ TST_ASSERT_INT(PROC_TIMERSLACK_PATH, value);
}
static void check_inherit_timerslack(char *message, unsigned long value)
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCH] syscalls/prctl: Use TST_ASSERT_STR/INT
2020-04-20 9:51 [LTP] [PATCH] syscalls/prctl: Use TST_ASSERT_STR/INT Yang Xu
@ 2020-04-28 14:32 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2020-04-28 14:32 UTC (permalink / raw)
To: ltp
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-28 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 9:51 [LTP] [PATCH] syscalls/prctl: Use TST_ASSERT_STR/INT Yang Xu
2020-04-28 14:32 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.