[libvirt PATCH 0/2] tests: bhyve: minor style tweaks for constants

I found these lying around in a forgotten branch. Ján Tomko (2): tests: bhyve: remove magic constants tests: bhyve: use bitwise shift when defining flags tests/bhyveargv2xmltest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.31.1

Refer to flags by their identifier, not value. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- tests/bhyveargv2xmltest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index 2c1ffc75f3..e86c9e3b10 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -131,16 +131,16 @@ mymain(void) DO_TEST_FULL(name, 0) # define DO_TEST_FAIL(name) \ - DO_TEST_FULL(name, 5) + DO_TEST_FULL(name, FLAG_EXPECT_FAILURE | FLAG_EXPECT_WARNING) # define DO_TEST_WARN(name) \ - DO_TEST_FULL(name, 4) + DO_TEST_FULL(name, FLAG_EXPECT_WARNING) # define DO_TEST_FAIL_SILENT(name) \ - DO_TEST_FULL(name, 1) + DO_TEST_FULL(name, FLAG_EXPECT_FAILURE) # define DO_TEST_PARSE_ERROR(name) \ - DO_TEST_FULL(name, 2) + DO_TEST_FULL(name, FLAG_EXPECT_PARSE_ERROR) driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV; driver.bhyvecaps = BHYVE_CAP_RTC_UTC; -- 2.31.1

Although I'm sure we all know the powers of two by heart now, this is the prevalent style for flag defition. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- tests/bhyveargv2xmltest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index e86c9e3b10..2ccc1379b9 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -17,9 +17,9 @@ static bhyveConn driver; typedef enum { - FLAG_EXPECT_FAILURE = 1, - FLAG_EXPECT_PARSE_ERROR = 2, - FLAG_EXPECT_WARNING = 4, + FLAG_EXPECT_FAILURE = 1 << 0, + FLAG_EXPECT_PARSE_ERROR = 1 << 1, + FLAG_EXPECT_WARNING = 1 << 2, } virBhyveArgv2XMLTestFlags; static int -- 2.31.1
participants (2)
-
Ján Tomko
-
Pavel Hrdina