[LTP] [PATCH 2/5] Fix TST_EXP_EXTR() stringification

Andrea Cervesato
2024-07-02T14:13:49Z

From: Andrea Cervesato <andrea.cervesato@suse.com>

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

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(-)

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);
}
}

--
2.43.0