Fix code coverage build

This commit is contained in:
Heikki Linnakangas
2025-07-14 21:22:19 +03:00
parent b2c5aa7720
commit ede25c5d2e

View File

@@ -4,12 +4,25 @@
//! These are called from the communicator threads! Careful what you do, most Postgres functions are
//! not safe to call in that context.
#[cfg(not(test))]
unsafe extern "C" {
pub fn callback_set_my_latch_unsafe();
pub fn callback_get_lfc_metrics_unsafe() -> LfcMetrics;
}
// Compile unit tests with dummy versions of the functions. Unit tests
// cannot call back into the C code. (As of this writing, no unit tests
// even exists in the communicator package, but the code coverage build
// still builds these and tries to link with the external C code.)
#[cfg(test)]
unsafe fn callback_set_my_latch_unsafe() {
panic!("not usable in unit tests");
}
#[cfg(test)]
unsafe fn callback_get_lfc_metrics_unsafe() -> LfcMetrics {
panic!("not usable in unit tests");
}
// safe wrappers
pub(super) fn callback_set_my_latch() {