tests: testQemuCapsIterate: Pass prefix and version to callback

Right now we're passing a "base" string that contains both,
separated by an underscore. Some changes that we're going to
introduce later will require us to have the version number on its
own, and instead of delegating the task of splitting the two apart
to the callback it make more sense to perform it upfront.

This change results in quite a bit of churn because we're now
using the version number only, without the prefix, to calculate
the dummy microcodeVersion.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-10-22 16:08:10 +02:00
parent 5a45ed9c96
commit c4d6465aa7
43 changed files with 78 additions and 63 deletions

View File

@ -85,7 +85,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>1005003</version> <version>1005003</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100763</microcodeVersion> <microcodeVersion>43100245</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -90,7 +90,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>1006000</version> <version>1006000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100761</microcodeVersion> <microcodeVersion>43100243</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -92,7 +92,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>1007000</version> <version>1007000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100762</microcodeVersion> <microcodeVersion>43100244</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -108,7 +108,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>2001001</version> <version>2001001</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100758</microcodeVersion> <microcodeVersion>43100240</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -141,7 +141,7 @@
<flag name='iothread.poll-max-ns'/> <flag name='iothread.poll-max-ns'/>
<version>2010000</version> <version>2010000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>61700805</microcodeVersion> <microcodeVersion>61700287</microcodeVersion>
<package> (v2.10.0)</package> <package> (v2.10.0)</package>
<arch>aarch64</arch> <arch>aarch64</arch>
<cpu type='kvm' name='pxa262'/> <cpu type='kvm' name='pxa262'/>

View File

@ -140,7 +140,7 @@
<flag name='iothread.poll-max-ns'/> <flag name='iothread.poll-max-ns'/>
<version>2010000</version> <version>2010000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900805</microcodeVersion> <microcodeVersion>42900287</microcodeVersion>
<package> (v2.10.0)</package> <package> (v2.10.0)</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -107,7 +107,7 @@
<flag name='query-cpu-model-comparison'/> <flag name='query-cpu-model-comparison'/>
<version>2010000</version> <version>2010000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100805</microcodeVersion> <microcodeVersion>39100287</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='z14-base' migratability='no'> <hostCPU type='kvm' model='z14-base' migratability='no'>

View File

@ -183,7 +183,7 @@
<flag name='x86-max-cpu'/> <flag name='x86-max-cpu'/>
<version>2010000</version> <version>2010000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100805</microcodeVersion> <microcodeVersion>43100287</microcodeVersion>
<package> (v2.10.0)</package> <package> (v2.10.0)</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -114,7 +114,7 @@
<flag name='query-cpu-model-comparison'/> <flag name='query-cpu-model-comparison'/>
<version>2011000</version> <version>2011000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100806</microcodeVersion> <microcodeVersion>39100288</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='z14-base' migratability='no'> <hostCPU type='kvm' model='z14-base' migratability='no'>

View File

@ -189,7 +189,7 @@
<flag name='x86-max-cpu'/> <flag name='x86-max-cpu'/>
<version>2011000</version> <version>2011000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100806</microcodeVersion> <microcodeVersion>43100288</microcodeVersion>
<package> (v2.11.0)</package> <package> (v2.11.0)</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -155,7 +155,7 @@
<flag name='memory-backend-file.align'/> <flag name='memory-backend-file.align'/>
<version>2012000</version> <version>2012000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>61700807</microcodeVersion> <microcodeVersion>61700289</microcodeVersion>
<package>v2.12.0</package> <package>v2.12.0</package>
<arch>aarch64</arch> <arch>aarch64</arch>
<cpu type='kvm' name='pxa262'/> <cpu type='kvm' name='pxa262'/>

View File

@ -153,7 +153,7 @@
<flag name='memory-backend-file.align'/> <flag name='memory-backend-file.align'/>
<version>2011090</version> <version>2011090</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900807</microcodeVersion> <microcodeVersion>42900289</microcodeVersion>
<package>v2.12.0-rc0</package> <package>v2.12.0-rc0</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -125,7 +125,7 @@
<flag name='query-cpu-model-comparison'/> <flag name='query-cpu-model-comparison'/>
<version>2012000</version> <version>2012000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100807</microcodeVersion> <microcodeVersion>39100289</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='z14-base' migratability='no'> <hostCPU type='kvm' model='z14-base' migratability='no'>

