SHA256
1
0
forked from pool/libvirt
libvirt/disable-virCgroupGetPercpuStats-test.patch

115 lines
3.9 KiB
Diff
Raw Normal View History

Index: libvirt-1.2.17/tests/vircgrouptest.c
===================================================================
--- libvirt-1.2.17.orig/tests/vircgrouptest.c
+++ libvirt-1.2.17/tests/vircgrouptest.c
@@ -34,7 +34,6 @@
# include "virfile.h"
# include "virbuffer.h"
# include "testutilslxc.h"
-# include "nodeinfo.h"
# define VIR_FROM_THIS VIR_FROM_NONE
@@ -607,91 +606,6 @@ static int testCgroupControllerAvailable
return ret;
}
-static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
-{
- virCgroupPtr cgroup = NULL;
- size_t i;
- int rv, ret = -1;
- virTypedParameterPtr params = NULL;
-# define EXPECTED_NCPUS 160
-
- unsigned long long expected[EXPECTED_NCPUS] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 7059492996ULL, 0, 0, 0, 0, 0, 0, 0,
- 4180532496ULL, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 1957541268ULL, 0, 0, 0, 0, 0, 0, 0,
- 2065932204ULL, 0, 0, 0, 0, 0, 0, 0,
- 18228689414ULL, 0, 0, 0, 0, 0, 0, 0,
- 4245525148ULL, 0, 0, 0, 0, 0, 0, 0,
- 2911161568ULL, 0, 0, 0, 0, 0, 0, 0,
- 1407758136ULL, 0, 0, 0, 0, 0, 0, 0,
- 1836807700ULL, 0, 0, 0, 0, 0, 0, 0,
- 1065296618ULL, 0, 0, 0, 0, 0, 0, 0,
- 2046213266ULL, 0, 0, 0, 0, 0, 0, 0,
- 747889778ULL, 0, 0, 0, 0, 0, 0, 0,
- 709566900ULL, 0, 0, 0, 0, 0, 0, 0,
- 444777342ULL, 0, 0, 0, 0, 0, 0, 0,
- 5683512916ULL, 0, 0, 0, 0, 0, 0, 0,
- 635751356ULL, 0, 0, 0, 0, 0, 0, 0,
- };
-
- if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0)
- goto cleanup;
-
- if ((rv = virCgroupNewPartition("/virtualmachines", true,
- (1 << VIR_CGROUP_CONTROLLER_CPU) |
- (1 << VIR_CGROUP_CONTROLLER_CPUACCT),
- &cgroup)) < 0) {
- fprintf(stderr, "Could not create /virtualmachines cgroup: %d\n", -rv);
- goto cleanup;
- }
-
- if (nodeGetCPUCount() != EXPECTED_NCPUS) {
- fprintf(stderr, "Unexpected: nodeGetCPUCount() yields: %d\n", nodeGetCPUCount());
- goto cleanup;
- }
-
- if ((rv = virCgroupGetPercpuStats(cgroup,
- params,
- 1, 0, EXPECTED_NCPUS, 0)) < 0) {
- fprintf(stderr, "Failed call to virCgroupGetPercpuStats for /virtualmachines cgroup: %d\n", -rv);
- goto cleanup;
- }
-
- for (i = 0; i < EXPECTED_NCPUS; i++) {
- if (!STREQ(params[i].field, VIR_DOMAIN_CPU_STATS_CPUTIME)) {
- fprintf(stderr,
- "Wrong parameter name value from virCgroupGetPercpuStats at %zu (is: %s)\n",
- i, params[i].field);
- goto cleanup;
- }
-
- if (params[i].type != VIR_TYPED_PARAM_ULLONG) {
- fprintf(stderr,
- "Wrong parameter value type from virCgroupGetPercpuStats at %zu (is: %d)\n",
- i, params[i].type);
- goto cleanup;
- }
-
- if (params[i].value.ul != expected[i]) {
- fprintf(stderr,
- "Wrong value from virCgroupGetMemoryUsage at %zu (expected %llu)\n",
- i, params[i].value.ul);
- goto cleanup;
- }
- }
-
- ret = 0;
-
- cleanup:
- virCgroupFree(&cgroup);
- VIR_FREE(params);
- return ret;
-}
-
static int testCgroupGetMemoryUsage(const void *args ATTRIBUTE_UNUSED)
{
virCgroupPtr cgroup = NULL;
@@ -919,9 +833,6 @@ mymain(void)
if (virtTestRun("virCgroupGetMemoryUsage works", testCgroupGetMemoryUsage, NULL) < 0)
ret = -1;
- if (virtTestRun("virCgroupGetPercpuStats works", testCgroupGetPercpuStats, NULL) < 0)
- ret = -1;
-
setenv("VIR_CGROUP_MOCK_MODE", "allinone", 1);
if (virtTestRun("New cgroup for self (allinone)", testCgroupNewForSelfAllInOne, NULL) < 0)
ret = -1;