Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/capabilities.c | 2 +-
tests/vircaps2xmldata/vircaps-x86_64-caches.xml | 15 +++++++++++++++
tests/vircaps2xmltest.c | 3 ++-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index c07c64e7d73c..73431ee14237 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1558,7 +1558,7 @@ virCapabilitiesInitCaches(virCapsPtr caps)
virSysfsGetCpuCacheValueBitmap(pos, ent->d_name,
"shared_cpu_list", &bank->cpus) < 0)
goto cleanup;
- for (tmp_c = type; tmp_c != '\0'; tmp_c++)
+ for (tmp_c = type; *tmp_c != '\0'; tmp_c++)
*tmp_c = c_tolower(*tmp_c);
tmp_i = virCacheTypeFromString(type);
diff --git a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
index 88f2ec62277e..c3defd686418 100644
--- a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
+++ b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml
@@ -28,6 +28,21 @@
</cell>
</cells>
</topology>
+ <cache>
+ <bank id='0' level='3' type='unified'
size='8192' unit='KiB' cpus='0-7'/>
+ <bank id='0' level='2' type='unified' size='256'
unit='KiB' cpus='0-1'/>
+ <bank id='0' level='1' type='instruction'
size='32' unit='KiB' cpus='0-1'/>
+ <bank id='0' level='1' type='data' size='32'
unit='KiB' cpus='0-1'/>
+ <bank id='1' level='2' type='unified' size='256'
unit='KiB' cpus='2-3'/>
+ <bank id='1' level='1' type='instruction'
size='32' unit='KiB' cpus='2-3'/>
+ <bank id='1' level='1' type='data' size='32'
unit='KiB' cpus='2-3'/>
+ <bank id='2' level='2' type='unified' size='256'
unit='KiB' cpus='4-5'/>
+ <bank id='2' level='1' type='instruction'
size='32' unit='KiB' cpus='4-5'/>
+ <bank id='2' level='1' type='data' size='32'
unit='KiB' cpus='4-5'/>
+ <bank id='3' level='2' type='unified' size='256'
unit='KiB' cpus='6-7'/>
+ <bank id='3' level='1' type='instruction'
size='32' unit='KiB' cpus='6-7'/>
+ <bank id='3' level='1' type='data' size='32'
unit='KiB' cpus='6-7'/>
+ </cache>
</host>
</capabilities>
diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index ffbe9a783811..dda0757766a8 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -58,7 +58,8 @@ test_virCapabilities(const void *opaque)
if (!caps)
goto cleanup;
- if (virCapabilitiesInitNUMA(caps) < 0)
+ if (virCapabilitiesInitNUMA(caps) < 0 ||
+ virCapabilitiesInitCaches(caps) < 0)
goto cleanup;
virSysfsSetSystemPath(NULL);
--
2.12.2