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>
This commit is contained in:
Paolo Bonzini
2024-11-15 12:08:43 +01:00
parent 716d89f9cc
commit d4873c5d4f
5 changed files with 45 additions and 5 deletions
+7 -1
View File
@@ -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)