On Wed, Aug 02, 2023 at 12:40:51PM +0000, Tage Johansson wrote:
Make it possible to run Rust tests with Valgrind with
`make check-valgrind` in the rust directory.
---
rust/Makefile.am | 3 +++
rust/run-tests.sh | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile.am b/rust/Makefile.am
index 251a139..19dbf02 100644
--- a/rust/Makefile.am
+++ b/rust/Makefile.am
@@ -63,6 +63,9 @@ TESTS_ENVIRONMENT = \
LOG_COMPILER = $(top_builddir)/run
TESTS = run-tests.sh
+check-valgrind:
+ LIBNBD_VALGRIND=1 $(MAKE) check
+
endif
clean-local:
diff --git a/rust/run-tests.sh b/rust/run-tests.sh
index 005000e..da7852a 100755
--- a/rust/run-tests.sh
+++ b/rust/run-tests.sh
@@ -23,4 +23,8 @@ set -x
requires nbdkit --version
-$CARGO test -- --nocapture
+if [ -z "$VG" ]; then
+ $CARGO test -- --nocapture
+else
+ $CARGO test --config "target.'cfg(all())'.runner =
\"$VG\"" -- --nocapture
+fi
--
2.41.0
Reviewed-by: Richard W.M. Jones <rjones(a)redhat.com>
Can this be moved to third in the series?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org