Skip to content

Commit 1515c5c

Browse files
committed
tools/virtio: add vring_test.
This is mainly to test the drivers/vhost/vringh.c code, but it also uses the drivers/virtio/virtio_ring.c code for the guest side. Usage for testing the basic implementation: ./vringh_test # Test with indirect descriptors ./vringh_test --indirect # Test with indirect descriptors and event indexex ./vringh_test --indirect --eventidx You can run a parallel stress test by adding --parallel to any of the above options. eg ./vringh_test --parallel: Using CPUS 0 and 3 Guest: notified 10107974, pinged 107970 Host: notified 108158, pinged 3172148 ./vringh_test --indirect --eventidx --parallel: Using CPUS 0 and 3 Guest: notified 156357, pinged 156251 Host: notified 156251, pinged 78179 Average of 50 times doing ./vringh_test --indirect --eventidx --parallel: 2.840000-3.040000(2.927292)user Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent f87d0fb commit 1515c5c

3 files changed

Lines changed: 747 additions & 4 deletions

File tree

‎tools/virtio/Makefile‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
all: test mod
2-
test: virtio_test
2+
test: virtio_test vringh_test
33
virtio_test: virtio_ring.o virtio_test.o
4-
CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD
5-
vpath %.c ../../drivers/virtio
4+
vringh_test: vringh_test.o vringh.o virtio_ring.o
5+
6+
CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
7+
vpath %.c ../../drivers/virtio ../../drivers/vhost
68
mod:
79
${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test
810
.PHONY: all test mod clean
911
clean:
10-
${RM} *.o vhost_test/*.o vhost_test/.*.cmd \
12+
${RM} *.o vringh_test virtio_test vhost_test/*.o vhost_test/.*.cmd \
1113
vhost_test/Module.symvers vhost_test/modules.order *.d
1214
-include *.d

‎tools/virtio/linux/uio.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
#include <linux/kernel.h>
2+
13
#include "../../../include/linux/uio.h"

0 commit comments

Comments
 (0)