summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2023-02-16 10:50:58 +0200
committerGitHub <noreply@github.com>2023-02-16 10:50:58 +0200
commit5b61b0dc6d2579ee484fa6cf29bfac59513f84ab (patch)
tree0f4bbced22cb5c2af8a9b9befa3e091e2e7c138e
parent233abbbe03211ca700e10f827d289da24d9bd7e3 (diff)
downloadredis-5b61b0dc6d2579ee484fa6cf29bfac59513f84ab.tar.gz
skip new page cache reclame unit test when running in valgrind (#11808)
the new test is incompatible with valgrind. added a new `--valgrind` argument to `redis-server tests` mode, which will cause that test to be skipped..
-rw-r--r--.github/workflows/daily.yml4
-rw-r--r--src/server.c1
-rw-r--r--src/testhelp.h1
-rw-r--r--src/util.c6
4 files changed, 9 insertions, 3 deletions
diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml
index f1108ff6e..71e43002c 100644
--- a/.github/workflows/daily.yml
+++ b/.github/workflows/daily.yml
@@ -406,7 +406,7 @@ jobs:
- name: unittest
if: true && !contains(github.event.inputs.skiptests, 'unittest')
run: |
- valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all
+ valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all --valgrind
if grep -q 0x err.txt; then cat err.txt; exit 1; fi
test-valgrind-no-malloc-usable-size-test:
@@ -463,7 +463,7 @@ jobs:
- name: unittest
if: true && !contains(github.event.inputs.skiptests, 'unittest')
run: |
- valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all
+ valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all --valgrind
if grep -q 0x err.txt; then cat err.txt; exit 1; fi
test-sanitizer-address:
diff --git a/src/server.c b/src/server.c
index 042d711a1..eaba32f87 100644
--- a/src/server.c
+++ b/src/server.c
@@ -6955,6 +6955,7 @@ int main(int argc, char **argv) {
char *arg = argv[j];
if (!strcasecmp(arg, "--accurate")) flags |= REDIS_TEST_ACCURATE;
else if (!strcasecmp(arg, "--large-memory")) flags |= REDIS_TEST_LARGE_MEMORY;
+ else if (!strcasecmp(arg, "--valgrind")) flags |= REDIS_TEST_VALGRIND;
}
if (!strcasecmp(argv[2], "all")) {
diff --git a/src/testhelp.h b/src/testhelp.h
index 394a9a6c0..d5be80e79 100644
--- a/src/testhelp.h
+++ b/src/testhelp.h
@@ -41,6 +41,7 @@
#define REDIS_TEST_ACCURATE (1<<0)
#define REDIS_TEST_LARGE_MEMORY (1<<1)
+#define REDIS_TEST_VALGRIND (1<<2)
extern int __failed_tests;
extern int __test_num;
diff --git a/src/util.c b/src/util.c
index a12846943..d33f4522a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1132,6 +1132,7 @@ int reclaimFilePageCache(int fd, size_t offset, size_t length) {
#ifdef REDIS_TEST
#include <assert.h>
#include <sys/mman.h>
+#include "testhelp.h"
static void test_string2ll(void) {
char buf[32];
@@ -1399,8 +1400,11 @@ int utilTest(int argc, char **argv, int flags) {
test_ld2string();
test_fixedpoint_d2string();
#if defined(__linux__)
- test_reclaimFilePageCache();
+ if (!(flags & REDIS_TEST_VALGRIND)) {
+ test_reclaimFilePageCache();
+ }
#endif
+ printf("Done testing util\n");
return 0;
}
#endif