Skip to content

Commit

Permalink
Fix TST_EXP_EXTR() stringification
Browse files Browse the repository at this point in the history
Follow the TST_* macros standards when it comes to stringification of
the expressions.

Link: https://lore.kernel.org/ltp/[email protected]/
Fixes: a2ba98e ("API: Add TST_EXP_EXPR macro")
Suggested-by: Cyril Hrubis <[email protected]>
Reviewed-by: Li Wang <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Signed-off-by: Cyril Hrubis <[email protected]>
Signed-off-by: Andrea Cervesato <[email protected]>
  • Loading branch information
acerv authored and pevik committed Jul 9, 2024
1 parent 74d3935 commit b2439e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions include/tst_test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
6 changes: 3 additions & 3 deletions testcases/kernel/syscalls/fork/fork04.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}

Expand Down

0 comments on commit b2439e5

Please sign in to comment.