From 6bce5db3063f2e787ee261b19a7f2b8e511f7d96 Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Wed, 20 Mar 2024 07:38:17 +0100 Subject: [PATCH] common: keep Valgrind enabled by default Signed-off-by: Tomasz Gromadzki --- .github/workflows/pmem_test_matrix.yml | 2 +- .github/workflows/pmem_tests.yml | 11 +++++++++++ ChangeLog | 2 +- INSTALL.md | 4 ++-- src/core/valgrind_internal.h | 2 +- src/examples/Makefile.inc | 4 ++++ src/test/valgrind_check/valgrind_check.c | 1 - 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pmem_test_matrix.yml b/.github/workflows/pmem_test_matrix.yml index e0965aaceac..4b62b0c6788 100644 --- a/.github/workflows/pmem_test_matrix.yml +++ b/.github/workflows/pmem_test_matrix.yml @@ -38,7 +38,7 @@ jobs: - name: Test prepare uses: ./.github/actions/pmem_test_prepare with: - valgrind: ${{ fromJSON(inputs.valgrind) }} + valgrind: ${{ inputs.valgrind }} - name: Test run uses: ./.github/actions/pmem_test_run diff --git a/.github/workflows/pmem_tests.yml b/.github/workflows/pmem_tests.yml index 0efa1a5469b..7f86198483c 100644 --- a/.github/workflows/pmem_tests.yml +++ b/.github/workflows/pmem_tests.yml @@ -28,6 +28,7 @@ jobs: force_enable: '["pmemcheck", "memcheck"]' valgrind: 1 + # Test the default build with force-enabled Valgrind tooling for thread error # detection. Thread: @@ -38,6 +39,7 @@ jobs: # 9h = 7h20m (the longest workflow execution time) + ~20% leeway. timeout_minutes: 540 + # Static builds are tested in this limited scope only. static: name: Static @@ -108,3 +110,12 @@ jobs: uses: ./.github/actions/pmem_test_run with: build: nondebug # only the production build is considered + + + # Test the default build with the basic test suite. + Basic_w_Valgrind: + uses: ./.github/workflows/pmem_test_matrix.yml + with: + # Exclude all Valgrind tests but keep Valgrind tools built-in. + force_enable: '["none"]' + valgrind: 1 diff --git a/ChangeLog b/ChangeLog index 01d557196ff..5fb04330844 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,7 @@ Mon Dec 4 2023 Oksana Sałyk - Reduces libpmemobj's stack usage below the 11kB threshold. - Fixing minor Coverity issues - Add a new toolset for stack usage analysis (https://github.com/pmem/pmdk/tree/master/utils/call_stacks_analysis) - + Tue Aug 8 2023 Oksana Sałyk diff --git a/INSTALL.md b/INSTALL.md index 0f5ddc4f6b0..a8876d51c11 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -108,10 +108,10 @@ Both building and installation scripts are very flexible. To see additional opti ### Memory Management Tools The PMDK libraries support standard Valgrind DRD, Helgrind and Memcheck, as well as a PM-aware version of [Valgrind](https://github.com/pmem/valgrind). -By default, support for all tools is disabled. If you wish to enable it, supply the compiler with `VALGRIND` flag set to 1: +By default, support for all tools is enabled. If you wish to disable it, supply the compiler with `VALGRIND` flag set to 0: ```sh -make VALGRIND=1 +make VALGRIND=0 ``` The `SANITIZE` flag allows the libraries to be tested with various diff --git a/src/core/valgrind_internal.h b/src/core/valgrind_internal.h index c07da17be94..99dc553664a 100644 --- a/src/core/valgrind_internal.h +++ b/src/core/valgrind_internal.h @@ -10,7 +10,7 @@ #if !defined(__riscv) && !defined(__loongarch64) #ifndef VALGRIND_ENABLED -#error VALGRIND_ENABLED must be explicitly set +#define VALGRIND_ENABLED 1 #endif #endif diff --git a/src/examples/Makefile.inc b/src/examples/Makefile.inc index 3481e348a4e..17ec52becc8 100644 --- a/src/examples/Makefile.inc +++ b/src/examples/Makefile.inc @@ -23,6 +23,10 @@ CFLAGS += -fsanitize=$(SANITIZE) CXXFLAGS += -fsanitize=$(SANITIZE) LDFLAGS += -fsanitize=$(SANITIZE) endif +ifeq ($(VALGRIND),0) +CFLAGS += -DVALGRIND_ENABLED=0 +CXXFLAGS += -DVALGRIND_ENABLED=0 +endif INCS = -I$(INCDIR) -I. -I$(TOP_SRC)/examples $(OS_INCS) LIBS += $(OS_LIBS) $(LIBUUID) diff --git a/src/test/valgrind_check/valgrind_check.c b/src/test/valgrind_check/valgrind_check.c index b719be9a0b1..6196110249b 100644 --- a/src/test/valgrind_check/valgrind_check.c +++ b/src/test/valgrind_check/valgrind_check.c @@ -7,7 +7,6 @@ * usage: valgrind_check * */ - #include "valgrind_internal.h" #ifndef VALGRIND_ENABLED