View File

@ -197,7 +197,7 @@
<flag name='x86-max-cpu'/> <flag name='x86-max-cpu'/>
<version>2011090</version> <version>2011090</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100807</microcodeVersion> <microcodeVersion>43100289</microcodeVersion>
<package>v2.12.0-rc0</package> <package>v2.12.0-rc0</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -134,7 +134,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>2004000</version> <version>2004000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100760</microcodeVersion> <microcodeVersion>43100242</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -140,7 +140,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>2005000</version> <version>2005000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100761</microcodeVersion> <microcodeVersion>43100243</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -124,7 +124,7 @@
<flag name='hda-output'/> <flag name='hda-output'/>
<version>2006000</version> <version>2006000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>61700762</microcodeVersion> <microcodeVersion>61700244</microcodeVersion>
<package></package> <package></package>
<arch>aarch64</arch> <arch>aarch64</arch>
<cpu type='kvm' name='pxa262'/> <cpu type='kvm' name='pxa262'/>

View File

@ -119,7 +119,7 @@
<flag name='hda-output'/> <flag name='hda-output'/>
<version>2006000</version> <version>2006000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900762</microcodeVersion> <microcodeVersion>42900244</microcodeVersion>
<package></package> <package></package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -152,7 +152,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>2006000</version> <version>2006000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100762</microcodeVersion> <microcodeVersion>43100244</microcodeVersion>
<package></package> <package></package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -91,7 +91,7 @@
<flag name='zpci'/> <flag name='zpci'/>
<version>2007000</version> <version>2007000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100763</microcodeVersion> <microcodeVersion>39100245</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<cpu type='kvm' name='host'/> <cpu type='kvm' name='host'/>

View File

@ -157,7 +157,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>2007000</version> <version>2007000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100763</microcodeVersion> <microcodeVersion>43100245</microcodeVersion>
<package> (v2.7.0)</package> <package> (v2.7.0)</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='Opteron_G5'/> <cpu type='kvm' name='Opteron_G5'/>

View File

@ -96,7 +96,7 @@
<flag name='query-cpu-model-comparison'/> <flag name='query-cpu-model-comparison'/>
<version>2007093</version> <version>2007093</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100764</microcodeVersion> <microcodeVersion>39100246</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='zEC12.2-base' migratability='no'> <hostCPU type='kvm' model='zEC12.2-base' migratability='no'>

View File

@ -160,7 +160,7 @@
<flag name='mch'/> <flag name='mch'/>
<version>2008000</version> <version>2008000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100764</microcodeVersion> <microcodeVersion>43100246</microcodeVersion>
<package> (v2.8.0)</package> <package> (v2.8.0)</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<cpu type='kvm' name='host' usable='yes'/> <cpu type='kvm' name='host' usable='yes'/>

View File

@ -132,7 +132,7 @@
<flag name='iothread.poll-max-ns'/> <flag name='iothread.poll-max-ns'/>
<version>2009000</version> <version>2009000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900765</microcodeVersion> <microcodeVersion>42900247</microcodeVersion>
<package> (v2.9.0)</package> <package> (v2.9.0)</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -101,7 +101,7 @@
<flag name='query-cpu-model-comparison'/> <flag name='query-cpu-model-comparison'/>
<version>2009000</version> <version>2009000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100765</microcodeVersion> <microcodeVersion>39100247</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='z13.2-base' migratability='no'> <hostCPU type='kvm' model='z13.2-base' migratability='no'>

View File

@ -177,7 +177,7 @@
<flag name='x86-max-cpu'/> <flag name='x86-max-cpu'/>
<version>2009000</version> <version>2009000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100765</microcodeVersion> <microcodeVersion>43100247</microcodeVersion>
<package> (v2.9.0)</package> <package> (v2.9.0)</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -155,7 +155,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>2012050</version> <version>2012050</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900757</microcodeVersion> <microcodeVersion>42900239</microcodeVersion>
<package>v2.12.0-1689-g518d23a</package> <package>v2.12.0-1689-g518d23a</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -128,7 +128,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>3000000</version> <version>3000000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100757</microcodeVersion> <microcodeVersion>39100239</microcodeVersion>
<package></package> <package></package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='z14-base' migratability='no'> <hostCPU type='kvm' model='z14-base' migratability='no'>

