aboutsummaryrefslogtreecommitdiff
path: root/stubs
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-11-15 12:08:43 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2024-12-19 19:36:37 +0100
commitd4873c5d4fdd11f484df183e01c0825fe347fd8b (patch)
treee0b0e6537ec3ef995df5d463c6efd939d93bdb41 /stubs
parent716d89f9cc14faf784d83c945c40b7e8256ae525 (diff)
downloadqemu-d4873c5d4fdd11f484df183e01c0825fe347fd8b.zip
qemu-d4873c5d4fdd11f484df183e01c0825fe347fd8b.tar.gz
qemu-d4873c5d4fdd11f484df183e01c0825fe347fd8b.tar.bz2
bql: add a "mock" BQL for Rust unit tests
Right now, the stub BQL in stubs/iothread-lock.c always reports itself as unlocked. However, Rust would like to run its tests in an environment where the BQL *is* locked. Provide an extremely dirty function that flips the return value of bql_is_locked() to true. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'stubs')
-rw-r--r--stubs/iothread-lock.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/stubs/iothread-lock.c b/stubs/iothread-lock.c
index 5467659..6050c08 100644
--- a/stubs/iothread-lock.c
+++ b/stubs/iothread-lock.c
@@ -1,11 +1,17 @@
#include "qemu/osdep.h"
#include "qemu/main-loop.h"
+static bool bql_is_locked = false;
static uint32_t bql_unlock_blocked;
bool bql_locked(void)
{
- return false;
+ return bql_is_locked;
+}
+
+void rust_bql_mock_lock(void)
+{
+ bql_is_locked = true;
}
void bql_lock_impl(const char *file, int line)