summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2014-04-09 22:27:18 -0700
committerPieter Noordhuis <pcnoordhuis@gmail.com>2014-04-09 22:27:18 -0700
commitfa8bcca1dcf8fd87f3b3ce2853d1fe32526a0afa (patch)
tree9b4dc4b065f9f72226c8129322dfbc1be6db9ebc /Makefile
parent065e90557c2f2bce6205c5006144bec75638836f (diff)
parent4369ee5d086967883ee91597540a599e543eacd6 (diff)
Merge pull request #234 from mattsta/next-version
Next version of hiredis
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 14 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index c8632b4..969115b 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,18 @@ LIBNAME=libhiredis
HIREDIS_MAJOR=0
HIREDIS_MINOR=10
+# redis-server configuration used for testing
+REDIS_PORT=56379
+REDIS_SERVER=redis-server
+define REDIS_TEST_CONFIG
+ daemonize yes
+ pidfile /tmp/hiredis-test-redis.pid
+ port $(REDIS_PORT)
+ bind 127.0.0.1
+ unixsocket /tmp/hiredis-test-redis.sock
+endef
+export REDIS_TEST_CONFIG
+
# Fallback to gcc when $CC is not in $PATH.
CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
OPTIMIZATION?=-O3
@@ -97,14 +109,8 @@ test: hiredis-test
./hiredis-test
check: hiredis-test
- echo \
- "daemonize yes\n" \
- "pidfile /tmp/hiredis-test-redis.pid\n" \
- "port 56379\n" \
- "bind 127.0.0.1\n" \
- "unixsocket /tmp/hiredis-test-redis.sock" \
- | redis-server -
- ./hiredis-test -h 127.0.0.1 -p 56379 -s /tmp/hiredis-test-redis.sock || \
+ @echo "$$REDIS_TEST_CONFIG" | $(REDIS_SERVER) -
+ ./hiredis-test -h 127.0.0.1 -p $(REDIS_PORT) -s /tmp/hiredis-test-redis.sock || \
( kill `cat /tmp/hiredis-test-redis.pid` && false )
kill `cat /tmp/hiredis-test-redis.pid`