Add test for nodeinfo-7 of nodeinfotest for cpu power saving environment. Signed-off-by: Minoru Usui <usui@xxxxxxxxxxxxxxxxx> --- tests/nodeinfodata/linux-nodeinfo-7.cpuinfo | 200 ++++++++++++++++++++ .../nodeinfodata/linux-nodeinfo-7.cpuinfo_max_freq | 1 + tests/nodeinfodata/linux-nodeinfo-7.meminfo | 42 ++++ tests/nodeinfodata/linux-nodeinfo-7.txt | 1 + tests/nodeinfotest.c | 27 +++- 5 files changed, 267 insertions(+), 4 deletions(-) create mode 100644 tests/nodeinfodata/linux-nodeinfo-7.cpuinfo create mode 100644 tests/nodeinfodata/linux-nodeinfo-7.cpuinfo_max_freq create mode 100644 tests/nodeinfodata/linux-nodeinfo-7.meminfo create mode 100644 tests/nodeinfodata/linux-nodeinfo-7.txt diff --git a/tests/nodeinfodata/linux-nodeinfo-7.cpuinfo b/tests/nodeinfodata/linux-nodeinfo-7.cpuinfo new file mode 100644 index 0000000..9cd93cd --- /dev/null +++ b/tests/nodeinfodata/linux-nodeinfo-7.cpuinfo @@ -0,0 +1,200 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 0 +cpu cores : 4 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4655.76 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 1 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 1 +siblings : 4 +core id : 0 +cpu cores : 4 +apicid : 4 +initial apicid : 4 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4655.87 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 2 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 1 +cpu cores : 4 +apicid : 1 +initial apicid : 1 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4654.37 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 3 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 583.332 +cache size : 4096 KB +physical id : 1 +siblings : 4 +core id : 1 +cpu cores : 4 +apicid : 5 +initial apicid : 5 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4654.37 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 4 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 2 +cpu cores : 4 +apicid : 2 +initial apicid : 2 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4654.35 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 5 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 1 +siblings : 4 +core id : 2 +cpu cores : 4 +apicid : 6 +initial apicid : 6 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4654.37 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 6 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 3 +cpu cores : 4 +apicid : 3 +initial apicid : 3 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4654.35 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 7 +vendor_id : GenuineIntel +cpu family : 6 +model : 15 +model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz +stepping : 7 +cpu MHz : 291.666 +cache size : 4096 KB +physical id : 1 +siblings : 4 +core id : 3 +cpu cores : 4 +apicid : 7 +initial apicid : 7 +fpu : yes +fpu_exception : yes +cpuid level : 10 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow +bogomips : 4654.37 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + diff --git a/tests/nodeinfodata/linux-nodeinfo-7.cpuinfo_max_freq b/tests/nodeinfodata/linux-nodeinfo-7.cpuinfo_max_freq new file mode 100644 index 0000000..7fb6fab --- /dev/null +++ b/tests/nodeinfodata/linux-nodeinfo-7.cpuinfo_max_freq @@ -0,0 +1 @@ +2333331 diff --git a/tests/nodeinfodata/linux-nodeinfo-7.meminfo b/tests/nodeinfodata/linux-nodeinfo-7.meminfo new file mode 100644 index 0000000..fa505f5 --- /dev/null +++ b/tests/nodeinfodata/linux-nodeinfo-7.meminfo @@ -0,0 +1,42 @@ +MemTotal: 8058876 kB +MemFree: 3721460 kB +Buffers: 437572 kB +Cached: 2834588 kB +SwapCached: 0 kB +Active: 1478220 kB +Inactive: 2493592 kB +Active(anon): 672096 kB +Inactive(anon): 27776 kB +Active(file): 806124 kB +Inactive(file): 2465816 kB +Unevictable: 0 kB +Mlocked: 0 kB +SwapTotal: 987988 kB +SwapFree: 987988 kB +Dirty: 52 kB +Writeback: 444 kB +AnonPages: 699672 kB +Mapped: 21736 kB +Shmem: 292 kB +Slab: 299148 kB +SReclaimable: 132716 kB +SUnreclaim: 166432 kB +KernelStack: 2328 kB +PageTables: 9592 kB +NFS_Unstable: 1044 kB +Bounce: 0 kB +WritebackTmp: 0 kB +CommitLimit: 5017424 kB +Committed_AS: 2541104 kB +VmallocTotal: 34359738367 kB +VmallocUsed: 68912 kB +VmallocChunk: 34359654804 kB +HardwareCorrupted: 0 kB +AnonHugePages: 624640 kB +HugePages_Total: 0 +HugePages_Free: 0 +HugePages_Rsvd: 0 +HugePages_Surp: 0 +Hugepagesize: 2048 kB +DirectMap4k: 7040 kB +DirectMap2M: 8380416 kB diff --git a/tests/nodeinfodata/linux-nodeinfo-7.txt b/tests/nodeinfodata/linux-nodeinfo-7.txt new file mode 100644 index 0000000..f98ed27 --- /dev/null +++ b/tests/nodeinfodata/linux-nodeinfo-7.txt @@ -0,0 +1 @@ +CPUs: 8, MHz: 2333, Nodes: 1, Cores: 4 diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index c690403..12e4926 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -26,10 +26,13 @@ static char *abs_srcdir; # define MAX_FILE 4096 -extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, virNodeInfoPtr nodeinfo, +extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, int cpu_mhz, + virNodeInfoPtr nodeinfo, bool need_hyperthreads); -static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile) { +static int linuxTestCompareFiles(const char *cpuinfofile, + const int cpu_mhz, + const char *outputfile) { char actualData[MAX_FILE]; char expectData[MAX_FILE]; char *expect = &expectData[0]; @@ -44,7 +47,7 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile return -1; memset(&nodeinfo, 0, sizeof(nodeinfo)); - if (linuxNodeInfoCPUPopulate(cpuinfo, &nodeinfo, false) < 0) { + if (linuxNodeInfoCPUPopulate(cpuinfo, cpu_mhz, &nodeinfo, false) < 0) { if (virTestGetDebug()) { virErrorPtr error = virSaveLastError(); if (error && error->code != VIR_ERR_OK) @@ -79,12 +82,27 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile static int linuxTestNodeInfo(const void *data) { char cpuinfo[PATH_MAX]; + char cpuinfo_max_freq[PATH_MAX]; char output[PATH_MAX]; + char maxfreqData[MAX_FILE]; + char *maxfreq = &maxfreqData[0]; + int cpu_mhz = 0; + snprintf(cpuinfo, PATH_MAX, "%s/nodeinfodata/linux-%s.cpuinfo", abs_srcdir, (const char*)data); + snprintf(cpuinfo_max_freq, PATH_MAX, + "%s/nodeinfodata/linux-%s.cpuinfo_max_freq", + abs_srcdir, (const char*)data); snprintf(output, PATH_MAX, "%s/nodeinfodata/linux-%s.txt", abs_srcdir, (const char*)data); - return linuxTestCompareFiles(cpuinfo, output); + + if (access(cpuinfo_max_freq, R_OK) == 0) { + if (virtTestLoadFile(cpuinfo_max_freq, &maxfreq, MAX_FILE) < 0) + return -1; + cpu_mhz = atoi(maxfreq) / 1000; + } + + return linuxTestCompareFiles(cpuinfo, cpu_mhz, output); } @@ -100,6 +118,7 @@ mymain(int argc, char **argv) "nodeinfo-4", "nodeinfo-5", "nodeinfo-6", + "nodeinfo-7", }; char cwd[PATH_MAX]; -- 1.7.1 -- Minoru Usui <usui@xxxxxxxxxxxxxxxxx> -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list