-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
78 lines (57 loc) · 1.82 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
export PYTHONPATH=.
DEBUG ?= --debug
FLUSHALL_ON_STARTUP ?= --flushall
PORT ?= --port 6377
BACKEND ?= --backend leveldb
TEST_OPTIONS = $(DEBUG) $(FLUSHALL_ON_STARTUP) $(PORT) $(BACKEND)
PID = dredis-test-server.pid
REDIS_PID = redis-test-server.pid
PROFILE_DIR ?= --dir /tmp/dredis-data
PROFILE_PORT = --port 6376
PROFILE_OPTIONS = $(PROFILE_DIR) $(FLUSHALL_ON_STARTUP) $(PROFILE_PORT)
STATS_FILE = stats.prof
STATS_METRIC ?= cumtime
PERFORMANCE_PID = dredis-performance-test-server.pid
fulltests:
bash -c "trap 'make stop-testserver' EXIT; make start-testserver DEBUG=''; make test"
fulltests-real-redis:
bash -c "trap 'make stop-redistestserver' EXIT; make start-redistestserver; make test REALREDIS=1"
test: unit integration lint
unit: setup
@py.test -v tests/unit
integration: setup
@py.test -v tests/integration
lint: setup
@flake8 --exclude tests/fixtures .
server:
python -m dredis.server $(TEST_OPTIONS)
start-testserver:
-python -m dredis.server $(TEST_OPTIONS) 2>&1 & echo $$! > $(PID)
stop-testserver:
@-touch $(PID)
@-kill `cat $(PID)` 2> /dev/null
@-rm $(PID)
setup: clean
@pip install -r development.txt --quiet
start-redistestserver:
-@redis-server $(PORT) 2>&1 & echo $$! > $(REDIS_PID)
stop-redistestserver:
@-touch $(REDIS_PID)
@-kill `cat $(REDIS_PID)` 2> /dev/null
@-rm $(REDIS_PID)
redis_server:
@mkdir -p dredis-data
PYTHONPATH=. python -m dredis.server --dir /tmp/dredis-data --port 6379
release:
rm -rf dist build
./release.sh
test-performance:
@py.test -vvvvv -s tests-performance
performance-server:
python -m cProfile -o $(STATS_FILE) dredis/server.py $(PROFILE_OPTIONS)
performance-stats:
python -c 'import pstats ; pstats.Stats("$(STATS_FILE)").sort_stats("$(STATS_METRIC)").print_stats()' | less
clean:
rm -rf build/ dist/ dredis.egg-info/
find . -name '*.pyc' -delete
rm -f dump*.rdb