diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-15 12:08:43 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-19 19:36:37 +0100 |
| commit | d4873c5d4fdd11f484df183e01c0825fe347fd8b (patch) | |
| tree | e0b0e6537ec3ef995df5d463c6efd939d93bdb41 /system/cpus.c | |
| parent | 716d89f9cc14faf784d83c945c40b7e8256ae525 (diff) | |
| download | focaccia-qemu-d4873c5d4fdd11f484df183e01c0825fe347fd8b.tar.gz focaccia-qemu-d4873c5d4fdd11f484df183e01c0825fe347fd8b.zip | |
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 'system/cpus.c')
| -rw-r--r-- | system/cpus.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/system/cpus.c b/system/cpus.c index ba633c7688..4b43ceb543 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -538,6 +538,12 @@ bool qemu_in_main_thread(void) return bql_locked(); } +void rust_bql_mock_lock(void) +{ + error_report("This function should be used only from tests"); + abort(); +} + /* * The BQL is taken from so many places that it is worth profiling the * callers directly, instead of funneling them all through a single function. |