diff mbox series

[v2,2/5] Fix TST_EXP_EXTR() stringification

Message ID 20240709-stat04-v2-2-2693a473a2ab@suse.com
State Accepted
Headers show
Series symlink01 split | expand

Commit Message

Andrea Cervesato July 9, 2024, 10:45 a.m. UTC
From: Andrea Cervesato <andrea.cervesato@suse.com>

Follow the TST_* macros standards when it comes to stringification of
the expressions.

Reviewed-by: Li Wang <liwang@redhat.com>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 include/tst_test_macros.h               | 5 +++--
 testcases/kernel/syscalls/fork/fork04.c | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Petr Vorel July 9, 2024, 12:48 p.m. UTC | #1
Hi all,

merged this commit (obvious fix).
Thanks!

Kind regards,
Petr
Li Wang July 9, 2024, 12:52 p.m. UTC | #2
Petr Vorel <pvorel@suse.cz> wrote:

merged this commit (obvious fix).
> Thanks!
>

Thank you Petr.

I think it's safe to merge 1/5 to 4/5, but yes we can wait for more
comments if you like.
(Only 5/5 has a tiny issue I pointed out there)
diff mbox series

Patch

diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 22b39fb14..7a443c803 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -340,8 +340,9 @@  const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt);
 			&tst_exp_err__, 1, ##__VA_ARGS__);                     \
 	} while (0)
 
-#define TST_EXP_EXPR(EXPR, FMT, ...)						\
-	tst_res_(__FILE__, __LINE__, (EXPR) ? TPASS : TFAIL, "Expect: " FMT, ##__VA_ARGS__);
+#define TST_EXP_EXPR(EXPR, ...)                                              \
+       tst_res_(__FILE__, __LINE__, (EXPR) ? TPASS : TFAIL, "Expect: "       \
+                TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, #EXPR), __VA_ARGS__));
 
 #define TST_EXP_EQ_(VAL_A, SVAL_A, VAL_B, SVAL_B, TYPE, PFS) do {\
 	TYPE tst_tmp_a__ = VAL_A; \
diff --git a/testcases/kernel/syscalls/fork/fork04.c b/testcases/kernel/syscalls/fork/fork04.c
index b0c6bebe0..413cd5eb4 100644
--- a/testcases/kernel/syscalls/fork/fork04.c
+++ b/testcases/kernel/syscalls/fork/fork04.c
@@ -29,7 +29,7 @@  static void run_child(void)
 
 	TST_EXP_EXPR(strcmp(ENV_VAL0, val) == 0,
 		"%s environ variable has been inherited by the child",
-		ENV_KEY)
+		ENV_KEY);
 
 	tst_res(TINFO, "Unset %s environ variable inside child", ENV_KEY);
 
@@ -72,7 +72,7 @@  static void run(void)
 	} else {
 		TST_EXP_EXPR(strcmp(ENV_VAL0, val) == 0,
 			"%s environ variable is still present inside parent",
-			ENV_KEY)
+			ENV_KEY);
 	}
 
 	TST_CHECKPOINT_WAKE_AND_WAIT(0);
@@ -85,7 +85,7 @@  static void run(void)
 	else {
 		TST_EXP_EXPR(strcmp(ENV_VAL0, val) == 0,
 			"%s environ variable didn't change inside parent",
-			ENV_KEY)
+			ENV_KEY);
 	}
 }