mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-08-30 05:50:08 +03:00
storagepoolxml2argvtest: pass the platform suffix as a string
Instead of a pair of bools. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
@ -96,8 +96,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
struct testInfo {
|
struct testInfo {
|
||||||
bool shouldFail;
|
bool shouldFail;
|
||||||
const char *pool;
|
const char *pool;
|
||||||
bool linuxOut;
|
const char *platformSuffix;
|
||||||
bool freebsdOut;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -112,19 +111,10 @@ testCompareXMLToArgvHelper(const void *data)
|
|||||||
abs_srcdir, info->pool) < 0)
|
abs_srcdir, info->pool) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (info->linuxOut) {
|
if (virAsprintf(&cmdline, "%s/storagepoolxml2argvdata/%s%s.argv",
|
||||||
if (virAsprintf(&cmdline, "%s/storagepoolxml2argvdata/%s-linux.argv",
|
abs_srcdir, info->pool, info->platformSuffix) < 0 &&
|
||||||
abs_srcdir, info->pool) < 0 && !info->shouldFail)
|
!info->shouldFail)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (info->freebsdOut) {
|
|
||||||
if (virAsprintf(&cmdline, "%s/storagepoolxml2argvdata/%s-freebsd.argv",
|
|
||||||
abs_srcdir, info->pool) < 0 && !info->shouldFail)
|
|
||||||
goto cleanup;
|
|
||||||
} else {
|
|
||||||
if (virAsprintf(&cmdline, "%s/storagepoolxml2argvdata/%s.argv",
|
|
||||||
abs_srcdir, info->pool) < 0 && !info->shouldFail)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = testCompareXMLToArgvFiles(info->shouldFail, poolxml, cmdline);
|
result = testCompareXMLToArgvFiles(info->shouldFail, poolxml, cmdline);
|
||||||
|
|
||||||
@ -141,9 +131,9 @@ mymain(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
#define DO_TEST_FULL(shouldFail, pool, linuxOut, freebsdOut) \
|
#define DO_TEST_FULL(shouldFail, pool, platformSuffix) \
|
||||||
do { \
|
do { \
|
||||||
struct testInfo info = { shouldFail, pool, linuxOut, freebsdOut }; \
|
struct testInfo info = { shouldFail, pool, platformSuffix }; \
|
||||||
if (virTestRun("Storage Pool XML-2-argv " pool, \
|
if (virTestRun("Storage Pool XML-2-argv " pool, \
|
||||||
testCompareXMLToArgvHelper, &info) < 0) \
|
testCompareXMLToArgvHelper, &info) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
@ -151,16 +141,16 @@ mymain(void)
|
|||||||
while (0);
|
while (0);
|
||||||
|
|
||||||
#define DO_TEST(pool, ...) \
|
#define DO_TEST(pool, ...) \
|
||||||
DO_TEST_FULL(false, pool, false, false)
|
DO_TEST_FULL(false, pool, "")
|
||||||
|
|
||||||
#define DO_TEST_FAIL(pool, ...) \
|
#define DO_TEST_FAIL(pool, ...) \
|
||||||
DO_TEST_FULL(true, pool, false, false)
|
DO_TEST_FULL(true, pool, "")
|
||||||
|
|
||||||
#define DO_TEST_LINUX(pool, ...) \
|
#define DO_TEST_LINUX(pool, ...) \
|
||||||
DO_TEST_FULL(false, pool, true, false)
|
DO_TEST_FULL(false, pool, "-linux")
|
||||||
|
|
||||||
#define DO_TEST_FREEBSD(pool, ...) \
|
#define DO_TEST_FREEBSD(pool, ...) \
|
||||||
DO_TEST_FULL(false, pool, false, true)
|
DO_TEST_FULL(false, pool, "-freebsd")
|
||||||
|
|
||||||
if (storageRegisterAll() < 0)
|
if (storageRegisterAll() < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Reference in New Issue
Block a user