View File

@ -202,7 +202,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>3000000</version> <version>3000000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100757</microcodeVersion> <microcodeVersion>43100239</microcodeVersion>
<package>v3.0.0</package> <package>v3.0.0</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -159,7 +159,7 @@
<flag name='bochs-display'/> <flag name='bochs-display'/>
<version>3000091</version> <version>3000091</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900758</microcodeVersion> <microcodeVersion>42900240</microcodeVersion>
<package>v3.1.0-rc1-74-g3c035a41dc</package> <package>v3.1.0-rc1-74-g3c035a41dc</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -205,7 +205,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>3000092</version> <version>3000092</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100758</microcodeVersion> <microcodeVersion>43100240</microcodeVersion>
<package>v3.1.0-rc2-48-g039d4e3df0</package> <package>v3.1.0-rc2-48-g039d4e3df0</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -168,7 +168,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>4000000</version> <version>4000000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>61700758</microcodeVersion> <microcodeVersion>61700240</microcodeVersion>
<package>v4.0.0</package> <package>v4.0.0</package>
<arch>aarch64</arch> <arch>aarch64</arch>
<cpu type='kvm' name='pxa262'/> <cpu type='kvm' name='pxa262'/>

View File

@ -173,7 +173,7 @@
<flag name='machine.pseries.cap-ccf-assist'/> <flag name='machine.pseries.cap-ccf-assist'/>
<version>4000000</version> <version>4000000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900758</microcodeVersion> <microcodeVersion>42900240</microcodeVersion>
<package>v4.0.0</package> <package>v4.0.0</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -136,7 +136,7 @@
<flag name='query-cpu-model-comparison'/> <flag name='query-cpu-model-comparison'/>
<version>4000000</version> <version>4000000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>39100758</microcodeVersion> <microcodeVersion>39100240</microcodeVersion>
<package>v4.0.0</package> <package>v4.0.0</package>
<arch>s390x</arch> <arch>s390x</arch>
<hostCPU type='kvm' model='z14.2-base' migratability='no'> <hostCPU type='kvm' model='z14.2-base' migratability='no'>

View File

@ -210,7 +210,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>4000000</version> <version>4000000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100758</microcodeVersion> <microcodeVersion>43100240</microcodeVersion>
<package>v4.0.0</package> <package>v4.0.0</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -214,7 +214,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>4001000</version> <version>4001000</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100759</microcodeVersion> <microcodeVersion>43100241</microcodeVersion>
<package>v4.1.0</package> <package>v4.1.0</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -169,7 +169,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>4001050</version> <version>4001050</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>61700760</microcodeVersion> <microcodeVersion>61700242</microcodeVersion>
<package>v4.1.0-1378-g98b2e3c9ab</package> <package>v4.1.0-1378-g98b2e3c9ab</package>
<arch>aarch64</arch> <arch>aarch64</arch>
<cpu type='kvm' name='pxa262'/> <cpu type='kvm' name='pxa262'/>

View File

@ -175,7 +175,7 @@
<flag name='machine.pseries.cap-ccf-assist'/> <flag name='machine.pseries.cap-ccf-assist'/>
<version>4001050</version> <version>4001050</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>42900760</microcodeVersion> <microcodeVersion>42900242</microcodeVersion>
<package>v4.1.0-1378-g98b2e3c9ab</package> <package>v4.1.0-1378-g98b2e3c9ab</package>
<arch>ppc64</arch> <arch>ppc64</arch>
<cpu type='kvm' name='default'/> <cpu type='kvm' name='default'/>

View File

@ -214,7 +214,7 @@
<flag name='ramfb'/> <flag name='ramfb'/>
<version>4001050</version> <version>4001050</version>
<kvmVersion>0</kvmVersion> <kvmVersion>0</kvmVersion>
<microcodeVersion>43100760</microcodeVersion> <microcodeVersion>43100242</microcodeVersion>
<package>v4.1.0-1138-geb13d1cf4a</package> <package>v4.1.0-1138-geb13d1cf4a</package>
<arch>x86_64</arch> <arch>x86_64</arch>
<hostCPU type='kvm' model='base' migratability='yes'> <hostCPU type='kvm' model='base' migratability='yes'>

