Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/bhyveargv2xmltest.c | 10 ++--
tests/bhyvexml2argvtest.c | 18 +++----
tests/bhyvexml2xmltest.c | 10 ++--
tests/commandtest.c | 18 +++----
tests/cputest.c | 60 ++++++++++-----------
tests/domaincapstest.c | 16 +++---
tests/domainconftest.c | 4 +-
tests/fchosttest.c | 2 +-
tests/fdstreamtest.c | 4 +-
tests/genericxml2xmltest.c | 8 +--
tests/interfacexml2xmltest.c | 4 +-
tests/libxlxml2domconfigtest.c | 4 +-
tests/lxcconf2xmltest.c | 16 +++---
tests/lxcxml2xmltest.c | 8 +--
tests/networkxml2conftest.c | 4 +-
tests/networkxml2firewalltest.c | 10 ++--
tests/networkxml2xmltest.c | 4 +-
tests/networkxml2xmlupdatetest.c | 12 ++---
tests/nodedevxml2xmltest.c | 4 +-
tests/nssmock.c | 6 +--
tests/nwfilterxml2firewalltest.c | 12 ++---
tests/nwfilterxml2xmltest.c | 4 +-
tests/openvzutilstest.c | 4 +-
tests/qemuagenttest.c | 2 +-
tests/qemublocktest.c | 22 ++++----
tests/qemucapabilitiestest.c | 16 +++---
tests/qemucaps2xmltest.c | 10 ++--
tests/qemudomaincheckpointxml2xmltest.c | 2 +-
tests/qemudomainsnapshotxml2xmltest.c | 2 +-
tests/qemufirmwaretest.c | 2 +-
tests/qemuhotplugtest.c | 26 ++++-----
tests/qemumemlocktest.c | 4 +-
tests/qemumigparamstest.c | 20 +++----
tests/qemumonitorjsontest.c | 50 +++++++++---------
tests/qemumonitortestutils.c | 24 ++++-----
tests/qemusecuritymock.c | 2 +-
tests/qemusecuritytest.c | 2 +-
tests/qemuvhostusertest.c | 2 +-
tests/qemuxml2argvtest.c | 18 +++----
tests/qemuxml2xmltest.c | 18 +++----
tests/scsihosttest.c | 14 ++---
tests/secretxml2xmltest.c | 10 ++--
tests/securityselinuxlabeltest.c | 16 +++---
tests/storagebackendsheepdogtest.c | 8 +--
tests/storagepoolcapstest.c | 4 +-
tests/storagepoolxml2argvtest.c | 8 +--
tests/storagepoolxml2xmltest.c | 8 +--
tests/storagevolxml2argvtest.c | 22 ++++----
tests/storagevolxml2xmltest.c | 12 ++---
tests/sysinfotest.c | 8 +--
tests/testutils.c | 10 ++--
tests/testutils.h | 2 +-
tests/testutilsqemu.c | 8 +--
tests/vboxsnapshotxmltest.c | 4 +-
tests/virbuftest.c | 2 +-
tests/vircaps2xmltest.c | 12 ++---
tests/vircgroupmock.c | 8 +--
tests/vircgrouptest.c | 2 +-
tests/virconftest.c | 4 +-
tests/virfilemock.c | 2 +-
tests/virfiletest.c | 2 +-
tests/virfilewrapper.c | 2 +-
tests/virhostcputest.c | 32 +++++------
tests/virjsontest.c | 24 ++++-----
tests/virmacmaptest.c | 6 +--
tests/virnetdaemontest.c | 8 +--
tests/virnetdevmock.c | 4 +-
tests/virnetdevopenvswitchtest.c | 4 +-
tests/virnetsockettest.c | 4 +-
tests/virnetworkportxml2xmltest.c | 4 +-
tests/virnumamock.c | 2 +-
tests/virnwfilterbindingxml2xmltest.c | 4 +-
tests/virpcimock.c | 70 ++++++++++++-------------
tests/virpcitest.c | 10 ++--
tests/virrandommock.c | 4 +-
tests/virresctrltest.c | 12 ++---
tests/virschematest.c | 10 ++--
tests/virscsitest.c | 6 +--
tests/virshtest.c | 4 +-
tests/virstoragetest.c | 58 ++++++++++----------
tests/virtestmock.c | 2 +-
tests/virusbmock.c | 2 +-
tests/virusbtest.c | 4 +-
tests/vmwarevertest.c | 2 +-
tests/vmx2xmltest.c | 12 ++---
tests/xlconfigtest.c | 4 +-
tests/xmconfigtest.c | 4 +-
tests/xml2vmxtest.c | 12 ++---
88 files changed, 467 insertions(+), 473 deletions(-)
diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c
index d108366682..5e39face33 100644
--- a/tests/bhyveargv2xmltest.c
+++ b/tests/bhyveargv2xmltest.c
@@ -106,15 +106,13 @@ testCompareXMLToArgvHelper(const void *data)
char *xml = NULL;
char *args = NULL;
- if (virAsprintf(&xml, "%s/bhyveargv2xmldata/bhyveargv2xml-%s.xml",
- abs_srcdir, info->name) < 0 ||
- virAsprintf(&args, "%s/bhyveargv2xmldata/bhyveargv2xml-%s.args",
- abs_srcdir, info->name) < 0)
- goto cleanup;
+ xml = g_strdup_printf("%s/bhyveargv2xmldata/bhyveargv2xml-%s.xml",
+ abs_srcdir, info->name);
+ args = g_strdup_printf("%s/bhyveargv2xmldata/bhyveargv2xml-%s.args",
+ abs_srcdir, info->name);
result = testCompareXMLToArgvFiles(xml, args, info->flags);
- cleanup:
VIR_FREE(xml);
VIR_FREE(args);
return result;
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index eeedd04f72..f5dbb4e154 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -119,19 +119,17 @@ testCompareXMLToArgvHelper(const void *data)
char *xml = NULL;
char *args = NULL, *ldargs = NULL, *dmargs = NULL;
- if (virAsprintf(&xml, "%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
- abs_srcdir, info->name) < 0 ||
- virAsprintf(&args, "%s/bhyvexml2argvdata/bhyvexml2argv-%s.args",
- abs_srcdir, info->name) < 0 ||
- virAsprintf(&ldargs,
"%s/bhyvexml2argvdata/bhyvexml2argv-%s.ldargs",
- abs_srcdir, info->name) < 0 ||
- virAsprintf(&dmargs,
"%s/bhyvexml2argvdata/bhyvexml2argv-%s.devmap",
- abs_srcdir, info->name) < 0)
- goto cleanup;
+ xml = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
+ abs_srcdir, info->name);
+ args = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.args",
+ abs_srcdir, info->name);
+ ldargs = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.ldargs",
+ abs_srcdir, info->name);
+ dmargs = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.devmap",
+ abs_srcdir, info->name);
ret = testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->flags);
- cleanup:
VIR_FREE(xml);
VIR_FREE(args);
VIR_FREE(ldargs);
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index 9f64df8bb2..a0c20a14c1 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -31,11 +31,10 @@ testCompareXMLToXMLHelper(const void *data)
bool is_different = info->flags & FLAG_IS_DIFFERENT;
int ret = -1;
- if (virAsprintf(&xml_in, "%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
- abs_srcdir, info->name) < 0 ||
- virAsprintf(&xml_out,
"%s/bhyvexml2xmloutdata/bhyvexml2xmlout-%s.xml",
- abs_srcdir, info->name) < 0)
- goto cleanup;
+ xml_in = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
+ abs_srcdir, info->name);
+ xml_out = g_strdup_printf("%s/bhyvexml2xmloutdata/bhyvexml2xmlout-%s.xml",
+ abs_srcdir, info->name);
ret = testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, xml_in,
is_different ? xml_out : xml_in,
@@ -49,7 +48,6 @@ testCompareXMLToXMLHelper(const void *data)
virResetLastError();
}
- cleanup:
VIR_FREE(xml_in);
VIR_FREE(xml_out);
return ret;
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 9ee23add4c..a8686f777f 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -67,8 +67,8 @@ static int checkoutput(const char *testname,
char *actualname = NULL;
char *actuallog = NULL;
- virAsprintf(&expectname, "%s/commanddata/%s.log", abs_srcdir,
testname);
- virAsprintf(&actualname, "%s/commandhelper.log", abs_builddir);
+ expectname = g_strdup_printf("%s/commanddata/%s.log", abs_srcdir,
testname);
+ actualname = g_strdup_printf("%s/commandhelper.log", abs_builddir);
if (virFileReadAll(expectname, 1024*64, &expectlog) < 0) {
fprintf(stderr, "cannot read %s\n", expectname);
@@ -83,7 +83,7 @@ static int checkoutput(const char *testname,
if (prefix) {
char *tmp = NULL;
- virAsprintf(&tmp, "%s%s", prefix, expectlog);
+ tmp = g_strdup_printf("%s%s", prefix, expectlog);
VIR_FREE(expectlog);
expectlog = tmp;
@@ -591,7 +591,7 @@ static int test15(const void *unused G_GNUC_UNUSED)
char *cwd = NULL;
int ret = -1;
- virAsprintf(&cwd, "%s/commanddata", abs_srcdir);
+ cwd = g_strdup_printf("%s/commanddata", abs_srcdir);
virCommandSetWorkingDirectory(cmd, cwd);
virCommandSetUmask(cmd, 002);
@@ -810,7 +810,7 @@ static int test20(const void *unused G_GNUC_UNUSED)
sigaction(SIGPIPE, &sig_action, NULL);
- virAsprintf(&buf, "1\n%100000d\n", 2);
+ buf = g_strdup_printf("1\n%100000d\n", 2);
virCommandSetInputBuffer(cmd, buf);
if (virCommandRun(cmd, NULL) < 0) {
@@ -1168,10 +1168,10 @@ static int test27(const void *unused G_GNUC_UNUSED)
buffer2[buflen - 2] = '\n';
buffer2[buflen - 1] = 0;
- virAsprintf(&outexpect, TEST27_OUTEXPECT_TEMP,
- buffer0, buffer1, buffer2);
- virAsprintf(&errexpect, TEST27_ERREXPECT_TEMP,
- buffer0, buffer1, buffer2);
+ outexpect = g_strdup_printf(TEST27_OUTEXPECT_TEMP,
+ buffer0, buffer1, buffer2);
+ errexpect = g_strdup_printf(TEST27_ERREXPECT_TEMP,
+ buffer0, buffer1, buffer2);
if (pipe(pipe1) < 0 || pipe(pipe2) < 0) {
printf("Could not create pipe: %s\n", g_strerror(errno));
diff --git a/tests/cputest.c b/tests/cputest.c
index e1b609ef73..e872861690 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -75,8 +75,8 @@ cpuTestLoadXML(virArch arch, const char *name)
xmlXPathContextPtr ctxt = NULL;
virCPUDefPtr cpu = NULL;
- virAsprintf(&xml, "%s/cputestdata/%s-%s.xml", abs_srcdir,
- virArchToString(arch), name);
+ xml = g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir,
+ virArchToString(arch), name);
if (!(doc = virXMLParseFileCtxt(xml, &ctxt)))
goto cleanup;
@@ -104,8 +104,8 @@ cpuTestLoadMultiXML(virArch arch,
int n;
size_t i;
- virAsprintf(&xml, "%s/cputestdata/%s-%s.xml", abs_srcdir,
- virArchToString(arch), name);
+ xml = g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir,
+ virArchToString(arch), name);
if (!(doc = virXMLParseFileCtxt(xml, &ctxt)))
goto cleanup;
@@ -148,8 +148,8 @@ cpuTestCompareXML(virArch arch,
char *actual = NULL;
int ret = -1;
- virAsprintf(&xml, "%s/cputestdata/%s-%s.xml", abs_srcdir,
- virArchToString(arch), name);
+ xml = g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir,
+ virArchToString(arch), name);
if (!(actual = virCPUDefFormat(cpu, NULL)))
goto cleanup;
@@ -342,7 +342,7 @@ cpuTestBaseline(const void *arg)
suffix = "migratable";
else
suffix = "result";
- virAsprintf(&result, "%s-%s", data->name, suffix);
+ result = g_strdup_printf("%s-%s", data->name, suffix);
if (cpuTestCompareXML(data->arch, baseline, result) < 0)
goto cleanup;
@@ -395,7 +395,7 @@ cpuTestUpdate(const void *arg)
if (virCPUUpdate(host->arch, cpu, migHost) < 0)
goto cleanup;
- virAsprintf(&result, "%s+%s", data->host, data->name);
+ result = g_strdup_printf("%s+%s", data->host, data->name);
ret = cpuTestCompareXML(data->arch, cpu, result);
@@ -480,8 +480,8 @@ cpuTestMakeQEMUCaps(const struct data *data)
bool fail_no_props = true;
char *json = NULL;
- virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json", abs_srcdir,
- virArchToString(data->arch), data->host);
+ json = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.json", abs_srcdir,
+ virArchToString(data->arch), data->host);
if (!(testMon = qemuMonitorTestNewFromFile(json, driver.xmlopt, true)))
goto error;
@@ -583,8 +583,8 @@ cpuTestCPUID(bool guest, const void *arg)
char *result = NULL;
virDomainCapsCPUModelsPtr models = NULL;
- virAsprintf(&hostFile, "%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
- virArchToString(data->arch), data->host);
+ hostFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
+ virArchToString(data->arch), data->host);
if (virTestLoadFile(hostFile, &host) < 0 ||
!(hostData = virCPUDataParse(host)))
@@ -615,7 +615,7 @@ cpuTestCPUID(bool guest, const void *arg)
if (cpuDecode(cpu, hostData, models) < 0)
goto cleanup;
- virAsprintf(&result, "cpuid-%s-%s", data->host, guest ?
"guest" : "host");
+ result = g_strdup_printf("cpuid-%s-%s", data->host, guest ?
"guest" : "host");
ret = cpuTestCompareXML(data->arch, cpu, result);
@@ -657,12 +657,12 @@ cpuTestCompareSignature(const struct data *data,
signature = virCPUx86DataGetSignature(hostData, &family, &model,
&stepping);
- virAsprintf(&result, "%s/cputestdata/%s-cpuid-%s.sig", abs_srcdir,
- virArchToString(data->arch), data->host);
+ result = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.sig", abs_srcdir,
+ virArchToString(data->arch), data->host);
- virAsprintf(&sigStr, "%1$06lx\n" "family: %2$3u
(0x%2$02x)\n"
- "model: %3$3u (0x%3$02x)\n" "stepping: %4$3u
(0x%4$02x)\n",
- signature, family, model, stepping);
+ sigStr = g_strdup_printf("%1$06lx\n" "family: %2$3u
(0x%2$02x)\n"
+ "model: %3$3u (0x%3$02x)\n" "stepping:
%4$3u (0x%4$02x)\n",
+ signature, family, model, stepping);
return virTestCompareToFile(sigStr, result);
}
@@ -677,8 +677,8 @@ cpuTestCPUIDSignature(const void *arg)
char *host = NULL;
int ret = -1;
- virAsprintf(&hostFile, "%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
- virArchToString(data->arch), data->host);
+ hostFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir,
+ virArchToString(data->arch), data->host);
if (virTestLoadFile(hostFile, &host) < 0 ||
!(hostData = virCPUDataParse(host)))
@@ -801,23 +801,23 @@ cpuTestUpdateLive(const void *arg)
virDomainCapsCPUModelsPtr models = NULL;
int ret = -1;
- virAsprintf(&cpuFile, "cpuid-%s-guest", data->host);
+ cpuFile = g_strdup_printf("cpuid-%s-guest", data->host);
if (!(cpu = cpuTestLoadXML(data->arch, cpuFile)))
goto cleanup;
- virAsprintf(&enabledFile, "%s/cputestdata/%s-cpuid-%s-enabled.xml",
- abs_srcdir, virArchToString(data->arch), data->host);
+ enabledFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s-enabled.xml",
+ abs_srcdir, virArchToString(data->arch),
data->host);
if (virTestLoadFile(enabledFile, &enabled) < 0 ||
!(enabledData = virCPUDataParse(enabled)))
goto cleanup;
- virAsprintf(&disabledFile, "%s/cputestdata/%s-cpuid-%s-disabled.xml",
- abs_srcdir, virArchToString(data->arch), data->host);
+ disabledFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s-disabled.xml",
+ abs_srcdir, virArchToString(data->arch),
data->host);
if (virTestLoadFile(disabledFile, &disabled) < 0 ||
!(disabledData = virCPUDataParse(disabled)))
goto cleanup;
- virAsprintf(&expectedFile, "cpuid-%s-json", data->host);
+ expectedFile = g_strdup_printf("cpuid-%s-json", data->host);
if (!(expected = cpuTestLoadXML(data->arch, expectedFile)))
goto cleanup;
@@ -890,7 +890,7 @@ cpuTestJSONCPUID(const void *arg)
char *result = NULL;
int ret = -1;
- virAsprintf(&result, "cpuid-%s-json", data->host);
+ result = g_strdup_printf("cpuid-%s-json", data->host);
if (!(qemuCaps = cpuTestMakeQEMUCaps(data)))
goto cleanup;
@@ -1011,8 +1011,8 @@ mymain(void)
tmp = virTestLogContentAndReset(); \
VIR_FREE(tmp); \
\
- virAsprintf(&testLabel, "%s(%s): %s", \
- #api, virArchToString(arch), name); \
+ testLabel = g_strdup_printf("%s(%s): %s", #api, \
+ virArchToString(arch), name); \
\
if (virTestRun(testLabel, api, &data) < 0) { \
if (virTestGetDebug()) { \
@@ -1052,7 +1052,7 @@ mymain(void)
suffix = " (expanded)"; \
if ((flags) & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) \
suffix = " (migratable)"; \
- virAsprintf(&label, "%s%s", name, suffix); \
+ label = g_strdup_printf("%s%s", name, suffix); \
DO_TEST(arch, cpuTestBaseline, label, NULL, \
"baseline-" name, NULL, flags, result); \
VIR_FREE(label); \
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 3289eb3ef7..7d37faefe5 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -88,7 +88,7 @@ fillQemuCaps(virDomainCapsPtr domCaps,
fakeHostCPU(caps, domCaps->arch) < 0)
goto cleanup;
- virAsprintf(&path, "%s/%s.%s.xml", TEST_QEMU_CAPS_PATH, name, arch);
+ path = g_strdup_printf("%s/%s.%s.xml", TEST_QEMU_CAPS_PATH, name, arch);
if (!(qemuCaps = qemuTestParseCapabilities(caps, path)))
goto cleanup;
@@ -216,8 +216,8 @@ test_virDomainCapsFormat(const void *opaque)
char *domCapsXML = NULL;
int ret = -1;
- virAsprintf(&path, "%s/domaincapsschemadata/%s.xml", abs_srcdir,
- data->name);
+ path = g_strdup_printf("%s/domaincapsschemadata/%s.xml", abs_srcdir,
+ data->name);
if (!(domCaps = virDomainCapsNew(data->emulator, data->machine,
virArchFromString(data->arch),
@@ -297,10 +297,10 @@ mymain(void)
#define DO_TEST_QEMU(Name, CapsName, Emulator, Machine, Arch, Type) \
do { \
char *name = NULL; \
- virAsprintf(&name, "qemu_%s%s%s.%s", \
- Name, \
- Machine ? "-" : "", Machine ? Machine :
"", \
- Arch); \
+ name = g_strdup_printf("qemu_%s%s%s.%s", \
+ Name, \
+ Machine ? "-" : "", Machine ? Machine
: "", \
+ Arch); \
struct testData data = { \
.name = name, \
.emulator = Emulator, \
@@ -333,7 +333,7 @@ mymain(void)
#define DO_TEST_BHYVE(Name, Emulator, BhyveCaps, Type) \
do { \
char *name = NULL; \
- virAsprintf(&name, "bhyve_%s.x86_64", Name); \
+ name = g_strdup_printf("bhyve_%s.x86_64", Name); \
struct testData data = { \
.name = name, \
.emulator = Emulator, \
diff --git a/tests/domainconftest.c b/tests/domainconftest.c
index 3de6e7740e..f48c3ca682 100644
--- a/tests/domainconftest.c
+++ b/tests/domainconftest.c
@@ -46,8 +46,8 @@ static int testGetFilesystem(const void *opaque)
const struct testGetFilesystemData *data = opaque;
virDomainFSDefPtr fsdef;
- virAsprintf(&filename, "%s/domainconfdata/%s.xml", abs_srcdir,
- data->filename);
+ filename = g_strdup_printf("%s/domainconfdata/%s.xml", abs_srcdir,
+ data->filename);
if (!(def = virDomainDefParseFile(filename, caps, xmlopt, NULL, 0)))
goto cleanup;
diff --git a/tests/fchosttest.c b/tests/fchosttest.c
index fe4f255fe1..44e7f11599 100644
--- a/tests/fchosttest.c
+++ b/tests/fchosttest.c
@@ -343,7 +343,7 @@ mymain(void)
{
int ret = 0;
- virAsprintf(&fchost_prefix, "%s/%s", abs_srcdir,
"fchostdata/fc_host/");
+ fchost_prefix = g_strdup_printf("%s/%s", abs_srcdir,
"fchostdata/fc_host/");
if (virTestRun("virVHBAPathExists", test1, NULL) < 0)
ret = -1;
diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c
index 4acc97967e..f4d38d5a20 100644
--- a/tests/fdstreamtest.c
+++ b/tests/fdstreamtest.c
@@ -62,7 +62,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool
blocking)
for (i = 0; i < PATTERN_LEN; i++)
pattern[i] = i;
- virAsprintf(&file, "%s/input.data", scratchdir);
+ file = g_strdup_printf("%s/input.data", scratchdir);
if ((fd = open(file, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0)
goto cleanup;
@@ -193,7 +193,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool
blocking)
for (i = 0; i < PATTERN_LEN; i++)
pattern[i] = i;
- virAsprintf(&file, "%s/input.data", scratchdir);
+ file = g_strdup_printf("%s/input.data", scratchdir);
if (!(st = virStreamNew(conn, flags)))
goto cleanup;
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index 7b59749d01..0d04413712 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -29,10 +29,10 @@ testCompareXMLToXMLHelper(const void *data)
char *xml_out = NULL;
int ret = -1;
- virAsprintf(&xml_in, "%s/genericxml2xmlindata/%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&xml_out, "%s/genericxml2xmloutdata/%s.xml",
- abs_srcdir, info->name);
+ xml_in = g_strdup_printf("%s/genericxml2xmlindata/%s.xml",
+ abs_srcdir, info->name);
+ xml_out = g_strdup_printf("%s/genericxml2xmloutdata/%s.xml",
+ abs_srcdir, info->name);
ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
info->different ? xml_out : xml_in,
diff --git a/tests/interfacexml2xmltest.c b/tests/interfacexml2xmltest.c
index c7de2e4bd0..f9740d1cf3 100644
--- a/tests/interfacexml2xmltest.c
+++ b/tests/interfacexml2xmltest.c
@@ -50,8 +50,8 @@ testCompareXMLToXMLHelper(const void *data)
int result = -1;
char *xml = NULL;
- virAsprintf(&xml, "%s/interfaceschemadata/%s.xml", abs_srcdir,
- (const char *)data);
+ xml = g_strdup_printf("%s/interfaceschemadata/%s.xml", abs_srcdir,
+ (const char *)data);
result = testCompareXMLToXMLFiles(xml);
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index efd003eb58..5bda6db360 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -151,8 +151,8 @@ testCompareXMLToDomConfigHelper(const void *data)
char *xmlfile = NULL;
char *jsonfile = NULL;
- virAsprintf(&xmlfile, "%s/libxlxml2domconfigdata/%s.xml", abs_srcdir,
info->name);
- virAsprintf(&jsonfile, "%s/libxlxml2domconfigdata/%s.json", abs_srcdir,
info->name);
+ xmlfile = g_strdup_printf("%s/libxlxml2domconfigdata/%s.xml", abs_srcdir,
info->name);
+ jsonfile = g_strdup_printf("%s/libxlxml2domconfigdata/%s.json", abs_srcdir,
info->name);
ret = testCompareXMLToDomConfig(xmlfile, jsonfile);
diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c
index f2d884dc15..c52c6e7fd7 100644
--- a/tests/lxcconf2xmltest.c
+++ b/tests/lxcconf2xmltest.c
@@ -71,10 +71,10 @@ testCompareXMLToConfigHelperLegacy(const void *data)
char *xml = NULL;
char *config = NULL;
- virAsprintf(&xml, "%s/lxcconf2xmldata/lxcconf2xml-%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&config, "%s/lxcconf2xmldata/lxcconf2xml-%s.config",
- abs_srcdir, info->name);
+ xml = g_strdup_printf("%s/lxcconf2xmldata/lxcconf2xml-%s.xml",
+ abs_srcdir, info->name);
+ config = g_strdup_printf("%s/lxcconf2xmldata/lxcconf2xml-%s.config",
+ abs_srcdir, info->name);
result = testCompareXMLToConfigFiles(xml, config, info->expectError);
@@ -91,10 +91,10 @@ testCompareXMLToConfigHelperV3(const void *data)
char *xml = NULL;
char *config = NULL;
- virAsprintf(&xml, "%s/lxcconf2xmldata/lxcconf2xml-%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&config, "%s/lxcconf2xmldata/lxcconf2xml-%s-v3.config",
- abs_srcdir, info->name);
+ xml = g_strdup_printf("%s/lxcconf2xmldata/lxcconf2xml-%s.xml",
+ abs_srcdir, info->name);
+ config = g_strdup_printf("%s/lxcconf2xmldata/lxcconf2xml-%s-v3.config",
+ abs_srcdir, info->name);
result = testCompareXMLToConfigFiles(xml, config, info->expectError);
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index ded35f8d4b..6a720503a9 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -34,10 +34,10 @@ testCompareXMLToXMLHelper(const void *data)
char *xml_out = NULL;
int ret = -1;
- virAsprintf(&xml_in, "%s/lxcxml2xmldata/lxc-%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&xml_out, "%s/lxcxml2xmloutdata/lxc-%s.xml",
- abs_srcdir, info->name);
+ xml_in = g_strdup_printf("%s/lxcxml2xmldata/lxc-%s.xml",
+ abs_srcdir, info->name);
+ xml_out = g_strdup_printf("%s/lxcxml2xmloutdata/lxc-%s.xml",
+ abs_srcdir, info->name);
ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
info->different ? xml_out : xml_in,
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 9992afaf62..a8355272b9 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -86,8 +86,8 @@ testCompareXMLToConfHelper(const void *data)
char *inxml = NULL;
char *outconf = NULL;
- virAsprintf(&inxml, "%s/networkxml2confdata/%s.xml", abs_srcdir,
info->name);
- virAsprintf(&outconf, "%s/networkxml2confdata/%s.conf", abs_srcdir,
info->name);
+ inxml = g_strdup_printf("%s/networkxml2confdata/%s.xml", abs_srcdir,
info->name);
+ outconf = g_strdup_printf("%s/networkxml2confdata/%s.conf", abs_srcdir,
info->name);
result = testCompareXMLToConfFiles(inxml, outconf, info->caps);
diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index 0aaebf5bc6..831b7630d4 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -117,10 +117,10 @@ testCompareXMLToIPTablesHelper(const void *data)
char *xml = NULL;
char *args = NULL;
- virAsprintf(&xml, "%s/networkxml2firewalldata/%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&args, "%s/networkxml2firewalldata/%s-%s.args",
- abs_srcdir, info->name, RULESTYPE);
+ xml = g_strdup_printf("%s/networkxml2firewalldata/%s.xml",
+ abs_srcdir, info->name);
+ args = g_strdup_printf("%s/networkxml2firewalldata/%s-%s.args",
+ abs_srcdir, info->name, RULESTYPE);
result = testCompareXMLToArgvFiles(xml, args, info->baseargs);
@@ -167,7 +167,7 @@ mymain(void)
goto cleanup;
}
- virAsprintf(&basefile, "%s/networkxml2firewalldata/base.args",
abs_srcdir);
+ basefile = g_strdup_printf("%s/networkxml2firewalldata/base.args",
abs_srcdir);
if (virTestLoadFile(basefile, &baseargs) < 0) {
ret = -1;
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 64aada5f34..f784b90c69 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -90,8 +90,8 @@ testCompareXMLToXMLHelper(const void *data)
char *inxml = NULL;
char *outxml = NULL;
- virAsprintf(&inxml, "%s/networkxml2xmlin/%s.xml", abs_srcdir,
info->name);
- virAsprintf(&outxml, "%s/networkxml2xmlout/%s.xml", abs_srcdir,
info->name);
+ inxml = g_strdup_printf("%s/networkxml2xmlin/%s.xml", abs_srcdir,
info->name);
+ outxml = g_strdup_printf("%s/networkxml2xmlout/%s.xml", abs_srcdir,
info->name);
result = testCompareXMLToXMLFiles(inxml, outxml, info->flags,
info->expectResult);
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index a76498c085..00d867fbc2 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -82,12 +82,12 @@ testCompareXMLToXMLHelper(const void *data)
char *updatexml = NULL;
char *outxml = NULL;
- virAsprintf(&netxml, "%s/networkxml2xmlin/%s.xml",
- abs_srcdir, info->netxml);
- virAsprintf(&updatexml, "%s/networkxml2xmlupdatein/%s.xml",
- abs_srcdir, info->updatexml);
- virAsprintf(&outxml, "%s/networkxml2xmlupdateout/%s.xml",
- abs_srcdir, info->outxml);
+ netxml = g_strdup_printf("%s/networkxml2xmlin/%s.xml",
+ abs_srcdir, info->netxml);
+ updatexml = g_strdup_printf("%s/networkxml2xmlupdatein/%s.xml",
+ abs_srcdir, info->updatexml);
+ outxml = g_strdup_printf("%s/networkxml2xmlupdateout/%s.xml",
+ abs_srcdir, info->outxml);
result = testCompareXMLToXMLFiles(netxml, updatexml, outxml, info->flags,
info->command, info->section,
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index e8b869526d..6168c29c70 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -72,8 +72,8 @@ testCompareXMLToXMLHelper(const void *data)
int result = -1;
char *xml = NULL;
- virAsprintf(&xml, "%s/nodedevschemadata/%s.xml", abs_srcdir,
- (const char *)data);
+ xml = g_strdup_printf("%s/nodedevschemadata/%s.xml", abs_srcdir,
+ (const char *)data);
result = testCompareXMLToXMLFiles(xml);
diff --git a/tests/nssmock.c b/tests/nssmock.c
index 8d707a64a5..62e8fa372a 100644
--- a/tests/nssmock.c
+++ b/tests/nssmock.c
@@ -55,9 +55,9 @@ getrealpath(char **newpath,
const char *path)
{
if (STRPREFIX(path, LEASEDIR)) {
- virAsprintf(newpath, "%s/nssdata/%s",
- abs_srcdir,
- path + strlen(LEASEDIR));
+ *newpath = g_strdup_printf("%s/nssdata/%s",
+ abs_srcdir,
+ path + strlen(LEASEDIR));
} else {
*newpath = g_strdup(path);
}
diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c
index 95b6b24014..2f92885d0f 100644
--- a/tests/nwfilterxml2firewalltest.c
+++ b/tests/nwfilterxml2firewalltest.c
@@ -243,8 +243,8 @@ virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
int ret = -1;
char *xml;
- virAsprintf(&xml, "%s/nwfilterxml2firewalldata/%s.xml", abs_srcdir,
- inc->filterref);
+ xml = g_strdup_printf("%s/nwfilterxml2firewalldata/%s.xml", abs_srcdir,
+ inc->filterref);
/* create a temporary hashmap for depth-first tree traversal */
if (!(tmpvars = virNWFilterCreateVarsFrom(inc->params,
@@ -428,10 +428,10 @@ testCompareXMLToIPTablesHelper(const void *data)
char *xml = NULL;
char *args = NULL;
- virAsprintf(&xml, "%s/nwfilterxml2firewalldata/%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&args, "%s/nwfilterxml2firewalldata/%s-%s.args",
- abs_srcdir, info->name, RULESTYPE);
+ xml = g_strdup_printf("%s/nwfilterxml2firewalldata/%s.xml",
+ abs_srcdir, info->name);
+ args = g_strdup_printf("%s/nwfilterxml2firewalldata/%s-%s.args",
+ abs_srcdir, info->name, RULESTYPE);
result = testCompareXMLToArgvFiles(xml, args);
diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c
index 344dd68bc5..52a4af12cc 100644
--- a/tests/nwfilterxml2xmltest.c
+++ b/tests/nwfilterxml2xmltest.c
@@ -62,8 +62,8 @@ testCompareXMLToXMLHelper(const void *data)
char *inxml = NULL;
char *outxml = NULL;
- virAsprintf(&inxml, "%s/nwfilterxml2xmlin/%s.xml", abs_srcdir,
tp->name);
- virAsprintf(&outxml, "%s/nwfilterxml2xmlout/%s.xml", abs_srcdir,
tp->name);
+ inxml = g_strdup_printf("%s/nwfilterxml2xmlin/%s.xml", abs_srcdir,
tp->name);
+ outxml = g_strdup_printf("%s/nwfilterxml2xmlout/%s.xml", abs_srcdir,
tp->name);
result = testCompareXMLToXMLFiles(inxml, outxml, tp->expect_warning);
diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index 9287dc3c79..83969197c6 100644
--- a/tests/openvzutilstest.c
+++ b/tests/openvzutilstest.c
@@ -17,7 +17,7 @@ static int
testLocateConfFile(int vpsid G_GNUC_UNUSED, char **conffile,
const char *ext G_GNUC_UNUSED)
{
- virAsprintf(conffile, "%s/openvzutilstest.conf", abs_srcdir);
+ *conffile = g_strdup_printf("%s/openvzutilstest.conf", abs_srcdir);
return 0;
}
@@ -41,7 +41,7 @@ testReadConfigParam(const void *data G_GNUC_UNUSED)
char *conf = NULL;
char *value = NULL;
- virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir);
+ conf = g_strdup_printf("%s/openvzutilstest.conf", abs_srcdir);
for (i = 0; i < G_N_ELEMENTS(configParams); ++i) {
if (openvzReadConfigParam(conf, configParams[i].param,
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index 65fb937901..f9f0930a33 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -183,7 +183,7 @@ testQemuAgentGetFSInfoCommon(virDomainXMLOptionPtr xmlopt,
if (!(ret_test = qemuMonitorTestNewAgent(xmlopt)))
return -1;
- virAsprintf(&domain_filename, "%s/qemuagentdata/fsinfo.xml",
abs_srcdir);
+ domain_filename = g_strdup_printf("%s/qemuagentdata/fsinfo.xml",
abs_srcdir);
if (!(ret_def = virDomainDefParseFile(domain_filename, driver.caps, xmlopt,
NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE)))
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 0c7c6ed4fa..0f1bf68315 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -82,7 +82,7 @@ testBackingXMLjsonXML(const void *args)
if (!(propsstr = virJSONValueToString(wrapper, false)))
return -1;
- virAsprintf(&protocolwrapper, "json:%s", propsstr);
+ protocolwrapper = g_strdup_printf("json:%s", propsstr);
if (virStorageSourceNewFromBackingAbsolute(protocolwrapper,
&jsonsrc) < 0) {
@@ -162,8 +162,8 @@ testQemuDiskXMLToJSONFakeSecrets(virStorageSourcePtr src)
srcpriv->secinfo->type = VIR_DOMAIN_SECRET_INFO_TYPE_AES;
srcpriv->secinfo->s.aes.username = g_strdup(src->auth->username);
- virAsprintf(&srcpriv->secinfo->s.aes.alias, "%s-secalias",
- NULLSTR(src->nodestorage));
+ srcpriv->secinfo->s.aes.alias = g_strdup_printf("%s-secalias",
+ NULLSTR(src->nodestorage));
}
if (src->encryption) {
@@ -171,8 +171,8 @@ testQemuDiskXMLToJSONFakeSecrets(virStorageSourcePtr src)
return -1;
srcpriv->encinfo->type = VIR_DOMAIN_SECRET_INFO_TYPE_AES;
- virAsprintf(&srcpriv->encinfo->s.aes.alias, "%s-encalias",
- NULLSTR(src->nodeformat));
+ srcpriv->encinfo->s.aes.alias = g_strdup_printf("%s-encalias",
+ NULLSTR(src->nodeformat));
}
return 0;
@@ -194,7 +194,7 @@ testQemuDiskXMLToProps(const void *opaque)
char *xmlstr = NULL;
int ret = -1;
- virAsprintf(&xmlpath, "%s%s.xml", testQemuDiskXMLToJSONPath,
data->name);
+ xmlpath = g_strdup_printf("%s%s.xml", testQemuDiskXMLToJSONPath,
data->name);
if (virTestLoadFile(xmlpath, &xmlstr) < 0)
goto cleanup;
@@ -311,7 +311,7 @@ testQemuDiskXMLToPropsValidateFile(const void *opaque)
if (data->fail)
return EXIT_AM_SKIP;
- virAsprintf(&jsonpath, "%s%s.json", testQemuDiskXMLToJSONPath,
data->name);
+ jsonpath = g_strdup_printf("%s%s.json", testQemuDiskXMLToJSONPath,
data->name);
for (i = 0; i < data->nprops; i++) {
char *jsonstr;
@@ -360,7 +360,7 @@ testQemuImageCreateLoadDiskXML(const char *name,
g_autofree char *xmlpath = NULL;
virStorageSourcePtr ret = NULL;
- virAsprintf(&xmlpath, "%s%s.xml", testQemuImageCreatePath, name);
+ xmlpath = g_strdup_printf("%s%s.xml", testQemuImageCreatePath, name);
if (!(doc = virXMLParseFileCtxt(xmlpath, &ctxt)))
return NULL;
@@ -456,7 +456,7 @@ testQemuImageCreate(const void *opaque)
virBufferTrim(&actualbuf, "\n", -1);
virBufferAddLit(&actualbuf, "\n");
- virAsprintf(&jsonpath, "%s%s.json", testQemuImageCreatePath,
data->name);
+ jsonpath = g_strdup_printf("%s%s.json", testQemuImageCreatePath,
data->name);
if (!(actual = virBufferContentAndReset(&actualbuf)))
return -1;
@@ -477,8 +477,8 @@ testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque)
if (data->fail)
return EXIT_AM_SKIP;
- virAsprintf(&jsonpath, "%s%s-srconly.json", testQemuDiskXMLToJSONPath,
- data->name);
+ jsonpath = g_strdup_printf("%s%s-srconly.json", testQemuDiskXMLToJSONPath,
+ data->name);
for (i = 0; i < data->npropssrc; i++) {
g_autofree char *jsonstr = NULL;
diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index cf1e86c893..f62f147e64 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -76,10 +76,10 @@ testQemuCaps(const void *opaque)
unsigned int fakeMicrocodeVersion = 0;
const char *p;
- virAsprintf(&repliesFile, "%s/%s.%s.replies",
- data->dataDir, data->base, data->archName);
- virAsprintf(&capsFile, "%s/%s.%s.xml",
- data->dataDir, data->base, data->archName);
+ repliesFile = g_strdup_printf("%s/%s.%s.replies",
+ data->dataDir, data->base, data->archName);
+ capsFile = g_strdup_printf("%s/%s.%s.xml",
+ data->dataDir, data->base, data->archName);
if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL,
NULL)))
@@ -144,8 +144,8 @@ testQemuCapsCopy(const void *opaque)
virQEMUCapsPtr copy = NULL;
char *actual = NULL;
- virAsprintf(&capsFile, "%s/%s.%s.xml", data->dataDir,
data->base,
- data->archName);
+ capsFile = g_strdup_printf("%s/%s.%s.xml", data->dataDir,
data->base,
+ data->archName);
if (!(caps = virCapabilitiesNew(virArchFromString(data->archName),
false, false)))
@@ -184,8 +184,8 @@ doCapsTest(const char *base,
g_autofree char *title = NULL;
g_autofree char *copyTitle = NULL;
- virAsprintf(&title, "%s (%s)", base, archName);
- virAsprintf(©Title, "copy %s (%s)", base, archName);
+ title = g_strdup_printf("%s (%s)", base, archName);
+ copyTitle = g_strdup_printf("copy %s (%s)", base, archName);
data->base = base;
data->archName = archName;
diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c
index f46b056c18..ea8735df36 100644
--- a/tests/qemucaps2xmltest.c
+++ b/tests/qemucaps2xmltest.c
@@ -102,7 +102,7 @@ testGetCaps(char *capsData, const testQemuData *data)
virArch arch = virArchFromString(data->archName);
g_autofree char *binary = NULL;
- virAsprintf(&binary, "/usr/bin/qemu-system-%s", data->archName);
+ binary = g_strdup_printf("/usr/bin/qemu-system-%s", data->archName);
if ((qemuCaps = testQemuGetCaps(capsData)) == NULL) {
fprintf(stderr, "failed to parse qemu capabilities flags");
@@ -141,10 +141,10 @@ testQemuCapsXML(const void *opaque)
char *capsXml = NULL;
virCapsPtr capsProvided = NULL;
- virAsprintf(&xmlFile, "%s/caps.%s.xml", data->outputDir,
data->archName);
+ xmlFile = g_strdup_printf("%s/caps.%s.xml", data->outputDir,
data->archName);
- virAsprintf(&capsFile, "%s/%s.%s.xml", data->inputDir,
data->base,
- data->archName);
+ capsFile = g_strdup_printf("%s/%s.%s.xml", data->inputDir,
data->base,
+ data->archName);
if (virTestLoadFile(capsFile, &capsData) < 0)
goto cleanup;
@@ -177,7 +177,7 @@ doCapsTest(const char *base,
testQemuDataPtr data = (testQemuDataPtr) opaque;
g_autofree char *title = NULL;
- virAsprintf(&title, "%s (%s)", base, archName);
+ title = g_strdup_printf("%s (%s)", base, archName);
data->base = base;
data->archName = archName;
diff --git a/tests/qemudomaincheckpointxml2xmltest.c
b/tests/qemudomaincheckpointxml2xmltest.c
index 7f393d68a8..49e8cddeb3 100644
--- a/tests/qemudomaincheckpointxml2xmltest.c
+++ b/tests/qemudomaincheckpointxml2xmltest.c
@@ -121,7 +121,7 @@ testCheckpointPostParse(virDomainMomentDefPtr def)
return -1;
def->creationTime = mocktime;
if (!def->name)
- virAsprintf(&def->name, "%lld", def->creationTime);
+ def->name = g_strdup_printf("%lld", def->creationTime);
return 0;
}
diff --git a/tests/qemudomainsnapshotxml2xmltest.c
b/tests/qemudomainsnapshotxml2xmltest.c
index 0a3aaac6cf..fd3bb04e26 100644
--- a/tests/qemudomainsnapshotxml2xmltest.c
+++ b/tests/qemudomainsnapshotxml2xmltest.c
@@ -106,7 +106,7 @@ testSnapshotPostParse(virDomainMomentDefPtr def)
return -1;
def->creationTime = mocktime;
if (!def->name)
- virAsprintf(&def->name, "%lld", def->creationTime);
+ def->name = g_strdup_printf("%lld", def->creationTime);
return 0;
}
diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c
index 01d4ebc26f..906d594ace 100644
--- a/tests/qemufirmwaretest.c
+++ b/tests/qemufirmwaretest.c
@@ -24,7 +24,7 @@ testParseFormatFW(const void *opaque)
g_autofree char *expected = NULL;
g_autofree char *actual = NULL;
- virAsprintf(&path, "%s/qemufirmwaredata/%s", abs_srcdir, filename);
+ path = g_strdup_printf("%s/qemufirmwaredata/%s", abs_srcdir, filename);
if (!(fw = qemuFirmwareParse(path)))
return -1;
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 04dc347fd8..a78f97d2ae 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -245,14 +245,14 @@ testQemuHotplug(const void *data)
qemuMonitorTestPtr test_mon = NULL;
qemuDomainObjPrivatePtr priv = NULL;
- virAsprintf(&domain_filename,
"%s/qemuhotplugtestdomains/qemuhotplug-%s.xml",
- abs_srcdir, test->domain_filename);
- virAsprintf(&device_filename,
"%s/qemuhotplugtestdevices/qemuhotplug-%s.xml",
- abs_srcdir, test->device_filename);
- virAsprintf(&result_filename,
- "%s/qemuhotplugtestdomains/qemuhotplug-%s+%s.xml",
- abs_srcdir, test->domain_filename,
- test->device_filename);
+ domain_filename =
g_strdup_printf("%s/qemuhotplugtestdomains/qemuhotplug-%s.xml",
+ abs_srcdir, test->domain_filename);
+ device_filename =
g_strdup_printf("%s/qemuhotplugtestdevices/qemuhotplug-%s.xml",
+ abs_srcdir, test->device_filename);
+ result_filename = g_strdup_printf(
+
"%s/qemuhotplugtestdomains/qemuhotplug-%s+%s.xml",
+ abs_srcdir, test->domain_filename,
+ test->device_filename);
if (virTestLoadFile(domain_filename, &domain_xml) < 0 ||
virTestLoadFile(device_filename, &device_xml) < 0)
@@ -408,17 +408,17 @@ testQemuHotplugCpuPrepare(const char *test,
char *prefix = NULL;
struct testQemuHotplugCpuData *data = NULL;
- virAsprintf(&prefix, "%s/qemuhotplugtestcpus/%s", abs_srcdir, test);
+ prefix = g_strdup_printf("%s/qemuhotplugtestcpus/%s", abs_srcdir, test);
if (VIR_ALLOC(data) < 0)
goto error;
data->modern = modern;
- virAsprintf(&data->file_xml_dom, "%s-domain.xml", prefix);
- virAsprintf(&data->file_xml_res_live, "%s-result-live.xml",
prefix);
- virAsprintf(&data->file_xml_res_conf, "%s-result-conf.xml",
prefix);
- virAsprintf(&data->file_json_monitor, "%s-monitor.json", prefix);
+ data->file_xml_dom = g_strdup_printf("%s-domain.xml", prefix);
+ data->file_xml_res_live = g_strdup_printf("%s-result-live.xml",
prefix);
+ data->file_xml_res_conf = g_strdup_printf("%s-result-conf.xml",
prefix);
+ data->file_json_monitor = g_strdup_printf("%s-monitor.json", prefix);
if (virTestLoadFile(data->file_xml_dom, &data->xml_dom) < 0)
goto error;
diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
index 8e395759e1..d5a4fb1268 100644
--- a/tests/qemumemlocktest.c
+++ b/tests/qemumemlocktest.c
@@ -34,8 +34,8 @@ testCompareMemLock(const void *data)
char *xml = NULL;
int ret = -1;
- virAsprintf(&xml, "%s/qemumemlockdata/qemumemlock-%s.xml", abs_srcdir,
- info->name);
+ xml = g_strdup_printf("%s/qemumemlockdata/qemumemlock-%s.xml", abs_srcdir,
+ info->name);
if (!(def = virDomainDefParseFile(xml, driver.caps, driver.xmlopt, NULL,
VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index ded3a8ef64..b36aa60302 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -66,8 +66,8 @@ qemuMigParamsTestXML2XML(const void *opaque)
char *actualXML = NULL;
int ret = -1;
- virAsprintf(&xmlFile, "%s/qemumigparamsdata/%s.xml", abs_srcdir,
- data->name);
+ xmlFile = g_strdup_printf("%s/qemumigparamsdata/%s.xml", abs_srcdir,
+ data->name);
if (!(doc = virXMLParseFileCtxt(xmlFile, &ctxt)))
goto cleanup;
@@ -109,10 +109,10 @@ qemuMigParamsTestXML(const void *opaque)
char *actualXML = NULL;
int ret = -1;
- virAsprintf(&replyFile, "%s/qemumigparamsdata/%s.reply",
- abs_srcdir, data->name);
- virAsprintf(&xmlFile, "%s/qemumigparamsdata/%s.xml",
- abs_srcdir, data->name);
+ replyFile = g_strdup_printf("%s/qemumigparamsdata/%s.reply",
+ abs_srcdir, data->name);
+ xmlFile = g_strdup_printf("%s/qemumigparamsdata/%s.xml",
+ abs_srcdir, data->name);
if (!(mon = qemuMonitorTestNewFromFile(replyFile, data->xmlopt, true)))
goto cleanup;
@@ -159,10 +159,10 @@ qemuMigParamsTestJSON(const void *opaque)
char *actualJSON = NULL;
int ret = -1;
- virAsprintf(&replyFile, "%s/qemumigparamsdata/%s.reply",
- abs_srcdir, data->name);
- virAsprintf(&jsonFile, "%s/qemumigparamsdata/%s.json",
- abs_srcdir, data->name);
+ replyFile = g_strdup_printf("%s/qemumigparamsdata/%s.reply",
+ abs_srcdir, data->name);
+ jsonFile = g_strdup_printf("%s/qemumigparamsdata/%s.json",
+ abs_srcdir, data->name);
if (!(mon = qemuMonitorTestNewFromFile(replyFile, data->xmlopt, true)))
goto cleanup;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index c87f7db2e0..2420ac8e18 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -796,9 +796,9 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOptionPtr xmlopt,
if (!reply)
reply = "";
- virAsprintf(&jsonreply, "{\"return\": {%s}}", reply);
+ jsonreply = g_strdup_printf("{\"return\": {%s}}", reply);
- virAsprintf(&fulllabel, "qemuMonitorJSONTestAttachChardev(%s)",
label);
+ fulllabel = g_strdup_printf("qemuMonitorJSONTestAttachChardev(%s)",
label);
data.chr = chr;
data.fail = fail;
@@ -2457,12 +2457,12 @@ testQemuMonitorJSONGetCPUData(const void *opaque)
if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema)))
return -1;
- virAsprintf(&jsonFile,
- "%s/qemumonitorjsondata/qemumonitorjson-getcpu-%s.json",
- abs_srcdir, data->name);
- virAsprintf(&dataFile,
- "%s/qemumonitorjsondata/qemumonitorjson-getcpu-%s.data",
- abs_srcdir, data->name);
+ jsonFile = g_strdup_printf(
+
"%s/qemumonitorjsondata/qemumonitorjson-getcpu-%s.json",
+ abs_srcdir, data->name);
+ dataFile = g_strdup_printf(
+
"%s/qemumonitorjsondata/qemumonitorjson-getcpu-%s.data",
+ abs_srcdir, data->name);
if (virTestLoadFile(jsonFile, &jsonStr) < 0)
goto cleanup;
@@ -2709,15 +2709,15 @@ testQemuMonitorCPUInfo(const void *opaque)
if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema)))
return -1;
- virAsprintf(&queryCpusFile,
- "%s/qemumonitorjsondata/qemumonitorjson-cpuinfo-%s-cpus.json",
- abs_srcdir, data->name);
- virAsprintf(&queryHotpluggableFile,
-
"%s/qemumonitorjsondata/qemumonitorjson-cpuinfo-%s-hotplug.json",
- abs_srcdir, data->name);
- virAsprintf(&dataFile,
- "%s/qemumonitorjsondata/qemumonitorjson-cpuinfo-%s.data",
- abs_srcdir, data->name);
+ queryCpusFile = g_strdup_printf(
+
"%s/qemumonitorjsondata/qemumonitorjson-cpuinfo-%s-cpus.json",
+ abs_srcdir, data->name);
+ queryHotpluggableFile = g_strdup_printf(
+
"%s/qemumonitorjsondata/qemumonitorjson-cpuinfo-%s-hotplug.json",
+ abs_srcdir, data->name);
+ dataFile = g_strdup_printf(
+
"%s/qemumonitorjsondata/qemumonitorjson-cpuinfo-%s.data",
+ abs_srcdir, data->name);
if (virTestLoadFile(queryCpusFile, &queryCpusStr) < 0)
goto cleanup;
@@ -2812,8 +2812,8 @@ testBlockNodeNameDetect(const void *opaque)
virBuffer buf = VIR_BUFFER_INITIALIZER;
int ret = -1;
- virAsprintf(&resultFile, "%s/%s%s.result", abs_srcdir, pathprefix,
- testname);
+ resultFile = g_strdup_printf("%s/%s%s.result", abs_srcdir, pathprefix,
+ testname);
if (!(namedNodesJson = virTestLoadFileJSON(pathprefix, testname,
"-named-nodes.json", NULL)))
@@ -2956,12 +2956,12 @@ testQueryJobs(const void *opaque)
if (!test)
return -1;
- virAsprintf(&filenameJSON,
- abs_srcdir "/qemumonitorjsondata/query-jobs-%s.json",
- data->name);
- virAsprintf(&filenameResult,
- abs_srcdir "/qemumonitorjsondata/query-jobs-%s.result",
- data->name);
+ filenameJSON = g_strdup_printf(
+ abs_srcdir
"/qemumonitorjsondata/query-jobs-%s.json",
+ data->name);
+ filenameResult = g_strdup_printf(
+ abs_srcdir
"/qemumonitorjsondata/query-jobs-%s.result",
+ data->name);
if (virTestLoadFile(filenameJSON, &fileJSON) < 0)
goto cleanup;
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index b7625bb157..3c93468a4e 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -145,8 +145,8 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test,
}
/* format the JSON error message */
- virAsprintf(&jsonmsg, "{ \"error\": " " {
\"desc\": \"%s\", "
- " \"class\": \"UnexpectedCommand\" } }",
escapemsg);
+ jsonmsg = g_strdup_printf("{ \"error\": " " {
\"desc\": \"%s\", "
+ " \"class\":
\"UnexpectedCommand\" } }", escapemsg);
return qemuMonitorTestAddResponse(test, jsonmsg);
}
@@ -158,7 +158,7 @@ qemuMonitorTestAddUnexpectedErrorResponse(qemuMonitorTestPtr test,
{
g_autofree char *msg = NULL;
- virAsprintf(&msg, "unexpected command: '%s'", command);
+ msg = g_strdup_printf("unexpected command: '%s'", command);
return qemuMonitorTestAddErrorResponse(test, msg);
}
@@ -171,8 +171,8 @@ qemuMonitorTestAddInvalidCommandResponse(qemuMonitorTestPtr test,
{
g_autofree char *msg = NULL;
- virAsprintf(&msg, "expected command '%s' got '%s'",
expectedcommand,
- actualcommand);
+ msg = g_strdup_printf("expected command '%s' got '%s'",
expectedcommand,
+ actualcommand);
return qemuMonitorTestAddErrorResponse(test, msg);
}
@@ -191,8 +191,8 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg,
...)
if (virVasprintf(&msg, errmsg, msgargs) < 0)
goto cleanup;
- virAsprintf(&jsonmsg, "{ \"error\": " " {
\"desc\": \"%s\", "
- " \"class\": \"UnexpectedCommand\" } }",
msg);
+ jsonmsg = g_strdup_printf("{ \"error\": " " {
\"desc\": \"%s\", "
+ " \"class\":
\"UnexpectedCommand\" } }", msg);
ret = qemuMonitorTestAddResponse(test, jsonmsg);
@@ -522,7 +522,7 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
if (STREQ(cmdname, "device_add"))
return 0;
- virAsprintf(&schemapath, "%s/arg-type", cmdname);
+ schemapath = g_strdup_printf("%s/arg-type", cmdname);
if (virQEMUQAPISchemaPathGet(schemapath, test->qapischema, &schemaroot) < 0
||
!schemaroot) {
@@ -640,7 +640,7 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
ret = qemuMonitorTestAddResponse(test, data->response);
} else {
if (data->cmderr) {
- virAsprintf(&errmsg, "%s: %s", data->cmderr, cmdstr);
+ errmsg = g_strdup_printf("%s: %s", data->cmderr, cmdstr);
ret = qemuMonitorTestAddErrorResponse(test, errmsg);
} else {
@@ -731,7 +731,7 @@ qemuMonitorTestProcessGuestAgentSync(qemuMonitorTestPtr test,
goto cleanup;
}
- virAsprintf(&retmsg, "{\"return\":%llu}", id);
+ retmsg = g_strdup_printf("{\"return\":%llu}", id);
ret = qemuMonitorTestAddResponse(test, retmsg);
@@ -1057,7 +1057,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt,
tmpdir_template = NULL;
- virAsprintf(&path, "%s/qemumonitorjsontest.sock", test->tmpdir);
+ path = g_strdup_printf("%s/qemumonitorjsontest.sock", test->tmpdir);
if (vm) {
test->vm = virObjectRef(vm);
@@ -1285,7 +1285,7 @@ qemuMonitorTestFullAddItem(qemuMonitorTestPtr test,
char *cmderr;
int ret;
- virAsprintf(&cmderr, "wrong expected command in %s:%zu: ", filename,
line);
+ cmderr = g_strdup_printf("wrong expected command in %s:%zu: ", filename,
line);
ret = qemuMonitorTestAddItemVerbatim(test, command, cmderr, response);
diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c
index 63bcae0f27..ad182c7bf7 100644
--- a/tests/qemusecuritymock.c
+++ b/tests/qemusecuritymock.c
@@ -117,7 +117,7 @@ get_key(const char *path,
{
char *ret;
- virAsprintf(&ret, "%s:%s", path, name);
+ ret = g_strdup_printf("%s:%s", path, name);
return ret;
}
diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c
index e8ebbf36d8..685ac4dca2 100644
--- a/tests/qemusecuritytest.c
+++ b/tests/qemusecuritytest.c
@@ -45,7 +45,7 @@ prepareObjects(virQEMUDriverPtr driver,
g_autofree char *domxml = NULL;
g_autofree char *latestCapsFile = NULL;
- virAsprintf(&filename, "%s/qemuxml2argvdata/%s.xml", abs_srcdir,
xmlname);
+ filename = g_strdup_printf("%s/qemuxml2argvdata/%s.xml", abs_srcdir,
xmlname);
if (virTestLoadFile(filename, &domxml) < 0)
return -1;
diff --git a/tests/qemuvhostusertest.c b/tests/qemuvhostusertest.c
index 903e6631dc..cc1e523841 100644
--- a/tests/qemuvhostusertest.c
+++ b/tests/qemuvhostusertest.c
@@ -24,7 +24,7 @@ testParseFormatVU(const void *opaque)
g_autofree char *expected = NULL;
g_autofree char *actual = NULL;
- virAsprintf(&path, "%s/qemuvhostuserdata/%s", abs_srcdir, filename);
+ path = g_strdup_printf("%s/qemuvhostuserdata/%s", abs_srcdir, filename);
if (!(vu = qemuVhostUserParse(path)))
return -1;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 39bc3b0aef..1aca59a3e3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -106,8 +106,8 @@ fakeStoragePoolLookupByName(virConnectPtr conn,
virStoragePoolPtr ret = NULL;
if (STRNEQ(name, "inactive")) {
- virAsprintf(&xmlpath, "%s/%s%s.xml", abs_srcdir,
- STORAGE_POOL_XML_PATH, name);
+ xmlpath = g_strdup_printf("%s/%s%s.xml", abs_srcdir,
+ STORAGE_POOL_XML_PATH, name);
if (!virFileExists(xmlpath)) {
virReportError(VIR_ERR_NO_STORAGE_POOL,
@@ -187,7 +187,7 @@ fakeStorageVolGetPath(virStorageVolPtr vol)
{
char *ret = NULL;
- virAsprintf(&ret, "/some/%s/device/%s", vol->key, vol->name);
+ ret = g_strdup_printf("/some/%s/device/%s", vol->key, vol->name);
return ret;
}
@@ -205,8 +205,8 @@ fakeStoragePoolGetXMLDesc(virStoragePoolPtr pool,
return NULL;
}
- virAsprintf(&xmlpath, "%s/%s%s.xml", abs_srcdir,
STORAGE_POOL_XML_PATH,
- pool->name);
+ xmlpath = g_strdup_printf("%s/%s%s.xml", abs_srcdir,
STORAGE_POOL_XML_PATH,
+ pool->name);
if (virTestLoadFile(xmlpath, &xmlbuf) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -592,10 +592,10 @@ static void
testInfoSetPaths(struct testQemuInfo *info,
const char *suffix)
{
- virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args",
- abs_srcdir, info->name, suffix ? suffix : "");
+ info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
+ abs_srcdir, info->name);
+ info->outfile = g_strdup_printf("%s/qemuxml2argvdata/%s%s.args",
+ abs_srcdir, info->name, suffix ? suffix :
"");
}
# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 679b882704..02bbc504ae 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -98,18 +98,18 @@ testInfoSetPaths(struct testQemuInfo *info,
VIR_FREE(info->infile);
VIR_FREE(info->outfile);
- virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
abs_srcdir,
- info->name);
+ info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml",
abs_srcdir,
+ info->name);
- virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s-%s%s.xml",
- abs_srcdir, info->name,
- when == WHEN_ACTIVE ? "active" : "inactive",
suffix);
+ info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s-%s%s.xml",
+ abs_srcdir, info->name,
+ when == WHEN_ACTIVE ? "active" :
"inactive", suffix);
if (!virFileExists(info->outfile)) {
VIR_FREE(info->outfile);
- virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s%s.xml",
- abs_srcdir, info->name, suffix);
+ info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s%s.xml",
+ abs_srcdir, info->name, suffix);
}
return 0;
@@ -121,8 +121,8 @@ static const char *statusPath = abs_srcdir
"/qemustatusxml2xmldata/";
static void
testInfoSetStatusPaths(struct testQemuInfo *info)
{
- virAsprintf(&info->infile, "%s%s-in.xml", statusPath,
info->name);
- virAsprintf(&info->outfile, "%s%s-out.xml", statusPath,
info->name);
+ info->infile = g_strdup_printf("%s%s-in.xml", statusPath,
info->name);
+ info->outfile = g_strdup_printf("%s%s-out.xml", statusPath,
info->name);
}
diff --git a/tests/scsihosttest.c b/tests/scsihosttest.c
index 947a81560a..b35ec6980a 100644
--- a/tests/scsihosttest.c
+++ b/tests/scsihosttest.c
@@ -72,10 +72,10 @@ create_scsihost(const char *fakesysfsdir, const char *devicepath,
int ret = -1;
int fd = -1;
- virAsprintf(&unique_id_path, "%s/devices/pci0000:00/%s/unique_id",
- fakesysfsdir, devicepath);
- virAsprintf(&link_path, "%s/class/scsi_host/%s",
- fakesysfsdir, hostname);
+ unique_id_path = g_strdup_printf("%s/devices/pci0000:00/%s/unique_id",
+ fakesysfsdir, devicepath);
+ link_path = g_strdup_printf("%s/class/scsi_host/%s",
+ fakesysfsdir, hostname);
/* Rather than create path & file, temporarily snip off the file to
* create the path
@@ -205,7 +205,7 @@ testVirFindSCSIHostByPCI(const void *data G_GNUC_UNUSED)
char *ret_host = NULL;
int ret = -1;
- virAsprintf(&path_addr, "%s/%s", abs_srcdir,
"sysfs/class/scsi_host");
+ path_addr = g_strdup_printf("%s/%s", abs_srcdir,
"sysfs/class/scsi_host");
if (!(ret_host = virSCSIHostFindByPCI(TEST_SCSIHOST_CLASS_PATH,
pci_addr1, unique_id1)) ||
@@ -255,14 +255,14 @@ mymain(void)
goto cleanup;
}
- virAsprintf(&fakesysfsdir, "%s/sys", fakerootdir);
+ fakesysfsdir = g_strdup_printf("%s/sys", fakerootdir);
if (init_scsihost_sysfs(fakesysfsdir) < 0) {
fprintf(stderr, "Failed to create fakesysfs='%s'\n",
fakesysfsdir);
goto cleanup;
}
- virAsprintf(&scsihost_class_path, "%s/class/scsi_host", fakesysfsdir);
+ scsihost_class_path = g_strdup_printf("%s/class/scsi_host", fakesysfsdir);
VIR_DEBUG("Reading from '%s'", scsihost_class_path);
if (virTestRun("testVirReadSCSIUniqueId",
diff --git a/tests/secretxml2xmltest.c b/tests/secretxml2xmltest.c
index 44f4615be8..9eb3c460e7 100644
--- a/tests/secretxml2xmltest.c
+++ b/tests/secretxml2xmltest.c
@@ -44,11 +44,11 @@ testCompareXMLToXMLHelper(const void *data)
char *outxml = NULL;
const struct testInfo *info = data;
- virAsprintf(&inxml, "%s/secretxml2xmlin/%s.xml", abs_srcdir,
info->name);
- virAsprintf(&outxml, "%s/secretxml2xml%s/%s.xml",
- abs_srcdir,
- info->different ? "out" : "in",
- info->name);
+ inxml = g_strdup_printf("%s/secretxml2xmlin/%s.xml", abs_srcdir,
info->name);
+ outxml = g_strdup_printf("%s/secretxml2xml%s/%s.xml",
+ abs_srcdir,
+ info->different ? "out" : "in",
+ info->name);
result = testCompareXMLToXMLFiles(inxml, outxml);
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index cc0de456cd..703052418c 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -60,7 +60,7 @@ testUserXattrEnabled(void)
ssize_t len;
const char *con_value = "system_u:object_r:svirt_image_t:s0:c41,c264";
char *path = NULL;
- virAsprintf(&path, "%s/securityselinuxlabeldata/testxattr",
abs_builddir);
+ path = g_strdup_printf("%s/securityselinuxlabeldata/testxattr",
abs_builddir);
if (virFileMakePath(abs_builddir "/securityselinuxlabeldata") < 0 ||
virFileTouch(path, 0600) < 0)
@@ -88,7 +88,7 @@ testSELinuxMungePath(char **path)
{
char *tmp;
- virAsprintf(&tmp, "%s/securityselinuxlabeldata%s", abs_builddir,
*path);
+ tmp = g_strdup_printf("%s/securityselinuxlabeldata%s", abs_builddir,
*path);
VIR_FREE(*path);
*path = tmp;
@@ -108,8 +108,8 @@ testSELinuxLoadFileList(const char *testname,
*files = NULL;
*nfiles = 0;
- virAsprintf(&path, "%s/securityselinuxlabeldata/%s.txt", abs_srcdir,
- testname);
+ path = g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", abs_srcdir,
+ testname);
if (!(fp = fopen(path, "r")))
goto cleanup;
@@ -135,8 +135,8 @@ testSELinuxLoadFileList(const char *testname,
*tmp = '\0';
tmp++;
- virAsprintf(&file, "%s/securityselinuxlabeldata%s", abs_builddir,
- line);
+ file = g_strdup_printf("%s/securityselinuxlabeldata%s", abs_builddir,
+ line);
if (*tmp != '\0' && *tmp != '\n') {
context = g_strdup(tmp);
@@ -172,8 +172,8 @@ testSELinuxLoadDef(const char *testname)
virDomainDefPtr def = NULL;
size_t i;
- virAsprintf(&xmlfile, "%s/securityselinuxlabeldata/%s.xml",
abs_srcdir,
- testname);
+ xmlfile = g_strdup_printf("%s/securityselinuxlabeldata/%s.xml",
abs_srcdir,
+ testname);
if (!(def = virDomainDefParseFile(xmlfile, driver.caps, driver.xmlopt,
NULL, 0)))
diff --git a/tests/storagebackendsheepdogtest.c b/tests/storagebackendsheepdogtest.c
index 7d50b1a303..c7dabd976b 100644
--- a/tests/storagebackendsheepdogtest.c
+++ b/tests/storagebackendsheepdogtest.c
@@ -158,11 +158,11 @@ mymain(void)
collie_test *test = node_info_tests;
- virAsprintf(&poolxml, "%s/storagepoolxml2xmlin/pool-sheepdog.xml",
- abs_srcdir);
+ poolxml = g_strdup_printf("%s/storagepoolxml2xmlin/pool-sheepdog.xml",
+ abs_srcdir);
- virAsprintf(&volxml, "%s/storagevolxml2xmlin/vol-sheepdog.xml",
- abs_srcdir);
+ volxml = g_strdup_printf("%s/storagevolxml2xmlin/vol-sheepdog.xml",
+ abs_srcdir);
#define DO_TEST_NODE(collie) \
do { \
diff --git a/tests/storagepoolcapstest.c b/tests/storagepoolcapstest.c
index 5f66a67da6..28b9f7d90a 100644
--- a/tests/storagepoolcapstest.c
+++ b/tests/storagepoolcapstest.c
@@ -62,8 +62,8 @@ test_virStoragePoolCapsFormat(const void *opaque)
if (!(poolCaps = virStoragePoolCapsNew(driverCaps)))
return -1;
- virAsprintf(&path, "%s/storagepoolcapsschemadata/poolcaps-%s.xml",
- abs_srcdir, data->filename);
+ path = g_strdup_printf("%s/storagepoolcapsschemadata/poolcaps-%s.xml",
+ abs_srcdir, data->filename);
if (!(poolCapsXML = virStoragePoolCapsFormat(poolCaps)))
return -1;
diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
index 50b79b4625..967d1f21a8 100644
--- a/tests/storagepoolxml2argvtest.c
+++ b/tests/storagepoolxml2argvtest.c
@@ -108,11 +108,11 @@ testCompareXMLToArgvHelper(const void *data)
g_autofree char *poolxml = NULL;
g_autofree char *cmdline = NULL;
- virAsprintf(&poolxml, "%s/storagepoolxml2xmlin/%s.xml", abs_srcdir,
- info->pool);
+ poolxml = g_strdup_printf("%s/storagepoolxml2xmlin/%s.xml", abs_srcdir,
+ info->pool);
- virAsprintf(&cmdline, "%s/storagepoolxml2argvdata/%s%s.argv",
- abs_srcdir, info->pool, info->platformSuffix);
+ cmdline = g_strdup_printf("%s/storagepoolxml2argvdata/%s%s.argv",
+ abs_srcdir, info->pool, info->platformSuffix);
return testCompareXMLToArgvFiles(info->shouldFail, poolxml, cmdline);
}
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index e4c78d3fd5..382a7c659f 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -39,10 +39,10 @@ testCompareXMLToXMLHelper(const void *data)
g_autofree char *inxml = NULL;
g_autofree char *outxml = NULL;
- virAsprintf(&inxml, "%s/storagepoolxml2xmlin/%s.xml",
- abs_srcdir, (const char*)data);
- virAsprintf(&outxml, "%s/storagepoolxml2xmlout/%s.xml",
- abs_srcdir, (const char*)data);
+ inxml = g_strdup_printf("%s/storagepoolxml2xmlin/%s.xml",
+ abs_srcdir, (const char*)data);
+ outxml = g_strdup_printf("%s/storagepoolxml2xmlout/%s.xml",
+ abs_srcdir, (const char*)data);
return testCompareXMLToXMLFiles(inxml, outxml);
}
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 833000a636..1832690e29 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -113,7 +113,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
if (!(cvtCmdline = virCommandToString(cmd, false)))
goto cleanup;
- virAsprintf(&actualCmdline, "%s\n%s", createCmdline,
cvtCmdline);
+ actualCmdline = g_strdup_printf("%s\n%s", createCmdline,
cvtCmdline);
VIR_FREE(createCmdline);
}
@@ -159,17 +159,17 @@ testCompareXMLToArgvHelper(const void *data)
g_autofree char *cmdline = NULL;
if (info->inputvol)
- virAsprintf(&inputvolxml, "%s/storagevolxml2xmlin/%s.xml",
- abs_srcdir, info->inputvol);
+ inputvolxml = g_strdup_printf("%s/storagevolxml2xmlin/%s.xml",
+ abs_srcdir, info->inputvol);
if (info->inputpool)
- virAsprintf(&inputpoolxml, "%s/storagepoolxml2xmlin/%s.xml",
- abs_srcdir, info->inputpool);
- virAsprintf(&poolxml, "%s/storagepoolxml2xmlin/%s.xml",
- abs_srcdir, info->pool);
- virAsprintf(&volxml, "%s/storagevolxml2xmlin/%s.xml",
- abs_srcdir, info->vol);
- virAsprintf(&cmdline, "%s/storagevolxml2argvdata/%s.argv",
- abs_srcdir, info->cmdline);
+ inputpoolxml = g_strdup_printf("%s/storagepoolxml2xmlin/%s.xml",
+ abs_srcdir, info->inputpool);
+ poolxml = g_strdup_printf("%s/storagepoolxml2xmlin/%s.xml",
+ abs_srcdir, info->pool);
+ volxml = g_strdup_printf("%s/storagevolxml2xmlin/%s.xml",
+ abs_srcdir, info->vol);
+ cmdline = g_strdup_printf("%s/storagevolxml2argvdata/%s.argv",
+ abs_srcdir, info->cmdline);
return testCompareXMLToArgvFiles(info->shouldFail, poolxml, volxml,
inputpoolxml, inputvolxml,
diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index 4e92d2818c..c65296c7eb 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -50,12 +50,12 @@ testCompareXMLToXMLHelper(const void *data)
g_autofree char *inxml = NULL;
g_autofree char *outxml = NULL;
- virAsprintf(&poolxml, "%s/storagepoolxml2xmlin/%s.xml",
- abs_srcdir, info->pool);
- virAsprintf(&inxml, "%s/storagevolxml2xmlin/%s.xml",
- abs_srcdir, info->name);
- virAsprintf(&outxml, "%s/storagevolxml2xmlout/%s.xml",
- abs_srcdir, info->name);
+ poolxml = g_strdup_printf("%s/storagepoolxml2xmlin/%s.xml",
+ abs_srcdir, info->pool);
+ inxml = g_strdup_printf("%s/storagevolxml2xmlin/%s.xml",
+ abs_srcdir, info->name);
+ outxml = g_strdup_printf("%s/storagevolxml2xmlout/%s.xml",
+ abs_srcdir, info->name);
return testCompareXMLToXMLFiles(poolxml, inxml, outxml, info->flags);
}
diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
index 4167d4baee..a8a0d0869e 100644
--- a/tests/sysinfotest.c
+++ b/tests/sysinfotest.c
@@ -91,13 +91,13 @@ sysinfotest_run(const char *test,
testdata.func = func;
if (decoder)
- virAsprintf(&testdata.decoder, "%s/%s", abs_srcdir, decoder);
+ testdata.decoder = g_strdup_printf("%s/%s", abs_srcdir, decoder);
if (sysinfo)
- virAsprintf(&testdata.sysinfo, "%s/%s", abs_srcdir, sysinfo);
+ testdata.sysinfo = g_strdup_printf("%s/%s", abs_srcdir, sysinfo);
if (cpuinfo)
- virAsprintf(&testdata.cpuinfo, "%s/%s", abs_srcdir, cpuinfo);
+ testdata.cpuinfo = g_strdup_printf("%s/%s", abs_srcdir, cpuinfo);
if (expected)
- virAsprintf(&testdata.expected, "%s/%s", abs_srcdir, expected);
+ testdata.expected = g_strdup_printf("%s/%s", abs_srcdir, expected);
if (virTestRun(test, testSysinfo, &testdata) < 0)
goto error;
diff --git a/tests/testutils.c b/tests/testutils.c
index 3ae66d3007..3116b1c5b9 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -404,7 +404,7 @@ virTestRewrapFile(const char *filename)
return -1;
}
- virAsprintf(&script, "%s/test-wrap-argv.pl", abs_srcdir);
+ script = g_strdup_printf("%s/test-wrap-argv.pl", abs_srcdir);
cmd = virCommandNewArgList(perl, script, "--in-place", filename, NULL);
if (virCommandRun(cmd, NULL) < 0)
@@ -663,7 +663,7 @@ virTestCompareToFile(const char *actual,
if (filecontentLen > 0 &&
filecontent[filecontentLen - 1] == '\n' &&
(cmpcontentLen == 0 || cmpcontent[cmpcontentLen - 1] != '\n')) {
- virAsprintf(&fixedcontent, "%s\n", cmpcontent);
+ fixedcontent = g_strdup_printf("%s\n", cmpcontent);
cmpcontent = fixedcontent;
}
}
@@ -689,9 +689,9 @@ virTestCompareToULL(unsigned long long expect,
g_autofree char *expectStr = NULL;
g_autofree char *actualStr = NULL;
- virAsprintf(&expectStr, "%llu", expect);
+ expectStr = g_strdup_printf("%llu", expect);
- virAsprintf(&actualStr, "%llu", actual);
+ actualStr = g_strdup_printf("%llu", actual);
return virTestCompareToString(expectStr, actualStr);
}
@@ -809,7 +809,7 @@ virTestSetEnvPath(void)
if (path) {
if (strstr(path, abs_builddir) != path)
- virAsprintf(&new_path, "%s:%s", abs_builddir, path);
+ new_path = g_strdup_printf("%s:%s", abs_builddir, path);
} else {
new_path = g_strdup(abs_builddir);
}
diff --git a/tests/testutils.h b/tests/testutils.h
index 36d2d5ba04..0088251dca 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -138,7 +138,7 @@ int virTestMain(int argc,
if (!preload) { \
newenv = (char *) lib; \
} else { \
- virAsprintf(&newenv, "%s:%s", lib, preload); \
+ newenv = g_strdup_printf("%s:%s", lib, preload); \
} \
setenv(PRELOAD_VAR, newenv, 1); \
FORCE_FLAT_NAMESPACE \
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 3b656cdd1e..fa73e18cb5 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -809,7 +809,7 @@ testQemuGetLatestCapsForArch(const char *arch,
const char *maxname = NULL;
char *ret = NULL;
- virAsprintf(&fullsuffix, "%s.%s", arch, suffix);
+ fullsuffix = g_strdup_printf("%s.%s", arch, suffix);
if (virDirOpen(&dir, TEST_QEMU_CAPS_PATH) < 0)
goto cleanup;
@@ -845,7 +845,7 @@ testQemuGetLatestCapsForArch(const char *arch,
goto cleanup;
}
- virAsprintf(&ret, "%s/%s", TEST_QEMU_CAPS_PATH, maxname);
+ ret = g_strdup_printf("%s/%s", TEST_QEMU_CAPS_PATH, maxname);
cleanup:
VIR_FREE(tmp);
@@ -1042,8 +1042,8 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
if (STREQ(capsver, "latest")) {
capsfile = g_strdup(virHashLookup(capslatest, capsarch));
stripmachinealiases = true;
- } else virAsprintf(&capsfile, "%s/caps_%s.%s.xml",
- TEST_QEMU_CAPS_PATH, capsver, capsarch);
+ } else capsfile = g_strdup_printf("%s/caps_%s.%s.xml",
+ TEST_QEMU_CAPS_PATH, capsver, capsarch);
if (!(qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(capsarch),
capsfile))) {
diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c
index fdc2c92719..db3ef3d550 100644
--- a/tests/vboxsnapshotxmltest.c
+++ b/tests/vboxsnapshotxmltest.c
@@ -104,8 +104,8 @@ testCompareXMLToXMLHelper(const void *data)
int result = -1;
char *xml = NULL;
- virAsprintf(&xml, "%s/vboxsnapshotxmldata/%s.vbox", abs_srcdir,
- (const char *)data);
+ xml = g_strdup_printf("%s/vboxsnapshotxmldata/%s.vbox", abs_srcdir,
+ (const char *)data);
result = testCompareXMLtoXMLFiles(xml);
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index 6bbd6545ac..9d69809268 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -31,7 +31,7 @@ static int testBufInfiniteLoop(const void *data)
* This test is a bit fragile, since it relies on virBuffer internals.
*/
len = buf->size - buf->use - 1;
- virAsprintf(&addstr, "%*s", len, "a");
+ addstr = g_strdup_printf("%*s", len, "a");
if (info->doEscape)
virBufferEscapeString(buf, "%s", addstr);
diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index c0a1ef2e2b..32c8f95303 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -45,11 +45,11 @@ test_virCapabilities(const void *opaque)
char *resctrl = NULL;
int ret = -1;
- virAsprintf(&system, "%s/vircaps2xmldata/linux-%s/system", abs_srcdir,
- data->filename);
+ system = g_strdup_printf("%s/vircaps2xmldata/linux-%s/system", abs_srcdir,
+ data->filename);
- virAsprintf(&resctrl, "%s/vircaps2xmldata/linux-%s/resctrl",
abs_srcdir,
- data->filename);
+ resctrl = g_strdup_printf("%s/vircaps2xmldata/linux-%s/resctrl",
abs_srcdir,
+ data->filename);
virFileWrapperAddPrefix("/sys/devices/system", system);
virFileWrapperAddPrefix("/sys/fs/resctrl", resctrl);
@@ -67,8 +67,8 @@ test_virCapabilities(const void *opaque)
if (!(capsXML = virCapabilitiesFormatXML(caps)))
goto cleanup;
- virAsprintf(&path, "%s/vircaps2xmldata/vircaps-%s-%s.xml", abs_srcdir,
- archStr, data->filename);
+ path = g_strdup_printf("%s/vircaps2xmldata/vircaps-%s-%s.xml", abs_srcdir,
+ archStr, data->filename);
if (virTestCompareToFile(capsXML, path) < 0)
goto cleanup;
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
index 1735852f39..3168b689f2 100644
--- a/tests/vircgroupmock.c
+++ b/tests/vircgroupmock.c
@@ -376,8 +376,8 @@ static void init_sysfs(void)
VIR_FREE(fakesysfscgroupdir);
- virAsprintf(&fakesysfscgroupdir, "%s%s",
- fakerootdir, SYSFS_CGROUP_PREFIX);
+ fakesysfscgroupdir = g_strdup_printf("%s%s",
+ fakerootdir, SYSFS_CGROUP_PREFIX);
if (virFileMakePath(fakesysfscgroupdir) < 0) {
fprintf(stderr, "Cannot create %s\n", fakesysfscgroupdir);
@@ -458,8 +458,8 @@ FILE *fopen(const char *path, const char *mode)
errno = EACCES;
return NULL;
}
- virAsprintf(&filepath, "%s/vircgroupdata/%s.%s",
- abs_srcdir, filename, type);
+ filepath = g_strdup_printf("%s/vircgroupdata/%s.%s",
+ abs_srcdir, filename, type);
rc = real_fopen(filepath, mode);
free(filepath);
return rc;
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index 224e8116dd..07f53f1857 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -189,7 +189,7 @@ testCgroupDetectMounts(const void *args)
setenv("VIR_CGROUP_MOCK_FILENAME", data->file, 1);
- virAsprintf(&parsed, "%s/vircgroupdata/%s.parsed", abs_srcdir,
data->file);
+ parsed = g_strdup_printf("%s/vircgroupdata/%s.parsed", abs_srcdir,
data->file);
if (virCgroupNewSelf(&group) < 0) {
if (data->fail)
diff --git a/tests/virconftest.c b/tests/virconftest.c
index c6d8ff2272..83077342a9 100644
--- a/tests/virconftest.c
+++ b/tests/virconftest.c
@@ -39,8 +39,8 @@ static int testConfRoundTrip(const void *opaque)
char *srcfile = NULL;
char *dstfile = NULL;
- virAsprintf(&srcfile, "%s/virconfdata/%s.conf", abs_srcdir, name);
- virAsprintf(&dstfile, "%s/virconfdata/%s.out", abs_srcdir, name);
+ srcfile = g_strdup_printf("%s/virconfdata/%s.conf", abs_srcdir, name);
+ dstfile = g_strdup_printf("%s/virconfdata/%s.out", abs_srcdir, name);
if (VIR_ALLOC_N_QUIET(buffer, len) < 0) {
fprintf(stderr, "out of memory\n");
diff --git a/tests/virfilemock.c b/tests/virfilemock.c
index bb5fcc2ed8..65685c6d26 100644
--- a/tests/virfilemock.c
+++ b/tests/virfilemock.c
@@ -188,7 +188,7 @@ canonicalize_file_name(const char *path)
char *ret;
if ((p = STRSKIP(path, "/some/symlink")))
- virAsprintf(&ret, "/gluster%s", p);
+ ret = g_strdup_printf("/gluster%s", p);
else
ret = g_strdup(path);
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index ba947129be..c7d5f6abeb 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -325,7 +325,7 @@ testFileIsSharedFSType(const void *opaque G_GNUC_UNUSED)
bool actual;
int ret = -1;
- virAsprintf(&mtabFile, abs_srcdir "/virfiledata/%s",
data->mtabFile);
+ mtabFile = g_strdup_printf(abs_srcdir "/virfiledata/%s",
data->mtabFile);
if (setenv("LIBVIRT_MTAB", mtabFile, 1) < 0) {
fprintf(stderr, "Unable to set env variable\n");
diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index e3d3c225ad..0500a3617e 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -124,7 +124,7 @@ virMockStatRedirect(const char *path, char **newpath)
if (!tmp)
continue;
- virAsprintf(newpath, "%s%s", overrides[i], tmp);
+ *newpath = g_strdup_printf("%s%s", overrides[i], tmp);
break;
}
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index 7b1b1a6d89..01ba745338 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -55,12 +55,12 @@ linuxTestCompareFiles(const char *cpuinfofile,
}
VIR_FORCE_FCLOSE(cpuinfo);
- virAsprintf(&actualData,
- "CPUs: %u/%u, MHz: %u, Nodes: %u, Sockets: %u, "
- "Cores: %u, Threads: %u\n",
- nodeinfo.cpus, VIR_NODEINFO_MAXCPUS(nodeinfo),
- nodeinfo.mhz, nodeinfo.nodes, nodeinfo.sockets,
- nodeinfo.cores, nodeinfo.threads);
+ actualData = g_strdup_printf(
+ "CPUs: %u/%u, MHz: %u, Nodes: %u, Sockets: %u,
"
+ "Cores: %u, Threads: %u\n",
+ nodeinfo.cpus, VIR_NODEINFO_MAXCPUS(nodeinfo),
+ nodeinfo.mhz, nodeinfo.nodes, nodeinfo.sockets,
+ nodeinfo.cores, nodeinfo.threads);
if (virTestCompareToFile(actualData, outputfile) < 0)
goto fail;
@@ -176,12 +176,12 @@ linuxTestHostCPU(const void *opaque)
struct linuxTestHostCPUData *data = (struct linuxTestHostCPUData *) opaque;
const char *archStr = virArchToString(data->arch);
- virAsprintf(&sysfs_prefix, "%s/virhostcpudata/linux-%s",
- abs_srcdir, data->testName);
- virAsprintf(&cpuinfo, "%s/virhostcpudata/linux-%s-%s.cpuinfo",
- abs_srcdir, archStr, data->testName);
- virAsprintf(&output, "%s/virhostcpudata/linux-%s-%s.expected",
- abs_srcdir, archStr, data->testName);
+ sysfs_prefix = g_strdup_printf("%s/virhostcpudata/linux-%s",
+ abs_srcdir, data->testName);
+ cpuinfo = g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo",
+ abs_srcdir, archStr, data->testName);
+ output = g_strdup_printf("%s/virhostcpudata/linux-%s-%s.expected",
+ abs_srcdir, archStr, data->testName);
virFileWrapperAddPrefix(SYSFS_SYSTEM_PATH, sysfs_prefix);
result = linuxTestCompareFiles(cpuinfo, data->arch, output);
@@ -207,10 +207,10 @@ linuxTestNodeCPUStats(const void *data)
char *cpustatfile = NULL;
char *outfile = NULL;
- virAsprintf(&cpustatfile, "%s/virhostcpudata/linux-cpustat-%s.stat",
- abs_srcdir, testData->name);
- virAsprintf(&outfile, "%s/virhostcpudata/linux-cpustat-%s.out",
- abs_srcdir, testData->name);
+ cpustatfile = g_strdup_printf("%s/virhostcpudata/linux-cpustat-%s.stat",
+ abs_srcdir, testData->name);
+ outfile = g_strdup_printf("%s/virhostcpudata/linux-cpustat-%s.out",
+ abs_srcdir, testData->name);
result = linuxCPUStatsCompareFiles(cpustatfile,
testData->ncpus,
diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index 75c70a49c9..9da0f9c90d 100644
--- a/tests/virjsontest.c
+++ b/tests/virjsontest.c
@@ -26,10 +26,10 @@ testJSONFromFile(const void *data)
g_autofree char *outfile = NULL;
g_autofree char *actual = NULL;
- virAsprintf(&infile, "%s/virjsondata/parse-%s-in.json",
- abs_srcdir, info->name);
- virAsprintf(&outfile, "%s/virjsondata/parse-%s-out.json",
- abs_srcdir, info->name);
+ infile = g_strdup_printf("%s/virjsondata/parse-%s-in.json",
+ abs_srcdir, info->name);
+ outfile = g_strdup_printf("%s/virjsondata/parse-%s-out.json",
+ abs_srcdir, info->name);
if (virTestLoadFile(infile, &indata) < 0)
return -1;
@@ -113,10 +113,10 @@ testJSONAddRemove(const void *data)
g_autofree char *outfile = NULL;
g_autofree char *actual = NULL;
- virAsprintf(&infile, "%s/virjsondata/add-remove-%s-in.json",
- abs_srcdir, info->name);
- virAsprintf(&outfile, "%s/virjsondata/add-remove-%s-out.json",
- abs_srcdir, info->name);
+ infile = g_strdup_printf("%s/virjsondata/add-remove-%s-in.json",
+ abs_srcdir, info->name);
+ outfile = g_strdup_printf("%s/virjsondata/add-remove-%s-out.json",
+ abs_srcdir, info->name);
if (virTestLoadFile(infile, &indata) < 0)
return -1;
@@ -348,10 +348,10 @@ testJSONDeflatten(const void *data)
g_autofree char *outfile = NULL;
g_autofree char *actual = NULL;
- virAsprintf(&infile, "%s/virjsondata/deflatten-%s-in.json",
- abs_srcdir, info->name);
- virAsprintf(&outfile, "%s/virjsondata/deflatten-%s-out.json",
- abs_srcdir, info->name);
+ infile = g_strdup_printf("%s/virjsondata/deflatten-%s-in.json",
+ abs_srcdir, info->name);
+ outfile = g_strdup_printf("%s/virjsondata/deflatten-%s-out.json",
+ abs_srcdir, info->name);
if (virTestLoadFile(infile, &indata) < 0)
return -1;
diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c
index 17880728e7..69d75dfa34 100644
--- a/tests/virmacmaptest.c
+++ b/tests/virmacmaptest.c
@@ -41,7 +41,7 @@ testMACLookup(const void *opaque)
char *file = NULL;
int ret = -1;
- virAsprintf(&file, "%s/virmacmaptestdata/%s.json", abs_srcdir,
data->file);
+ file = g_strdup_printf("%s/virmacmaptestdata/%s.json", abs_srcdir,
data->file);
if (!(mgr = virMacMapNew(file)))
goto cleanup;
@@ -92,7 +92,7 @@ testMACRemove(const void *opaque)
char *file = NULL;
int ret = -1;
- virAsprintf(&file, "%s/virmacmaptestdata/%s.json", abs_srcdir,
data->file);
+ file = g_strdup_printf("%s/virmacmaptestdata/%s.json", abs_srcdir,
data->file);
if (!(mgr = virMacMapNew(file)))
goto cleanup;
@@ -127,7 +127,7 @@ testMACFlush(const void *opaque)
char *str = NULL;
int ret = -1;
- virAsprintf(&file, "%s/virmacmaptestdata/%s.json", abs_srcdir,
data->file);
+ file = g_strdup_printf("%s/virmacmaptestdata/%s.json", abs_srcdir,
data->file);
if (virMacMapDumpStr(data->mgr, &str) < 0)
goto cleanup;
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 2dfa04e83f..825487f0a1 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -295,11 +295,11 @@ static int testExecRestart(const void *opaque)
goto cleanup;
}
- virAsprintf(&infile, "%s/virnetdaemondata/input-data-%s.json",
abs_srcdir,
- data->jsonfile);
+ infile = g_strdup_printf("%s/virnetdaemondata/input-data-%s.json",
abs_srcdir,
+ data->jsonfile);
- virAsprintf(&outfile, "%s/virnetdaemondata/output-data-%s.json",
- abs_srcdir, data->jsonfile);
+ outfile = g_strdup_printf("%s/virnetdaemondata/output-data-%s.json",
+ abs_srcdir, data->jsonfile);
if (virFileReadAll(infile, 8192, &injsonstr) < 0)
goto cleanup;
diff --git a/tests/virnetdevmock.c b/tests/virnetdevmock.c
index 8834b2ca6a..f26991a48c 100644
--- a/tests/virnetdevmock.c
+++ b/tests/virnetdevmock.c
@@ -30,8 +30,8 @@ virNetDevSysfsFile(char **pf_sysfs_device_link,
const char *ifname,
const char *file)
{
- virAsprintf(pf_sysfs_device_link, "%s/%s/%s",
- NET_DEV_TEST_DATA_PREFIX, ifname, file);
+ *pf_sysfs_device_link = g_strdup_printf("%s/%s/%s",
+ NET_DEV_TEST_DATA_PREFIX, ifname, file);
return 0;
}
#else
diff --git a/tests/virnetdevopenvswitchtest.c b/tests/virnetdevopenvswitchtest.c
index 7b814474b7..fd47e927ea 100644
--- a/tests/virnetdevopenvswitchtest.c
+++ b/tests/virnetdevopenvswitchtest.c
@@ -38,8 +38,8 @@ testInterfaceParseStats(const void *opaque)
g_autofree char *buf = NULL;
virDomainInterfaceStatsStruct actual;
- virAsprintf(&filename, "%s/virnetdevopenvswitchdata/%s", abs_srcdir,
- data->filename);
+ filename = g_strdup_printf("%s/virnetdevopenvswitchdata/%s", abs_srcdir,
+ data->filename);
if (virFileReadAll(filename, 1024, &buf) < 0)
return -1;
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 29568eea1a..4e9f201e45 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -196,7 +196,7 @@ testSocketAccept(const void *opaque)
VIR_WARN("Failed to create temporary directory");
goto cleanup;
}
- virAsprintf(&path, "%s/test.sock", tmpdir);
+ path = g_strdup_printf("%s/test.sock", tmpdir);
if (virNetSocketNewListenUNIX(path, 0700, -1, getegid(), &usock) < 0)
goto cleanup;
@@ -320,7 +320,7 @@ static int testSocketUNIXAddrs(const void *data G_GNUC_UNUSED)
VIR_WARN("Failed to create temporary directory");
goto cleanup;
}
- virAsprintf(&path, "%s/test.sock", tmpdir);
+ path = g_strdup_printf("%s/test.sock", tmpdir);
if (virNetSocketNewListenUNIX(path, 0700, -1, getegid(), &lsock) < 0)
goto cleanup;
diff --git a/tests/virnetworkportxml2xmltest.c b/tests/virnetworkportxml2xmltest.c
index 89f9de0c17..1b2175dd9d 100644
--- a/tests/virnetworkportxml2xmltest.c
+++ b/tests/virnetworkportxml2xmltest.c
@@ -66,8 +66,8 @@ testCompareXMLToXMLHelper(const void *data)
int ret = -1;
char *xml = NULL;
- virAsprintf(&xml, "%s/virnetworkportxml2xmldata/%s.xml", abs_srcdir,
- info->name);
+ xml = g_strdup_printf("%s/virnetworkportxml2xmldata/%s.xml", abs_srcdir,
+ info->name);
ret = testCompareXMLToXMLFiles(xml);
diff --git a/tests/virnumamock.c b/tests/virnumamock.c
index 4a52483a7f..e6282c7f33 100644
--- a/tests/virnumamock.c
+++ b/tests/virnumamock.c
@@ -43,7 +43,7 @@ virNumaIsAvailable(void)
if (numa_avail < 0) {
char *sysfs_node_path = NULL;
- virAsprintf(&sysfs_node_path, "%s/node", SYSFS_SYSTEM_PATH);
+ sysfs_node_path = g_strdup_printf("%s/node", SYSFS_SYSTEM_PATH);
numa_avail = virFileExists(sysfs_node_path);
diff --git a/tests/virnwfilterbindingxml2xmltest.c
b/tests/virnwfilterbindingxml2xmltest.c
index d5ace8f89f..3360dd28d3 100644
--- a/tests/virnwfilterbindingxml2xmltest.c
+++ b/tests/virnwfilterbindingxml2xmltest.c
@@ -72,8 +72,8 @@ testCompareXMLToXMLHelper(const void *data)
const test_parms *tp = data;
char *xml = NULL;
- virAsprintf(&xml, "%s/virnwfilterbindingxml2xmldata/%s.xml",
abs_srcdir,
- tp->name);
+ xml = g_strdup_printf("%s/virnwfilterbindingxml2xmldata/%s.xml",
abs_srcdir,
+ tp->name);
result = testCompareXMLToXMLFiles(xml);
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 67107450e6..0d502db68c 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -186,7 +186,7 @@ make_file(const char *path,
if (value && len == -1)
len = strlen(value);
- virAsprintf(&filepath, "%s/%s", path, name);
+ filepath = g_strdup_printf("%s/%s", path, name);
if ((fd = real_open(filepath, O_CREAT|O_WRONLY, 0666)) < 0)
ABORT("Unable to open: %s", filepath);
@@ -203,7 +203,7 @@ make_dir(const char *path,
{
g_autofree char *dirpath = NULL;
- virAsprintf(&dirpath, "%s/%s", path, name);
+ dirpath = g_strdup_printf("%s/%s", path, name);
if (virFileMakePath(dirpath) < 0)
ABORT("Unable to create: %s", dirpath);
@@ -216,7 +216,7 @@ make_symlink(const char *path,
{
g_autofree char *filepath = NULL;
- virAsprintf(&filepath, "%s/%s", path, name);
+ filepath = g_strdup_printf("%s/%s", path, name);
if (symlink(target, filepath) < 0)
ABORT("Unable to create symlink filepath -> target");
@@ -232,7 +232,7 @@ pci_read_file(const char *path,
int fd = -1;
g_autofree char *newpath = NULL;
- virAsprintf(&newpath, "%s/%s", fakerootdir, path);
+ newpath = g_strdup_printf("%s/%s", fakerootdir, path);
if ((fd = real_open(newpath, O_RDWR)) < 0)
goto cleanup;
@@ -269,13 +269,13 @@ getrealpath(char **newpath,
init_env();
if (STRPREFIX(path, SYSFS_PCI_PREFIX)) {
- virAsprintf(newpath, "%s/sys/bus/pci/%s",
- fakerootdir,
- path + strlen(SYSFS_PCI_PREFIX));
+ *newpath = g_strdup_printf("%s/sys/bus/pci/%s",
+ fakerootdir,
+ path + strlen(SYSFS_PCI_PREFIX));
} else if (pathPrefixIsMocked(path)) {
- virAsprintf(newpath, "%s/%s",
- fakerootdir,
- path);
+ *newpath = g_strdup_printf("%s/%s",
+ fakerootdir,
+ path);
} else {
*newpath = g_strdup(path);
}
@@ -356,9 +356,9 @@ pci_address_format(struct pciDeviceAddress const *addr)
{
char *ret;
- virAsprintf(&ret, ADDR_STR_FMT,
- addr->domain, addr->bus,
- addr->device, addr->function);
+ ret = g_strdup_printf(ADDR_STR_FMT,
+ addr->domain, addr->bus,
+ addr->device, addr->function);
return ret;
}
@@ -393,13 +393,13 @@ pci_device_get_path(const struct pciDevice *dev,
* and then they are just symlinked to /sys/bus/pci/devices/
*/
if (file) {
- virAsprintf(&ret, "%s/sys/devices/pci%04x:%02x/%s/%s",
- prefix, dev->addr.domain, dev->addr.bus,
- devid, file);
+ ret = g_strdup_printf("%s/sys/devices/pci%04x:%02x/%s/%s",
+ prefix, dev->addr.domain, dev->addr.bus,
+ devid, file);
} else {
- virAsprintf(&ret, "%s/sys/devices/pci%04x:%02x/%s",
- prefix, dev->addr.domain, dev->addr.bus,
- devid);
+ ret = g_strdup_printf("%s/sys/devices/pci%04x:%02x/%s",
+ prefix, dev->addr.domain, dev->addr.bus,
+ devid);
}
return ret;
@@ -415,8 +415,8 @@ pci_device_create_iommu(const struct pciDevice *dev,
char tmp[256];
size_t i;
- virAsprintf(&iommuPath, "%s/sys/kernel/iommu_groups/%d/devices/",
- fakerootdir, dev->iommuGroup);
+ iommuPath = g_strdup_printf("%s/sys/kernel/iommu_groups/%d/devices/",
+ fakerootdir, dev->iommuGroup);
if (virFileMakePath(iommuPath) < 0)
ABORT("Unable to create: %s", iommuPath);
@@ -482,7 +482,7 @@ pci_device_new_from_stub(const struct pciDevice *data)
if (VIR_ALLOC_QUIET(dev) < 0)
ABORT_OOM();
- virAsprintf(&configSrc, "%s/virpcitestdata/%s.config", abs_srcdir,
id);
+ configSrc = g_strdup_printf("%s/virpcitestdata/%s.config", abs_srcdir,
id);
memcpy(dev, data, sizeof(*dev));
@@ -544,7 +544,7 @@ pci_device_new_from_stub(const struct pciDevice *data)
ABORT("@tmp overflow");
}
- virAsprintf(&devsympath, "%s" SYSFS_PCI_PREFIX "devices",
fakerootdir);
+ devsympath = g_strdup_printf("%s" SYSFS_PCI_PREFIX "devices",
fakerootdir);
make_symlink(devsympath, devid, tmp);
@@ -625,9 +625,9 @@ pci_vfio_release_iommu(struct pciDevice *device)
pciIommuGroups[i]->nDevicesBoundToVFIO--;
if (!pciIommuGroups[i]->nDevicesBoundToVFIO) {
- virAsprintf(&vfiopath, "%s/dev/vfio/%d",
- fakerootdir,
- device->iommuGroup);
+ vfiopath = g_strdup_printf("%s/dev/vfio/%d",
+ fakerootdir,
+ device->iommuGroup);
if (unlink(vfiopath) < 0)
return -1;
@@ -651,9 +651,9 @@ pci_vfio_lock_iommu(struct pciDevice *device)
continue;
if (pciIommuGroups[i]->nDevicesBoundToVFIO == 0) {
- virAsprintf(&vfiopath, "%s/dev/vfio/%d",
- fakerootdir,
- device->iommuGroup);
+ vfiopath = g_strdup_printf("%s/dev/vfio/%d",
+ fakerootdir,
+ device->iommuGroup);
if ((fd = real_open(vfiopath, O_CREAT)) < 0)
goto cleanup;
@@ -685,11 +685,11 @@ pci_driver_get_path(const struct pciDriver *driver,
prefix = fakerootdir;
if (file) {
- virAsprintf(&ret, "%s" SYSFS_PCI_PREFIX "drivers/%s/%s",
- prefix, driver->name, file);
+ ret = g_strdup_printf("%s" SYSFS_PCI_PREFIX "drivers/%s/%s",
+ prefix, driver->name, file);
} else {
- virAsprintf(&ret, "%s" SYSFS_PCI_PREFIX "drivers/%s",
- prefix, driver->name);
+ ret = g_strdup_printf("%s" SYSFS_PCI_PREFIX "drivers/%s",
+ prefix, driver->name);
}
return ret;
@@ -971,7 +971,7 @@ init_env(void)
if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR")))
ABORT("Missing LIBVIRT_FAKE_ROOT_DIR env variable\n");
- virAsprintf(&tmp, "%s%s", fakerootdir, SYSFS_PCI_PREFIX);
+ tmp = g_strdup_printf("%s%s", fakerootdir, SYSFS_PCI_PREFIX);
if (virFileMakePath(tmp) < 0)
ABORT("Unable to create: %s", tmp);
@@ -982,7 +982,7 @@ init_env(void)
/* Create /dev/vfio/ dir and /dev/vfio/vfio file */
VIR_FREE(tmp);
- virAsprintf(&tmp, "%s/dev/vfio", fakerootdir);
+ tmp = g_strdup_printf("%s/dev/vfio", fakerootdir);
if (virFileMakePath(tmp) < 0)
ABORT("Unable to create: %s", tmp);
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 20eb2caea9..0bac23cb23 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -349,8 +349,8 @@ mymain(void)
domain, bus, slot, function, NULL \
}; \
char *label = NULL; \
- virAsprintf(&label, "%s(%04x:%02x:%02x.%x)", \
- #fnc, domain, bus, slot, function); \
+ label = g_strdup_printf("%s(%04x:%02x:%02x.%x)", \
+#fnc, domain, bus, slot, function); \
if (virTestRun(label, fnc, &data) < 0) \
ret = -1; \
VIR_FREE(label); \
@@ -362,9 +362,9 @@ mymain(void)
domain, bus, slot, function, driver \
}; \
char *label = NULL; \
- virAsprintf(&label, "PCI driver %04x:%02x:%02x.%x is %s", \
- domain, bus, slot, function, \
- NULLSTR(driver)); \
+ label = g_strdup_printf("PCI driver %04x:%02x:%02x.%x is %s", \
+ domain, bus, slot, function, \
+ NULLSTR(driver)); \
if (virTestRun(label, testVirPCIDeviceCheckDriverTest, \
&data) < 0) \
ret = -1; \
diff --git a/tests/virrandommock.c b/tests/virrandommock.c
index eff72a8aa7..6dd15213e3 100644
--- a/tests/virrandommock.c
+++ b/tests/virrandommock.c
@@ -53,8 +53,8 @@ uint64_t virRandomBits(int nbits)
int virRandomGenerateWWN(char **wwn,
const char *virt_type G_GNUC_UNUSED)
{
- virAsprintf(wwn, "5100000%09llx",
- (unsigned long long)virRandomBits(36));
+ *wwn = g_strdup_printf("5100000%09llx",
+ (unsigned long long)virRandomBits(36));
return 0;
}
diff --git a/tests/virresctrltest.c b/tests/virresctrltest.c
index 71870e9f3f..bb6d0fe48e 100644
--- a/tests/virresctrltest.c
+++ b/tests/virresctrltest.c
@@ -26,14 +26,14 @@ test_virResctrlGetUnused(const void *opaque)
char *schemata_file;
virCapsPtr caps = NULL;
- virAsprintf(&system_dir, "%s/vircaps2xmldata/linux-%s/system",
abs_srcdir,
- data->filename);
+ system_dir = g_strdup_printf("%s/vircaps2xmldata/linux-%s/system",
abs_srcdir,
+ data->filename);
- virAsprintf(&resctrl_dir, "%s/vircaps2xmldata/linux-%s/resctrl",
- abs_srcdir, data->filename);
+ resctrl_dir = g_strdup_printf("%s/vircaps2xmldata/linux-%s/resctrl",
+ abs_srcdir, data->filename);
- virAsprintf(&schemata_file, "%s/virresctrldata/%s.schemata",
abs_srcdir,
- data->filename);
+ schemata_file = g_strdup_printf("%s/virresctrldata/%s.schemata",
abs_srcdir,
+ data->filename);
virFileWrapperAddPrefix("/sys/devices/system", system_dir);
virFileWrapperAddPrefix("/sys/fs/resctrl", resctrl_dir);
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 1370068601..c301b37a9d 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -87,9 +87,9 @@ testSchemaDir(const char *schema,
if (ent->d_name[0] == '.')
continue;
- virAsprintf(&xml_path, "%s/%s", dir_path, ent->d_name);
+ xml_path = g_strdup_printf("%s/%s", dir_path, ent->d_name);
- virAsprintf(&test_name, "Checking %s against %s", ent->d_name,
schema);
+ test_name = g_strdup_printf("Checking %s against %s", ent->d_name,
schema);
data.xml_path = xml_path;
if (virTestRun(test_name, testSchemaFile, &data) < 0)
@@ -120,7 +120,7 @@ testSchemaDirs(const char *schema, virXMLValidatorPtr validator, ...)
va_start(args, validator);
while ((dir = va_arg(args, char *))) {
- virAsprintf(&dir_path, "%s/%s", abs_srcdir, dir);
+ dir_path = g_strdup_printf("%s/%s", abs_srcdir, dir);
if (testSchemaDir(schema, validator, dir_path) < 0)
ret = -1;
VIR_FREE(dir_path);
@@ -139,8 +139,8 @@ testSchemaGrammar(const void *opaque)
char *schema_path;
int ret = -1;
- virAsprintf(&schema_path, "%s/docs/schemas/%s", abs_top_srcdir,
- data->schema);
+ schema_path = g_strdup_printf("%s/docs/schemas/%s", abs_top_srcdir,
+ data->schema);
if (!(data->validator = virXMLValidatorInit(schema_path)))
goto cleanup;
diff --git a/tests/virscsitest.c b/tests/virscsitest.c
index 0d2ddd3b6a..4d40f2bb82 100644
--- a/tests/virscsitest.c
+++ b/tests/virscsitest.c
@@ -167,9 +167,9 @@ create_symlink(const char *tmpdir, const char *src_name, const char
*dst_name)
char *src_path = NULL;
char *dst_path = NULL;
- virAsprintf(&src_path, "%s/%s", virscsi_prefix, src_name);
+ src_path = g_strdup_printf("%s/%s", virscsi_prefix, src_name);
- virAsprintf(&dst_path, "%s/%s", tmpdir, dst_name);
+ dst_path = g_strdup_printf("%s/%s", tmpdir, dst_name);
if (symlink(src_path, dst_path) < 0) {
VIR_WARN("Failed to create symlink '%s' to '%s'",
src_path, dst_path);
@@ -192,7 +192,7 @@ mymain(void)
char *tmpdir = NULL;
char template[] = "/tmp/libvirt_XXXXXX";
- virAsprintf(&virscsi_prefix, "%s" VIR_SCSI_DATA, abs_srcdir);
+ virscsi_prefix = g_strdup_printf("%s" VIR_SCSI_DATA, abs_srcdir);
tmpdir = mkdtemp(template);
diff --git a/tests/virshtest.c b/tests/virshtest.c
index 475933a93c..189238b826 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -252,8 +252,8 @@ mymain(void)
{
int ret = 0;
- virAsprintf(&custom_uri,
"test://%s/../examples/xml/test/testnode.xml",
- abs_srcdir);
+ custom_uri =
g_strdup_printf("test://%s/../examples/xml/test/testnode.xml",
+ abs_srcdir);
if (virTestRun("virsh list (default)",
testCompareListDefault, NULL) != 0)
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index af1b4fc43f..f0de35dd83 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -138,12 +138,12 @@ testPrepImages(void)
compat = true;
VIR_FREE(buf);
- virAsprintf(&absraw, "%s/raw", datadir);
- virAsprintf(&absqcow2, "%s/qcow2", datadir);
- virAsprintf(&abswrap, "%s/wrap", datadir);
- virAsprintf(&absqed, "%s/qed", datadir);
- virAsprintf(&absdir, "%s/dir", datadir);
- virAsprintf(&abslink2, "%s/sub/link2", datadir);
+ absraw = g_strdup_printf("%s/raw", datadir);
+ absqcow2 = g_strdup_printf("%s/qcow2", datadir);
+ abswrap = g_strdup_printf("%s/wrap", datadir);
+ absqed = g_strdup_printf("%s/qed", datadir);
+ absdir = g_strdup_printf("%s/dir", datadir);
+ abslink2 = g_strdup_printf("%s/sub/link2", datadir);
if (virFileMakePath(datadir "/sub") < 0) {
fprintf(stderr, "unable to create directory %s\n", datadir
"/sub");
@@ -159,7 +159,7 @@ testPrepImages(void)
goto cleanup;
}
- virAsprintf(&buf, "%1024d", 0);
+ buf = g_strdup_printf("%1024d", 0);
if (virFileWriteStr("raw", buf, 0600) < 0) {
fprintf(stderr, "unable to create raw file\n");
goto cleanup;
@@ -321,28 +321,28 @@ testStorageChain(const void *args)
return -1;
}
- virAsprintf(&expect,
- testStorageChainFormat, i,
- NULLSTR(data->files[i]->path),
- NULLSTR(data->files[i]->expBackingStoreRaw),
- data->files[i]->expCapacity,
- data->files[i]->expEncrypted,
- NULLSTR(data->files[i]->pathRel),
- data->files[i]->type,
- data->files[i]->format,
- virStorageNetProtocolTypeToString(data->files[i]->protocol),
- NULLSTR(data->files[i]->hostname));
- virAsprintf(&actual,
- testStorageChainFormat, i,
- NULLSTR(elt->path),
- NULLSTR(elt->backingStoreRaw),
- elt->capacity,
- !!elt->encryption,
- NULLSTR(elt->relPath),
- elt->type,
- elt->format,
- virStorageNetProtocolTypeToString(elt->protocol),
- NULLSTR(elt->nhosts ? elt->hosts[0].name : NULL));
+ expect = g_strdup_printf(
+ testStorageChainFormat, i,
+ NULLSTR(data->files[i]->path),
+ NULLSTR(data->files[i]->expBackingStoreRaw),
+ data->files[i]->expCapacity,
+ data->files[i]->expEncrypted,
+ NULLSTR(data->files[i]->pathRel),
+ data->files[i]->type,
+ data->files[i]->format,
+
virStorageNetProtocolTypeToString(data->files[i]->protocol),
+ NULLSTR(data->files[i]->hostname));
+ actual = g_strdup_printf(
+ testStorageChainFormat, i,
+ NULLSTR(elt->path),
+ NULLSTR(elt->backingStoreRaw),
+ elt->capacity,
+ !!elt->encryption,
+ NULLSTR(elt->relPath),
+ elt->type,
+ elt->format,
+ virStorageNetProtocolTypeToString(elt->protocol),
+ NULLSTR(elt->nhosts ? elt->hosts[0].name :
NULL));
if (STRNEQ(expect, actual)) {
virTestDifference(stderr, expect, actual);
return -1;
diff --git a/tests/virtestmock.c b/tests/virtestmock.c
index 116a6ad400..046898dbe1 100644
--- a/tests/virtestmock.c
+++ b/tests/virtestmock.c
@@ -110,7 +110,7 @@ checkPath(const char *path,
char *crippledPath = NULL;
if (path[0] != '/')
- virAsprintf(&relPath, "./%s", path);
+ relPath = g_strdup_printf("./%s", path);
/* Le sigh. virFileCanonicalizePath() expects @path to exist, otherwise
* it will return an error. So if we are called over an non-existent
diff --git a/tests/virusbmock.c b/tests/virusbmock.c
index 1b0beb81cb..57c9611e54 100644
--- a/tests/virusbmock.c
+++ b/tests/virusbmock.c
@@ -54,7 +54,7 @@ static char *get_fake_path(const char *real_path)
char *path = NULL;
if ((p = STRSKIP(real_path, USB_SYSFS)))
- virAsprintf(&path, "%s/%s/%s", abs_srcdir, FAKE_USB_SYSFS, p);
+ path = g_strdup_printf("%s/%s/%s", abs_srcdir, FAKE_USB_SYSFS, p);
else if (!p)
path = g_strdup(real_path);
diff --git a/tests/virusbtest.c b/tests/virusbtest.c
index 94c55e1fb8..7df4e3aec3 100644
--- a/tests/virusbtest.c
+++ b/tests/virusbtest.c
@@ -52,8 +52,8 @@ static int testDeviceFileActor(virUSBDevicePtr dev,
char *str = NULL;
int ret = 0;
- virAsprintf(&str, USB_DEVFS "%03d/%03d", virUSBDeviceGetBus(dev),
- virUSBDeviceGetDevno(dev));
+ str = g_strdup_printf(USB_DEVFS "%03d/%03d", virUSBDeviceGetBus(dev),
+ virUSBDeviceGetDevno(dev));
if (STRNEQ(path, str)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/tests/vmwarevertest.c b/tests/vmwarevertest.c
index b482873103..fa909ad022 100644
--- a/tests/vmwarevertest.c
+++ b/tests/vmwarevertest.c
@@ -43,7 +43,7 @@ testVerStrParse(const void *data)
unsigned long version;
int vmware_type;
- virAsprintf(&path, "%s/vmwareverdata/%s.txt", abs_srcdir,
info->name);
+ path = g_strdup_printf("%s/vmwareverdata/%s.txt", abs_srcdir,
info->name);
if (virTestLoadFile(path, &databuf) < 0)
goto cleanup;
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 7e05052744..ad7b3360c3 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -114,10 +114,10 @@ testCompareHelper(const void *data)
char *vmx = NULL;
char *xml = NULL;
- virAsprintf(&vmx, "%s/vmx2xmldata/vmx2xml-%s.vmx", abs_srcdir,
- info->input);
- virAsprintf(&xml, "%s/vmx2xmldata/vmx2xml-%s.xml", abs_srcdir,
- info->output);
+ vmx = g_strdup_printf("%s/vmx2xmldata/vmx2xml-%s.vmx", abs_srcdir,
+ info->input);
+ xml = g_strdup_printf("%s/vmx2xmldata/vmx2xml-%s.xml", abs_srcdir,
+ info->output);
ret = testCompareFiles(vmx, xml);
@@ -148,7 +148,7 @@ testParseVMXFileName(const char *fileName, void *opaque
G_GNUC_UNUSED)
goto cleanup;
}
- virAsprintf(&src, "[%s] %s", datastoreName, directoryAndFileName);
+ src = g_strdup_printf("[%s] %s", datastoreName, directoryAndFileName);
} else if (STRPREFIX(fileName, "/")) {
/* Found absolute path referencing a file outside a datastore */
src = g_strdup(fileName);
@@ -157,7 +157,7 @@ testParseVMXFileName(const char *fileName, void *opaque
G_GNUC_UNUSED)
src = NULL;
} else {
/* Found single file name referencing a file inside a datastore */
- virAsprintf(&src, "[datastore] directory/%s", fileName);
+ src = g_strdup_printf("[datastore] directory/%s", fileName);
}
cleanup:
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 25988b1ae8..5a094e3b0e 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -187,8 +187,8 @@ testCompareHelper(const void *data)
char *xml = NULL;
char *cfg = NULL;
- virAsprintf(&xml, "%s/xlconfigdata/test-%s.xml", abs_srcdir,
info->name);
- virAsprintf(&cfg, "%s/xlconfigdata/test-%s.cfg", abs_srcdir,
info->name);
+ xml = g_strdup_printf("%s/xlconfigdata/test-%s.xml", abs_srcdir,
info->name);
+ cfg = g_strdup_printf("%s/xlconfigdata/test-%s.cfg", abs_srcdir,
info->name);
if (info->mode == 0)
result = testCompareParseXML(cfg, xml, info->replaceVars);
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 55fcd95081..82f4908a63 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -131,8 +131,8 @@ testCompareHelper(const void *data)
char *cfg = NULL;
char *cfgout = NULL;
- virAsprintf(&xml, "%s/xmconfigdata/test-%s.xml", abs_srcdir,
info->name);
- virAsprintf(&cfg, "%s/xmconfigdata/test-%s.cfg", abs_srcdir,
info->name);
+ xml = g_strdup_printf("%s/xmconfigdata/test-%s.xml", abs_srcdir,
info->name);
+ cfg = g_strdup_printf("%s/xmconfigdata/test-%s.cfg", abs_srcdir,
info->name);
if (info->mode == 0)
result = testCompareParseXML(cfg, xml);
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index b39862b4bb..8dc37f265a 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -115,10 +115,10 @@ testCompareHelper(const void *data)
char *xml = NULL;
char *vmx = NULL;
- virAsprintf(&xml, "%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
- info->input);
- virAsprintf(&vmx, "%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir,
- info->output);
+ xml = g_strdup_printf("%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
+ info->input);
+ vmx = g_strdup_printf("%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir,
+ info->output);
result = testCompareFiles(xml, vmx, info->virtualHW_version);
@@ -166,8 +166,8 @@ testFormatVMXFileName(const char *src, void *opaque G_GNUC_UNUSED)
directoryAndFileName += strspn(directoryAndFileName, " ");
}
- virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s", datastoreName,
- directoryAndFileName);
+ absolutePath = g_strdup_printf("/vmfs/volumes/%s/%s", datastoreName,
+ directoryAndFileName);
} else if (STRPREFIX(src, "/")) {
/* Found absolute path */
absolutePath = g_strdup(src);
--
2.21.0