🐛 Give rvg_write_counts the exports' shape and a call in the C harness
344b04ce6 added rvg_write_counts and failed two of reims-vgpu-c's checks
of the C boundary. Its body was `ffi::export(<fn>)` where every export's
whole body is one `ffi::export(|| { ... })` (tests/exports.rs), and
tests/c/harness.c, which calls every function the header declares from
C, never called it, so the header's 19 functions did not match the
harness test's count of 18 (tests/c_harness.rs).
The body is now the closure form, which runs the same call, and the C
harness calls the function before its quiesce, as QEMU does when a report
asks; the count is 19.
This commit is contained in:
1 parent
ce6fa476d4
commit
07fd48623d
3 files changed
+7
-2
No files matched your search
@@ -846,7 +846,9 @@ pub extern "C" fn rvg_quiesce_for_exit(timeout_ms: u64) -> bool {
|
||||
/// library's. Calls back: never.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn rvg_write_counts() {
|
||||
ffi::export(GraphicsDevice::<Plat>::write_counts)
|
||||
ffi::export(|| {
|
||||
GraphicsDevice::<Plat>::write_counts();
|
||||
})
|
||||
}
|
||||
|
||||
/// The device's region: its first byte, page-aligned, and, through `size` where it is not NULL,
|
||||
|
||||
@@ -452,6 +452,9 @@ int main(int argc, char **argv) {
|
||||
check_graphics();
|
||||
check_memory_files();
|
||||
check_displays();
|
||||
/* As QEMU does when reims-ctl's report asks for them while the guest runs: the degradation
|
||||
* counts on stderr now, where they changed since the library last wrote them. */
|
||||
rvg_write_counts();
|
||||
/* As QEMU does at its quit, the last call before the exit, whose answer is whether the exit
|
||||
* may run; a second call answers at once, with the first answer. On false the harness ends as
|
||||
* QEMU then does: its streams flushed, then _Exit, which runs no exit handler. */
|
||||
|
||||
@@ -242,7 +242,7 @@ fn c_harness_calls_every_function() {
|
||||
// A function with a form of each OS's (Windows's under `#if defined(_WIN32)`, the others'
|
||||
// under `#if !defined(_WIN32)`) is declared once per form, one after the other.
|
||||
declared.dedup();
|
||||
assert_eq!(declared.len(), 18, "{declared:?}");
|
||||
assert_eq!(declared.len(), 19, "{declared:?}");
|
||||
let missing: Vec<&str> = declared
|
||||
.iter()
|
||||
.copied()
|
||||
|
||||
Reference in new issue
Block a user