From a1555623bc0d04a743cc47c229b7f46a7ff934a9 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 7 Feb 2022 19:49:57 +0100 Subject: [PATCH] pytest: Mark Rust-dependent tests as skipped with VALGRIND `valgrind` reports seems to flag some memory accesses that are ok in the Rust standard library, which we can consider false positives for our purposes: ```Valgrind error file: valgrind-errors.69147 ==69147== Syscall param statx(file_name) points to unaddressable byte(s) ==69147== at 0x4B049FE: statx (statx.c:29) ==69147== by 0x2E2DA0: std::sys::unix::fs::try_statx (weak.rs:139) ==69147== by 0x2D7BD5: ::read_to_string (fs.rs:784) ==69147== by 0x2632CE: num_cpus::linux::Cgroup::param (linux.rs:214) ==69147== by 0x263179: num_cpus::linux::Cgroup::quota_us (linux.rs:203) ==69147== by 0x263002: num_cpus::linux::Cgroup::cpu_quota (linux.rs:188) ==69147== by 0x262C01: num_cpus::linux::load_cgroups (linux.rs:149) ==69147== by 0x26289D: num_cpus::linux::init_cgroups (linux.rs:129) ==69147== by 0x26BD88: core::ops::function::FnOnce::call_once (function.rs:227) ==69147== by 0x26B749: std::sync::once::Once::call_once::{{closure}} (once.rs:262) ==69147== by 0x139717: std::sync::once::Once::call_inner (once.rs:419) ==69147== by 0x26B6D5: std::sync::once::Once::call_once (once.rs:262) ==69147== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==69147== ==69147== Syscall param statx(buf) points to unaddressable byte(s) ==69147== at 0x4B049FE: statx (statx.c:29) ==69147== by 0x2E2DA0: std::sys::unix::fs::try_statx (weak.rs:139) ==69147== by 0x2D7BD5: ::read_to_string (fs.rs:784) ==69147== by 0x2632CE: num_cpus::linux::Cgroup::param (linux.rs:214) ==69147== by 0x263179: num_cpus::linux::Cgroup::quota_us (linux.rs:203) ==69147== by 0x263002: num_cpus::linux::Cgroup::cpu_quota (linux.rs:188) ==69147== by 0x262C01: num_cpus::linux::load_cgroups (linux.rs:149) ==69147== by 0x26289D: num_cpus::linux::init_cgroups (linux.rs:129) ==69147== by 0x26BD88: core::ops::function::FnOnce::call_once (function.rs:227) ==69147== by 0x26B749: std::sync::once::Once::call_once::{{closure}} (once.rs:262) ==69147== by 0x139717: std::sync::once::Once::call_inner (once.rs:419) ==69147== by 0x26B6D5: std::sync::once::Once::call_once (once.rs:262) ==69147== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==69147== ``` --- tests/test_cln_rs.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/test_cln_rs.py b/tests/test_cln_rs.py index f1f04842a..678f03c48 100644 --- a/tests/test_cln_rs.py +++ b/tests/test_cln_rs.py @@ -5,11 +5,19 @@ import subprocess import pytest -# Skip the entire module if we don't have Rust. -pytestmark = pytest.mark.skipif( - env('RUST') != '1', - reason='RUST is not enabled, skipping rust-dependent tests' -) +# Skip the entire module if we don't have Rust. The same is true for +# VALGRIND, since it sometimes causes false positives in +# `std::sync::Once` +pytestmark = [ + pytest.mark.skipif( + env('RUST') != '1', + reason='RUST is not enabled skipping rust-dependent tests' + ), + pytest.mark.skipif( + env('VALGRIND') == '1', + reason='VALGRIND is enabled skipping rust-dependent tests, as they may report false positives.' + ), +] def test_rpc_client(node_factory):