cpu: Add support for loading and storing CPU data

This patch adds cpuDataFormat and cpuDataParse APIs to be used in unit
tests for testing APIs that deal with virCPUData. In the x86 world, this
means we can now store/load arbitrary CPUID data in the test suite to
check correctness of CPU related APIs that could not be tested before.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark
2013-07-22 00:18:50 +02:00
committed by Peter Krempa
parent fe1bf917f9
commit 376261d164
4 changed files with 171 additions and 21 deletions

View File

@@ -93,6 +93,11 @@ typedef int
(*cpuArchHasFeature) (const virCPUData *data,
const char *feature);
typedef char *
(*cpuArchDataFormat)(const virCPUData *data);
typedef virCPUDataPtr
(*cpuArchDataParse) (const char *xmlStr);
struct cpuArchDriver {
const char *name;
@@ -107,6 +112,8 @@ struct cpuArchDriver {
cpuArchBaseline baseline;
cpuArchUpdate update;
cpuArchHasFeature hasFeature;
cpuArchDataFormat dataFormat;
cpuArchDataParse dataParse;
};
@@ -178,4 +185,11 @@ cpuModelIsAllowed(const char *model,
extern int
cpuGetModels(const char *arch, char ***models);
/* cpuDataFormat and cpuDataParse are implemented for unit tests only and
* have no real-life usage
*/
char *cpuDataFormat(const virCPUData *data);
virCPUDataPtr cpuDataParse(virArch arch,
const char *xmlStr);
#endif /* __VIR_CPU_H__ */