View File

@ -37,9 +37,10 @@ struct _testQemuData {
virQEMUDriver driver; virQEMUDriver driver;
const char *inputDir; const char *inputDir;
const char *outputDir; const char *outputDir;
const char *prefix;
const char *version;
const char *archName; const char *archName;
const char *suffix; const char *suffix;
const char *base;
int ret; int ret;
}; };
@ -78,11 +79,12 @@ testQemuCaps(const void *opaque)
unsigned int fakeMicrocodeVersion = 0; unsigned int fakeMicrocodeVersion = 0;
const char *p; const char *p;
if (virAsprintf(&repliesFile, "%s/%s.%s.%s", if (virAsprintf(&repliesFile, "%s/%s_%s.%s.%s",
data->inputDir, data->base, data->inputDir, data->prefix, data->version,
data->archName, data->suffix) < 0 || data->archName, data->suffix) < 0 ||
virAsprintf(&capsFile, "%s/%s.%s.xml", virAsprintf(&capsFile, "%s/%s_%s.%s.xml",
data->outputDir, data->base, data->archName) < 0) data->outputDir, data->prefix, data->version,
data->archName) < 0)
goto cleanup; goto cleanup;
if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL, if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL,
@ -114,7 +116,7 @@ testQemuCaps(const void *opaque)
fakeMicrocodeVersion *= 100000; fakeMicrocodeVersion *= 100000;
for (p = data->base; *p; p++) for (p = data->version; *p; p++)
fakeMicrocodeVersion += *p; fakeMicrocodeVersion += *p;
virQEMUCapsSetMicrocodeVersion(capsActual, fakeMicrocodeVersion); virQEMUCapsSetMicrocodeVersion(capsActual, fakeMicrocodeVersion);
@ -148,8 +150,9 @@ testQemuCapsCopy(const void *opaque)
virQEMUCapsPtr copy = NULL; virQEMUCapsPtr copy = NULL;
char *actual = NULL; char *actual = NULL;
if (virAsprintf(&capsFile, "%s/%s.%s.xml", if (virAsprintf(&capsFile, "%s/%s_%s.%s.xml",
data->outputDir, data->base, data->archName) < 0) data->outputDir, data->prefix, data->version,
data->archName) < 0)
goto cleanup; goto cleanup;
if (!(caps = virCapabilitiesNew(virArchFromString(data->archName), if (!(caps = virCapabilitiesNew(virArchFromString(data->archName),
@ -182,7 +185,8 @@ testQemuCapsCopy(const void *opaque)
static int static int
doCapsTest(const char *inputDir, doCapsTest(const char *inputDir,
const char *base, const char *prefix,
const char *version,
const char *archName, const char *archName,
const char *suffix, const char *suffix,
void *opaque) void *opaque)
@ -191,13 +195,14 @@ doCapsTest(const char *inputDir,
g_autofree char *title = NULL; g_autofree char *title = NULL;
g_autofree char *copyTitle = NULL; g_autofree char *copyTitle = NULL;
if (virAsprintf(&title, "%s (%s)", base, archName) < 0 || if (virAsprintf(&title, "%s (%s)", version, archName) < 0 ||
virAsprintf(&copyTitle, "copy %s (%s)", base, archName) < 0) { virAsprintf(&copyTitle, "copy %s (%s)", version, archName) < 0) {
return -1; return -1;
} }
data->inputDir = inputDir; data->inputDir = inputDir;
data->base = base; data->prefix = prefix;
data->version = version;
data->archName = archName; data->archName = archName;
data->suffix = suffix; data->suffix = suffix;

View File

@ -31,7 +31,8 @@ typedef testQemuData *testQemuDataPtr;
struct _testQemuData { struct _testQemuData {
const char *inputDir; const char *inputDir;
const char *outputDir; const char *outputDir;
const char *base; const char *prefix;
const char *version;
const char *archName; const char *archName;
const char *suffix; const char *suffix;
int ret; int ret;
@ -146,8 +147,8 @@ testQemuCapsXML(const void *opaque)
data->outputDir, data->archName) < 0) data->outputDir, data->archName) < 0)
goto cleanup; goto cleanup;
if (virAsprintf(&capsFile, "%s/%s.%s.%s", if (virAsprintf(&capsFile, "%s/%s_%s.%s.%s",
data->inputDir, data->base, data->inputDir, data->prefix, data->version,
data->archName, data->suffix) < 0) data->archName, data->suffix) < 0)
goto cleanup; goto cleanup;
@ -176,7 +177,8 @@ testQemuCapsXML(const void *opaque)
static int static int
doCapsTest(const char *inputDir, doCapsTest(const char *inputDir,
const char *base, const char *prefix,
const char *version,
const char *archName, const char *archName,
const char *suffix, const char *suffix,
void *opaque) void *opaque)
@ -184,11 +186,12 @@ doCapsTest(const char *inputDir,
testQemuDataPtr data = (testQemuDataPtr) opaque; testQemuDataPtr data = (testQemuDataPtr) opaque;
g_autofree char *title = NULL; g_autofree char *title = NULL;
if (virAsprintf(&title, "%s (%s)", base, archName) < 0) if (virAsprintf(&title, "%s (%s)", version, archName) < 0)
return -1; return -1;
data->inputDir = inputDir; data->inputDir = inputDir;
data->base = base; data->prefix = prefix;
data->version = version;
data->archName = archName; data->archName = archName;
data->suffix = suffix; data->suffix = suffix;

View File

@ -917,22 +917,28 @@ testQemuCapsIterate(const char *suffix,
while ((rc = virDirRead(dir, &ent, TEST_QEMU_CAPS_PATH)) > 0) { while ((rc = virDirRead(dir, &ent, TEST_QEMU_CAPS_PATH)) > 0) {
g_autofree char *tmp = g_strdup(ent->d_name); g_autofree char *tmp = g_strdup(ent->d_name);
char *base = NULL; char *version = NULL;
char *archName = NULL; char *archName = NULL;
/* Strip the trailing suffix, moving on if it's not present */ /* Strip the trailing suffix, moving on if it's not present */
if (!virStringStripSuffix(tmp, suffix)) if (!virStringStripSuffix(tmp, suffix))
continue; continue;
/* Strip the leading prefix */
if (!(version = STRSKIP(tmp, "caps_"))) {
VIR_TEST_VERBOSE("malformed file name '%s'", ent->d_name);
goto cleanup;
}
/* Find the last dot */ /* Find the last dot */
if (!(archName = strrchr(tmp, '.'))) { if (!(archName = strrchr(tmp, '.'))) {
VIR_TEST_VERBOSE("malformed file name '%s'", ent->d_name); VIR_TEST_VERBOSE("malformed file name '%s'", ent->d_name);
goto cleanup; goto cleanup;
} }
/* The base name is everything before the last dot, and /* The version number and the architecture name are separated by
* the architecture name everything after it */ * a dot: overwriting that dot with \0 results in both being usable
base = tmp; * as independent, null-terminated strings */
archName[0] = '\0'; archName[0] = '\0';
archName++; archName++;
@ -942,7 +948,7 @@ testQemuCapsIterate(const char *suffix,
* to make it nicer to rebuild the original file name from inside * to make it nicer to rebuild the original file name from inside
* the callback. * the callback.
*/ */
if (callback(TEST_QEMU_CAPS_PATH, base, if (callback(TEST_QEMU_CAPS_PATH, "caps", version,
archName, suffix + 1, opaque) < 0) { archName, suffix + 1, opaque) < 0) {
goto cleanup; goto cleanup;
} }

View File

@ -97,7 +97,8 @@ char *testQemuGetLatestCapsForArch(const char *arch,
virHashTablePtr testQemuGetLatestCaps(void); virHashTablePtr testQemuGetLatestCaps(void);
typedef int (*testQemuCapsIterateCallback)(const char *inputDir, typedef int (*testQemuCapsIterateCallback)(const char *inputDir,
const char *base, const char *prefix,
const char *version,
const char *archName, const char *archName,
const char *suffix, const char *suffix,
void *opaque); void *opaque);