Skip to content

Commit 853d111

Browse files
authored
Build: Support make test when PROG_SUFFIX is used (#2885)
Closes #2883 Support a new environment variable `VALKEY_PROG_SUFFIX` in the test framework, which can be used for running tests if the binaries are compiled with a program suffix. For example, if the binaries are compiled using `make PROG_SUFFIX=-alt` to produce binaries named valkey-server-alt, valkey-cli-alt, etc., run the tests against these binaries using `VALKEY_PROG_SUFFIX=-alt ./runtest` or simply using `make test`. Now the test with the make variable `PROG_SUFFIX` works well. ``` % make PROG_SUFFIX="-alt" ... ... CC trace/trace_aof.o LINK valkey-server-alt INSTALL valkey-sentinel-alt CC valkey-cli.o CC serverassert.o CC cli_common.o CC cli_commands.o LINK valkey-cli-alt CC valkey-benchmark.o LINK valkey-benchmark-alt INSTALL valkey-check-rdb-alt INSTALL valkey-check-aof-alt Hint: It's a good idea to run 'make test' ;) % % make test cd src && /Library/Developer/CommandLineTools/usr/bin/make test CC Makefile.dep CC release.o LINK valkey-server-alt INSTALL valkey-check-aof-alt INSTALL valkey-check-rdb-alt LINK valkey-cli-alt LINK valkey-benchmark-alt Cleanup: may take some time... OK Starting test server at port 21079 [ready]: 39435 Testing unit/pubsub ``` Signed-off-by: Zhijun <[email protected]>
1 parent 3fd0942 commit 853d111

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ distclean: clean
590590
.PHONY: distclean
591591

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

595595
test-unit: $(ENGINE_UNIT_TESTS)
596596
./$(ENGINE_UNIT_TESTS)

tests/support/set_executable_path.tcl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ if {[info exists ::env(VALKEY_BIN_DIR)]} {
88
set ::VALKEY_BIN_DIR "[pwd]/src"
99
}
1010

11+
# Optional program suffix (e.g. `make PROG_SUFFIX=-alt` will create binary valkey-server-alt).
12+
# Passed from `make test` as environment variable VALKEY_PROG_SUFFIX.
13+
set ::VALKEY_PROG_SUFFIX [expr {
14+
[info exists ::env(VALKEY_PROG_SUFFIX)] ? $::env(VALKEY_PROG_SUFFIX) : ""
15+
}]
16+
1117
# Helper to build absolute paths
1218
proc valkey_bin_absolute_path {name} {
13-
set p [file join $::VALKEY_BIN_DIR $name]
14-
return $p
19+
set full_name "${name}${::VALKEY_PROG_SUFFIX}"
20+
return [file join $::VALKEY_BIN_DIR $full_name]
1521
}
1622

1723
set ::VALKEY_SERVER_BIN [valkey_bin_absolute_path "valkey-server"]

0 commit comments

Comments
 (0)