aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2022-04-21 13:43:44 +0100
committerGitHub <noreply@github.com>2022-04-21 13:43:44 +0100
commit3779fca8c766b18b6d68feda9ed7958aa60bd4cf (patch)
tree07401acbf0d8656dc1de00b2a9ecb3fec1d2a932 /test
parent9ad7474568a6c9f1fbb12fb8048f2083078a8144 (diff)
downloadlibvfio-user-3779fca8c766b18b6d68feda9ed7958aa60bd4cf.zip
libvfio-user-3779fca8c766b18b6d68feda9ed7958aa60bd4cf.tar.gz
libvfio-user-3779fca8c766b18b6d68feda9ed7958aa60bd4cf.tar.bz2
support AFL++ fuzzing (#623)
To support fuzzing with AFL++, add a "pipe" transport that reads from stdin and outputs to stdout: this is the most convenient way of doing fuzzing. Add some docs on how to run a fuzzing session. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/py/libvfio_user.py3
-rw-r--r--test/py/test_vfu_create_ctx.py2
3 files changed, 6 insertions, 1 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7f94212..2f085b8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -44,6 +44,8 @@ add_executable(unit-tests unit-tests.c mocks.c
../lib/migration.c
../lib/pci.c
../lib/pci_caps.c
+ ../lib/tran.c
+ ../lib/tran_pipe.c
../lib/tran_sock.c)
target_link_libraries(unit-tests PUBLIC cmocka dl json-c)
diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py
index dda4038..c96b1bc 100644
--- a/test/py/libvfio_user.py
+++ b/test/py/libvfio_user.py
@@ -121,6 +121,9 @@ VFIO_DEVICE_STATE_MASK = ((1 << 3) - 1)
# libvfio-user defines
VFU_TRANS_SOCK = 0
+VFU_TRANS_PIPE = 1
+VFU_TRANS_MAX = 2
+
LIBVFIO_USER_FLAG_ATTACH_NB = (1 << 0)
VFU_DEV_TYPE_PCI = 0
diff --git a/test/py/test_vfu_create_ctx.py b/test/py/test_vfu_create_ctx.py
index cb1448f..720a3fa 100644
--- a/test/py/test_vfu_create_ctx.py
+++ b/test/py/test_vfu_create_ctx.py
@@ -33,7 +33,7 @@ import errno
def test_vfu_create_ctx_bad_trans():
- ctx = vfu_create_ctx(trans=VFU_TRANS_SOCK + 1)
+ ctx = vfu_create_ctx(trans=VFU_TRANS_MAX)
assert ctx is None
assert c.get_errno() == errno.ENOTSUP