Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c11fc88
Add gtest support for unit testing
harrylhl Nov 17, 2025
35b1e10
gtest rev2
harrylhl Dec 16, 2025
bc0e5fa
Apply suggestions from code review
harrylin98 Dec 17, 2025
81059f2
Apply suggestions from code review
harrylin98 Dec 17, 2025
9992fb3
Cleanup googletest and gtest-parallel after tests in ci.yml
harrylhl Dec 17, 2025
e8b4468
Correct wrappers.h format
harrylhl Dec 17, 2025
2bc7e8d
CI job failure fixes
harrylhl Dec 17, 2025
dff09f0
Merge branch 'unstable' into unstable_gtest_PR
harrylhl Dec 19, 2025
3b06dbe
Remove unnecessary command for cmake
madolson Dec 20, 2025
e8b192c
Update src/gtest/README.md
harrylin98 Dec 22, 2025
f10255f
Merge branch 'valkey-io:unstable' into unstable_gtest_PR
harrylin98 Dec 22, 2025
a582b2b
Addressing comments and fix CI job issues.
harrylhl Dec 22, 2025
5eda70b
Merge branch 'valkey-io:unstable' into unstable_gtest_PR
harrylin98 Dec 29, 2025
4989520
Add C++ specific clang-format configuration for GoogleTest code style
harrylhl Dec 31, 2025
4d500e1
Support GoogleTest on MacOS
harrylhl Jan 5, 2026
8d86d69
Merge branch 'valkey-io:unstable' into unstable_gtest_PR
harrylin98 Jan 6, 2026
0e40a78
Merge pull request #7 from harrylin98/unstable_gtest_PR
JimB123 Jan 7, 2026
0672e2b
New command flag to indicate modification of first key only
JimB123 Nov 25, 2025
24346be
Merge pull request #8 from JimB123/f-firstkey
JimB123 Jan 8, 2026
df92fb5
forkless save
JimB123 Oct 30, 2025
b277af9
Merge pull request #10 from JimB123/flocal
JimB123 Jan 20, 2026
f3b412b
Allocate metadata for each key to support forkless save operations
asagege Jan 16, 2026
4597bc8
Refactor object.c and tests
asagege Jan 23, 2026
716cdbb
Refactor test_object for metadata
asagege Jan 28, 2026
2a16650
forkless save
JimB123 Oct 30, 2025
2b3ad6b
Contribute threadsave
Jan 22, 2026
458c169
Add BGSAVE THREAD
Jan 30, 2026
410eef1
bgiteration patches
Jan 29, 2026
5d88df2
More fixes
Jan 30, 2026
38f32d4
Support threadsave cancelation
Feb 9, 2026
43b6626
Add lastbgsave_type and cur_bgsave_type
Feb 9, 2026
b5bbfca
Parameterize tcl tests
Feb 9, 2026
9b37d30
Also check for running threadsave in places where we check for runnin…
Feb 10, 2026
9ffecbb
Translate test_amzsave_blocks_bgsave/test_bgsave_blocks_amzsave
Feb 10, 2026
8ecb57b
Translate test_amzsave_contains_expired_keys
Feb 10, 2026
bdf21ee
patch bgiteration to check for uninitialized db in isDbSignificant
Feb 10, 2026
471f09e
Add createComplexDatasetForVerification helper function
Feb 16, 2026
22578aa
Translate test_flushdb_with_multi_db_threadsave
Feb 10, 2026
eef647a
Translate test_swapdb_during_save
Feb 11, 2026
a1ff396
Translate test_delete_all_keys_after_swapdb
Feb 16, 2026
cacd341
Translate test_deleting_keys
Feb 16, 2026
bce84ee
Translate test_flush_with_items_in_single_database
Feb 16, 2026
f4dd250
Translate test_multiple_databases_modifications
Feb 16, 2026
23dec05
Translate test_modify_new_keys
Feb 16, 2026
cf3d5a3
Translate test_blocking_commands
Feb 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .config/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ optin = "optin"
smove = "smove"
Parth = "Parth" # seems like the spellchecker does not like it is similar to "Path"
nd = "nd"
threadsave = "threadsave"

