From: Simon Marchi Date: Fri, 20 Aug 2021 19:36:50 +0000 (-0400) Subject: tests: tap: remove semicolons in pass / fail definitions X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=4f002736e957daab4ae95c01613950aa415ab005 tests: tap: remove semicolons in pass / fail definitions I wanted to write something like this in a test: if (cond) fail("message 1"); else fail("message 2"); And was met with CC test_action.o /home/simark/src/lttng-tools/tests/unit/test_action.c: In function ‘main’: /home/simark/src/lttng-tools/tests/unit/test_action.c:544:9: error: ‘else’ without a previous ‘if’ 544 | else | ^~~~ I then remembered that it was in our coding style to use braces: if (cond) { fail("message 1"); } else { fail("message 2"); } ... which avoids the error. But still, the former form should work. Fix this by removing the semi-colons in the pass and fail definitions, I don't think they belong there. Doing so finds a spot in ini_config.c where a semi-colon is missing, add it. Change-Id: I6ff09d496a0b12f34baa6f993cffc69eef611df0 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- diff --git a/tests/unit/ini_config/ini_config.c b/tests/unit/ini_config/ini_config.c index a16d1b9e8..6775ddd3f 100644 --- a/tests/unit/ini_config/ini_config.c +++ b/tests/unit/ini_config/ini_config.c @@ -78,7 +78,7 @@ int main(int argc, char **argv) } path = utils_expand_path(argv[1]); if (!path) { - fail("Failed to resolve sample INI file path") + fail("Failed to resolve sample INI file path"); } plan_no_plan(); diff --git a/tests/utils/tap/tap.h b/tests/utils/tap/tap.h index ab9aad1aa..c15909d89 100644 --- a/tests/utils/tap/tap.h +++ b/tests/utils/tap/tap.h @@ -40,8 +40,8 @@ _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) -# define pass(test, ...) ok(1, test, ## __VA_ARGS__); -# define fail(test, ...) ok(0, test, ## __VA_ARGS__); +# define pass(test, ...) ok(1, test, ## __VA_ARGS__) +# define fail(test, ...) ok(0, test, ## __VA_ARGS__) # define skip_start(test, n, fmt, ...) \ do { \ @@ -60,8 +60,8 @@ _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) -# define pass(...) ok(1, __VA_ARGS__); -# define fail(...) ok(0, __VA_ARGS__); +# define pass(...) ok(1, __VA_ARGS__) +# define fail(...) ok(0, __VA_ARGS__) # define skip_start(test, n, ...) \ do { \