syscalls/prctl: Use TST_ASSERT_STR/INT
PATCH 1/1 syscalls/prctl: Use TST_ASSERT_STR/INT
Signed-off-by Yang Xu <[email protected]>
--- testcases/kernel/syscalls/prctl/prctl05.c | 17 ++--------------- testcases/kernel/syscalls/prctl/prctl08.c | 16 +--------------- 2 files changed, 3 insertions(+), 30 deletions(-)
testcases/kernel/syscalls/prctl/prctl05.c +2 -15
@@ -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 = {
testcases/kernel/syscalls/prctl/prctl08.c +1 -15
@@ -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)
Signature · 1 line
2.23.0
PATCH 1/1 syscalls/prctl: Use TST_ASSERT_STR/INT
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]