nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
162 stars 51 forks source link

incompatible return types from Python callbacks don't break pytest #614

Open tmakatos opened 2 years ago

tmakatos commented 2 years ago

I'm adding a new set of tests where we need to define a libvfio-user callback. We define this callback in Python which does get called however an error in the callback implementation results in a mere warning rather than a complete test failure:

----------------------------------------------------------------------------------------------------------------------------------- 
Captured stdout call
-----------------------------------------------------------------------------------------------------------------------------------
DEBUG: invalid call to quiesce callback, state=0
INFO: vfu_reset_ctx_quiesced: reset context because: Cannot send after transport endpoint shutdown
DEBUG: disabling IRQ type REQ range [0, 1)
DEBUG: disabling IRQ type ERR range [0, 1)
----------------------------------------------------------------------------------------------------------------------------------- 
Captured stderr call
-----------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 257, in 'converting callback result'
TypeError: an integer is required (got type Mock)
Exception ignored in: <function quiesce_cb at 0x7f44b54431e0>

The test succeeds though it shouldn't. Maybe we should make sure if something is written to stderr then the test should fail?

jlevon commented 2 years ago

first we should ask upstream, somebody else must have hit this