diff mbox series

lib: Move setup_ipc() to the beginning of do_setup()

Message ID 20221010081628.37168-1-zhaogongyi@huawei.com
State Changes Requested
Headers show
Series lib: Move setup_ipc() to the beginning of do_setup() | expand

Commit Message

Zhao Gongyi Oct. 10, 2022, 8:16 a.m. UTC
Move setup_ipc() to the beginning of do_setup() since we
would use the 'results' immediately in do_setup(), otherwise,there
is no Results statistics when calling the tst_brk in do_setup().

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 lib/tst_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.17.1

Comments

Richard Palethorpe Oct. 20, 2022, 8:58 a.m. UTC | #1
Hello,

Zhao Gongyi via ltp <ltp@lists.linux.it> writes:

> Move setup_ipc() to the beginning of do_setup() since we
> would use the 'results' immediately in do_setup(), otherwise,there
> is no Results statistics when calling the tst_brk in do_setup().
>
> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
>  lib/tst_test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 8ccde1629..02fc6a06e 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1096,6 +1096,8 @@ static void do_cgroup_requires(void)
>
>  static void do_setup(int argc, char *argv[])
>  {
> +	setup_ipc();
> +

We can't move it to before checking if tst_test is null.

Is there anything else that needs to be done before calling that?
diff mbox series

Patch

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 8ccde1629..02fc6a06e 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1096,6 +1096,8 @@  static void do_cgroup_requires(void)

 static void do_setup(int argc, char *argv[])
 {
+	setup_ipc();
+
 	if (!tst_test)
 		tst_brk(TBROK, "No tests to run");

@@ -1169,8 +1171,6 @@  static void do_setup(int argc, char *argv[])
 	if (tst_test->hugepages.number)
 		tst_reserve_hugepages(&tst_test->hugepages);

-	setup_ipc();
-
 	if (tst_test->bufs)
 		tst_buffers_alloc(tst_test->bufs);