summaryrefslogtreecommitdiff
path: root/tests/virnetdevbandwidthtest.c
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2014-01-31 15:04:03 +0100
committerMichal Privoznik <mprivozn@redhat.com>2014-01-31 16:52:27 +0100
commite60b36cb0d251a16ce9da67a0f7bdb720e540e7f (patch)
treefd2ab133d61e26215359ca1a4d49c498d29f0c1e /tests/virnetdevbandwidthtest.c
parentd01596a0d36ebf15140f44239fe35adddcaca7ab (diff)
downloadlibvirt-e60b36cb0d251a16ce9da67a0f7bdb720e540e7f.tar.gz
virnetdevbandwidthtest: Introduce some more tests
And while doing this, fix one error raised by coverity. With current code, @actual_cmd is allowed to be NULL for the whole run of testVirNetDevBandwidthSet. However, if something else was expected, the @actal_cmd is passed to virtTestDifference which dereference it immediately. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'tests/virnetdevbandwidthtest.c')
-rw-r--r--tests/virnetdevbandwidthtest.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 5bcab12ae0..073fdf88b6 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -92,7 +92,9 @@ testVirNetDevBandwidthSet(const void *data)
}
if (STRNEQ_NULLABLE(info->exp_cmd, actual_cmd)) {
- virtTestDifference(stderr, info->exp_cmd, actual_cmd);
+ virtTestDifference(stderr,
+ NULLSTR(info->exp_cmd),
+ NULLSTR(actual_cmd));
goto cleanup;
}
@@ -121,6 +123,31 @@ mymain(void)
} while (0)
+ DO_TEST_SET(NULL, NULL);
+
+ DO_TEST_SET(("<bandwidth/>"),
+ (TC " qdisc del dev eth0 root\n"
+ TC " qdisc del dev eth0 ingress\n"));
+
+ DO_TEST_SET(("<bandwidth>"
+ " <inbound average='1024'/>"
+ "</bandwidth>"),
+ (TC " qdisc del dev eth0 root\n"
+ TC " qdisc del dev eth0 ingress\n"
+ TC " qdisc add dev eth0 root handle 1: htb default 1\n"
+ TC " class add dev eth0 parent 1: classid 1:1 htb rate 1024kbps\n"
+ TC " qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10\n"
+ TC " filter add dev eth0 parent 1:0 protocol ip handle 1 fw flowid 1\n"));
+
+ DO_TEST_SET(("<bandwidth>"
+ " <outbound average='1024'/>"
+ "</bandwidth>"),
+ (TC " qdisc del dev eth0 root\n"
+ TC " qdisc del dev eth0 ingress\n"
+ TC " qdisc add dev eth0 ingress\n"
+ TC " filter add dev eth0 parent ffff: protocol ip u32 match ip src 0.0.0.0/0 "
+ "police rate 1024kbps burst 1024kb mtu 64kb drop flowid :1\n"));
+
DO_TEST_SET(("<bandwidth>"
" <inbound average='1' peak='2' floor='3' burst='4'/>"
" <outbound average='5' peak='6' burst='7'/>"