[type.c]
extend-ignore-re = [
Expand Down Expand Up @@ -56,6 +57,7 @@ limite = "limite"
pn = "pn"
seeked = "seeked"
tre = "tre"
dbe = "dbe"

[type.systemd.extend-words]
# systemd = .conf
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- name: unit tests
run: |
./src/valkey-unit-tests
./src/gtest/valkey-unit-gtests
rm -rf deps/googletest
rm -rf deps/gtest-parallel

test-ubuntu-latest-compatibility:
runs-on: ubuntu-latest
Expand All @@ -55,6 +58,10 @@ jobs:
- {version: "8.1.4", file: "valkey-8.1.4-noble-x86_64.tar.gz"}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install modern CMake
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: make
# Fail build if there are warnings
# build with TLS just for compilation coverage
Expand Down Expand Up @@ -84,10 +91,12 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: cmake and make
run: |
sudo apt-get update
sudo apt-get install -y cmake libssl-dev
cmake --version
mkdir -p build-release
cd build-release
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_TESTS=yes
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_TESTS=yes -DBUILD_UNIT_GTESTS=yes
make -j$(nproc)
- name: test
run: |
Expand All @@ -102,6 +111,9 @@ jobs:
- name: unit tests
run: |
./build-release/bin/valkey-unit-tests
./build-release/bin/valkey-unit-gtests
rm -rf deps/googletest
rm -rf deps/gtest-parallel

test-sanitizer-address:
runs-on: ubuntu-latest
Expand All @@ -117,7 +129,11 @@ jobs:
- name: module api test
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs
- name: unit tests
run: ./src/valkey-unit-tests
run: |
./src/valkey-unit-tests
./src/gtest/valkey-unit-gtests
rm -rf deps/googletest
rm -rf deps/gtest-parallel

test-rdma:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -157,9 +173,16 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install build dependencies
run: |
brew install llvm
- name: make
# Build with additional upcoming features
run: make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes
run: |
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export CC=/opt/homebrew/opt/llvm/bin/clang
export CXX=/opt/homebrew/opt/llvm/bin/clang++
make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes

build-32bit:
runs-on: ubuntu-latest
Expand All @@ -178,6 +201,9 @@ jobs:
- name: unit tests
run: |
./src/valkey-unit-tests
./src/gtest/valkey-unit-gtests
rm -rf deps/googletest
rm -rf deps/gtest-parallel

build-libc-malloc:
runs-on: ubuntu-latest
Expand All @@ -194,7 +220,7 @@ jobs:

- name: make
run: |
dnf -y install epel-release gcc gcc-c++ make procps-ng which
dnf -y install epel-release gcc gcc-c++ make procps-ng which git cmake
make -j4 SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes

format-yaml:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
ref: ${{ env.GITHUB_HEAD_REF }}
- name: make
run: |
apt-get update && apt-get install -y make gcc-13
apt-get update && apt-get install -y make gcc-13 git cmake g++ python3
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
make all-with-unit-tests CC=gcc OPT=-O3 SERVER_CFLAGS='-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3'
- name: testprep
Expand Down Expand Up @@ -332,7 +332,7 @@ jobs:
ref: ${{ env.GITHUB_HEAD_REF }}
- name: make
run: |
sudo apt-get update && sudo apt-get install libc6-dev-i386
sudo apt-get update && sudo apt-get install libc6-dev-i386 g++-multilib
make 32bit SERVER_CFLAGS='-Werror'
- name: testprep
run: sudo apt-get install tcl8.6 tclx
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dump*.rdb
*-sentinel
*-server
*-unit-tests
*-unit-gtests
doc-tools
release
misc/*
Expand Down Expand Up @@ -54,3 +55,5 @@ build-debug/
build-release/
cmake-build-debug/
cmake-build-release/
__pycache__
src/gtest/.flags
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ endif ()
# Options
option(BUILD_LUA "Build Valkey Lua scripting engine" ON)
option(BUILD_UNIT_TESTS "Build valkey-unit-tests" OFF)
option(BUILD_UNIT_GTESTS "Build valkey-unit-gtests" OFF)
option(BUILD_TEST_MODULES "Build all test modules" OFF)
option(BUILD_EXAMPLE_MODULES "Build example modules" OFF)

Expand All @@ -41,6 +42,7 @@ unset(CLANG CACHE)
unset(BUILD_RDMA_MODULE CACHE)
unset(BUILD_TLS_MODULE CACHE)
unset(BUILD_UNIT_TESTS CACHE)
unset(BUILD_UNIT_GTESTS CACHE)
unset(BUILD_TEST_MODULES CACHE)
unset(BUILD_EXAMPLE_MODULES CACHE)
unset(USE_TLS CACHE)
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ After building Valkey, it is a good idea to test it using:

The above runs the main integration tests. Additional tests are started using:

% make test-unit # Unit tests
% make test-unit # Unit tests (both C unit tests and gtest unit tests)
% make test-modules # Tests of the module API
% make test-sentinel # Valkey Sentinel integration tests
% make test-cluster # Valkey Cluster integration tests

More about running the integration tests can be found in
[tests/README.md](tests/README.md) and for unit tests, see
[src/unit/README.md](src/unit/README.md).
[tests/README.md](tests/README.md), for unit tests, see
[src/unit/README.md](src/unit/README.md) and [src/gtest/README.md](src/gtest/README.md).

## Performance monitoring

Expand Down Expand Up @@ -333,6 +333,7 @@ Other options supported by Valkey's `CMake` build system:
- `-DBUILD_MALLOC=<libc|jemalloc|tcmalloc|tcmalloc_minimal>` choose the allocator to use. Default on Linux: `jemalloc`, for other OS: `libc`
- `-DBUILD_SANITIZER=<address|thread|undefined>` build with address sanitizer enabled. Default: disabled (no sanitizer)
- `-DBUILD_UNIT_TESTS=[yes|no]` when set, the build will produce the executable `valkey-unit-tests`. Default: `no`
- `-DBUILD_UNIT_GTESTS=[yes|no]` when set, the build will produce gtest unit tests executable `valkey-unit-gtests`. Default: `no`
- `-DBUILD_TEST_MODULES=[yes|no]` when set, the build will include the modules located under the `tests/modules` folder. Default: `no`
- `-DBUILD_EXAMPLE_MODULES=[yes|no]` when set, the build will include the example modules located under the `src/modules` folder. Default: `no`

Expand Down
25 changes: 25 additions & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ distclean:
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
-(cd fpconv && $(MAKE) clean) > /dev/null || true
-(cd fast_float_c_interface && $(MAKE) clean) > /dev/null || true
-(cd googletest && rm -rf build) > /dev/null || true
-(rm -f .make-*)

.PHONY: distclean
Expand Down Expand Up @@ -128,3 +129,27 @@ fast_float_c_interface: .make-prerequisites
cd fast_float_c_interface && $(MAKE)

.PHONY: fast_float_c_interface

CMAKE := $(shell command -v cmake3 || command -v cmake)

gtest: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
@if [ ! -f googletest/CMakeLists.txt ]; then \
echo "Downloading googletest..."; \
rm -rf googletest; \
git clone --depth 1 --branch v1.8.x https://github.com/google/googletest.git googletest; \
fi
@if [ ! -f gtest-parallel/gtest_parallel.py ]; then \
echo "Downloading gtest-parallel..."; \
rm -rf gtest-parallel; \
git clone --depth 1 https://github.com/google/gtest-parallel.git gtest-parallel; \
fi
cd googletest && $(CMAKE) -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$(CFLAGS)" \
-DCMAKE_CXX_FLAGS="$(CFLAGS)" \
-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
-DCMAKE_POLICY_VERSION_MINIMUM=3.17
cd googletest && $(CMAKE) --build build --parallel

.PHONY: gtest
23 changes: 22 additions & 1 deletion deps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ should be provided by the operating system.
* **linenoise** is a readline replacement. It is developed by the same authors of Valkey but is managed as a separated project and updated as needed.
* **lua** is Lua 5.1 with minor changes for security and additional libraries.
* **hdr_histogram** Used for per-command latency tracking histograms.
* **fast_float** is a replacement for strtod to convert strings to floats efficiently.
* **fast_float** is a replacement for strtod to convert strings to floats efficiently.
* **googletest** is Google's testing framework used for gtest unit tests.
* **gtest-parallel** is a script for running googletest tests in parallel.

How to upgrade the above dependencies
===
Expand Down Expand Up @@ -121,3 +123,22 @@ To upgrade the library,
2. cd fast_float
3. Invoke "python3 ./script/amalgamate.py --output fast_float.h"
4. Copy fast_float.h file to "deps/fast_float/".

googletest and gtest-parallel
---

To upgrade googletest and gtest-parallel:

```sh
# googletest (v1.8.x)
rm -rf googletest
git clone --branch v1.8.x --depth 1 https://github.com/google/googletest.git googletest
rm -rf googletest/.git

# gtest-parallel (master)
rm -rf gtest-parallel
git clone --depth 1 https://github.com/google/gtest-parallel.git gtest-parallel
rm -rf gtest-parallel/.git
```

Commit the changes.
1 change: 1 addition & 0 deletions deps/googletest
Submodule googletest added at dea021
1 change: 1 addition & 0 deletions deps/gtest-parallel
Submodule gtest-parallel added at cd488b
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.gcov
valkey.info
lcov-html
generated_*
gtest/wrapped/
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ if (BUILD_UNIT_TESTS)
add_subdirectory(unit)
endif ()

if (BUILD_UNIT_GTESTS)
add_subdirectory(gtest)
endif ()

# Friendly hint like the Makefile one
file(RELATIVE_PATH _CMAKE_DIR_RELATIVE_PATH "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
add_custom_target(hint ALL
Expand All @@ -118,4 +122,4 @@ add_custom_target(hint ALL
COMMAND ${CMAKE_COMMAND} -E echo "Hint: It is a good idea to run tests with your CMake-built binaries \\;\\)"
COMMAND ${CMAKE_COMMAND} -E echo " ./${_CMAKE_DIR_RELATIVE_PATH}/runtest"
COMMAND ${CMAKE_COMMAND} -E echo ""
)
)
26 changes: 21 additions & 5 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ ENGINE_NAME=valkey
SERVER_NAME=$(ENGINE_NAME)-server$(PROG_SUFFIX)
ENGINE_SENTINEL_NAME=$(ENGINE_NAME)-sentinel$(PROG_SUFFIX)
ENGINE_TRACE_OBJ=trace/trace.o trace/trace_commands.o trace/trace_db.o trace/trace_cluster.o trace/trace_server.o trace/trace_rdb.o trace/trace_aof.o
ENGINE_SERVER_OBJ=threads_mngr.o adlist.o vector.o quicklist.o ae.o anet.o dict.o hashtable.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o memory_prefetch.o io_threads.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o cluster_migrateslots.o endianconv.o commandlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o valkey-check-rdb.o valkey-check-aof.o geo.o lazyfree.o module.o lrulfu.o evict.o expire.o geohash.o geohash_helper.o childinfo.o allocator_defrag.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o lolwut9.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script.o functions.o commands.o strl.o connection.o unix.o logreqres.o rdma.o scripting_engine.o entry.o vset.o fifo.o mutexqueue.o
ENGINE_SERVER_OBJ=threads_mngr.o adlist.o vector.o quicklist.o ae.o anet.o dict.o hashtable.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o memory_prefetch.o io_threads.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o cluster_migrateslots.o endianconv.o commandlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o valkey-check-rdb.o valkey-check-aof.o geo.o lazyfree.o module.o lrulfu.o evict.o expire.o geohash.o geohash_helper.o childinfo.o allocator_defrag.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o lolwut9.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script.o functions.o commands.o strl.o connection.o unix.o logreqres.o rdma.o scripting_engine.o entry.o vset.o fifo.o mutexqueue.o bgiteration.o bgiteration_temp.o threadsave.o
ENGINE_SERVER_OBJ+=$(ENGINE_TRACE_OBJ)
ENGINE_CLI_NAME=$(ENGINE_NAME)-cli$(PROG_SUFFIX)
ENGINE_CLI_OBJ=anet.o adlist.o dict.o valkey-cli.o zmalloc.o release.o ae.o serverassert.o crcspeed.o crccombine.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o cli_commands.o sds.o util.o sha256.o
Expand All @@ -455,6 +455,7 @@ ENGINE_LIB_NAME=lib$(ENGINE_NAME).a
ENGINE_TEST_FILES:=$(wildcard unit/*.c)
ENGINE_TEST_OBJ:=$(sort $(patsubst unit/%.c,unit/%.o,$(ENGINE_TEST_FILES)))
ENGINE_UNIT_TESTS:=$(ENGINE_NAME)-unit-tests$(PROG_SUFFIX)
ENGINE_UNIT_GTESTS:=$(ENGINE_NAME)-unit-gtests$(PROG_SUFFIX)
ALL_SOURCES=$(sort $(patsubst %.o,%.c,$(ENGINE_SERVER_OBJ) $(ENGINE_CLI_OBJ) $(ENGINE_BENCHMARK_OBJ)))

USE_FAST_FLOAT?=no
Expand All @@ -468,6 +469,8 @@ ifeq ($(USE_FAST_FLOAT),yes)
FINAL_LIBS += $(FAST_FLOAT_STRTOD_OBJECT)
endif

DEPENDENCY_TARGETS+= gtest

all: $(SERVER_NAME) $(ENGINE_SENTINEL_NAME) $(ENGINE_CLI_NAME) $(ENGINE_BENCHMARK_NAME) $(ENGINE_CHECK_RDB_NAME) $(ENGINE_CHECK_AOF_NAME) $(TLS_MODULE) $(RDMA_MODULE) $(LUA_MODULE)
@echo ""
@echo "Hint: It's a good idea to run 'make test' ;)"
Expand All @@ -482,7 +485,7 @@ endif

.PHONY: all

all-with-unit-tests: all $(ENGINE_UNIT_TESTS)
all-with-unit-tests: all $(ENGINE_UNIT_TESTS) $(ENGINE_UNIT_GTESTS)
.PHONY: all

persist-settings: distclean
Expand All @@ -502,6 +505,7 @@ persist-settings: distclean
echo SERVER_LDFLAGS=$(SERVER_LDFLAGS) >> .make-settings
echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings
echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings
echo ENGINE_SERVER_OBJ=$(ENGINE_SERVER_OBJ) >> .make-settings
-(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS))

.PHONY: persist-settings
Expand Down Expand Up @@ -598,7 +602,7 @@ endif
commands.c: $(COMMANDS_DEF_FILENAME).def

clean:
rm -rf $(SERVER_NAME) $(ENGINE_SENTINEL_NAME) $(ENGINE_CLI_NAME) $(ENGINE_BENCHMARK_NAME) $(ENGINE_CHECK_RDB_NAME) $(ENGINE_CHECK_AOF_NAME) $(ENGINE_UNIT_TESTS) $(ENGINE_LIB_NAME) unit/*.o unit/*.d trace/*.o trace/*.d *.o *.gcda *.gcno *.gcov valkey.info lcov-html Makefile.dep *.so
rm -rf $(SERVER_NAME) $(ENGINE_SENTINEL_NAME) $(ENGINE_CLI_NAME) $(ENGINE_BENCHMARK_NAME) $(ENGINE_CHECK_RDB_NAME) $(ENGINE_CHECK_AOF_NAME) $(ENGINE_UNIT_TESTS) $(ENGINE_UNIT_GTESTS) $(ENGINE_LIB_NAME) unit/*.o unit/*.d trace/*.o trace/*.d *.o *.gcda *.gcno *.gcov valkey.info lcov-html Makefile.dep *.so
rm -f $(DEP)
-(cd modules/lua && $(MAKE) clean)

Expand All @@ -608,15 +612,27 @@ distclean: clean
-(cd ../deps && $(MAKE) distclean)
-(cd modules && $(MAKE) clean)
-(cd ../tests/modules && $(MAKE) clean)
-(cd gtest && $(MAKE) clean)
-(rm -f .make-*)
-(find gtest -type d -name __pycache__ -exec rm -rf {} +)

.PHONY: distclean

test: $(SERVER_NAME) $(ENGINE_CHECK_AOF_NAME) $(ENGINE_CHECK_RDB_NAME) $(ENGINE_CLI_NAME) $(ENGINE_BENCHMARK_NAME)
@(cd ..; VALKEY_PROG_SUFFIX="$(PROG_SUFFIX)" ./runtest)

test-unit: $(ENGINE_UNIT_TESTS)
./$(ENGINE_UNIT_TESTS)
test-unit: $(ENGINE_UNIT_TESTS) $(ENGINE_UNIT_GTESTS)
@echo "Running C unit tests..."
./$(ENGINE_UNIT_TESTS) || echo "C unit tests failed"
@echo "Running gtest unit tests..."
./gtest/$(ENGINE_UNIT_GTESTS) || echo "gtest unit tests failed"

test-gtest:
@(cd gtest && $(MAKE) test-gtest)

# valkey-unit-gtests
$(ENGINE_UNIT_GTESTS): $(ENGINE_LIB_NAME)
@(cd gtest && $(MAKE) $(ENGINE_UNIT_GTESTS))

test-modules: $(SERVER_NAME)
@(cd ..; ./runtest-moduleapi)
Expand Down
Loading