diff options
author | Eddy Jansson <eddy@scmcoord.com> | 2014-02-24 14:43:39 +0100 |
---|---|---|
committer | Matt Stancliff <matt@genges.com> | 2014-04-09 17:02:43 -0400 |
commit | 05fb7be3eaa94b50b9d4d81f105d5d872c8591a0 (patch) | |
tree | 99ec957934e7948392974cbff3643fa32a07cb96 /Makefile | |
parent | 2d66c4814e9a3ab40dfcc114e3eaf55dbeb70d29 (diff) |
Fix Makefile test to use more compatible syntax
The existing way is not compatible with a lot of shells, including most
bash installations, because the echos that generates the configuration
sent to redis-server doesn't expand the escapes. Adding '-e' to the
echo works under bash, but breaks on the Travis CI server.
This is my attempt to find an alternative that works everywhere.
[committer note: it doesn't work under Solaris make, but the Makefile
was already broken under Solaris make. Solaris users must use gmake.]
Closes #224 and Closes #221
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -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` |