[LTP] [PATCH v3] Rewrite process_vm_readv02.c test with new LTP API

Cyril Hrubis chrubis@suse.cz
Wed Jan 26 15:40:25 CET 2022


Hi!
Pushed with three minor fixes, thanks.

* Fixed the munmap() size
* Fixed the documentation comment header
* Made use of tst_strstatus()

Full diff:

diff --git a/testcases/kernel/syscalls/cma/process_vm_readv02.c b/testcases/kernel/syscalls/cma/process_vm_readv02.c
index ed905a735..2bd66a49f 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv02.c
@@ -5,7 +5,7 @@
  * Copyright (C) 2021 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
  */

-/* \
+/*\
  * [Description]
  *
  * Fork two children, one child allocates memory and initializes it;
@@ -73,7 +73,7 @@ static void setup(void)
 static void cleanup(void)
 {
        if (data_ptr)
-               SAFE_MUNMAP(data_ptr, BUFSIZ);
+               SAFE_MUNMAP(data_ptr, sizeof(uintptr_t));
 }

 static void run(void)
@@ -104,14 +104,14 @@ static void run(void)
        /* wait until child_invoke reads from child_alloc's VM */
        SAFE_WAITPID(pid_invoke, &status, 0);
        if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
-               tst_res(TFAIL, "child 1: returns %d", status);
+               tst_res(TFAIL, "child 1: %s", tst_strstatus(status));

        /* child_alloc is free to exit now */
        TST_CHECKPOINT_WAKE(0);

        SAFE_WAITPID(pid_alloc, &status, 0);
        if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
-               tst_res(TFAIL, "child 0: returns %d", status);
+               tst_res(TFAIL, "child 0: %s", tst_strstatus(status));
 }


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list