Commit 5eff725e authored by Grigorii Demidov's avatar Grigorii Demidov

tests: libfaketime search

parent 27576ed0
......@@ -29,6 +29,7 @@ $(eval $(call find_python))
$(eval $(call find_lib,libmemcached,1.0))
$(eval $(call find_lib,hiredis))
$(eval $(call find_lib,socket_wrapper))
$(eval $(call find_libfaketime))
# Work around luajit on OS X
ifeq ($(PLATFORM), Darwin)
......
......@@ -21,4 +21,5 @@ info:
$(info [$(HAS_libmemcached)] libmemcached (modules/memcached))
$(info [$(HAS_hiredis)] hiredis (modules/redis))
$(info [$(HAS_socket_wrapper)] socket_wrapper (lib))
$(info [$(HAS_libfaketime)] libfaketime (lib))
$(info )
......@@ -31,6 +31,13 @@ else
endif
endif
# Libfaketime name
ifeq ($(PLATFORM),Darwin)
libfaketime_name := libfaketime.1$(LIBEXT)
else
libfaketime_name := libfaketime$(LIBEXT).1
endif
# Silent compilation
ifeq ($(V),1)
quiet = $($1)
......@@ -124,3 +131,11 @@ define find_python
python_LIBS := $(shell $(PYTHON) -c "from distutils import sysconfig as c;print('-L%s -lpython%s' % (c.get_config_var('LIBDIR'), c.get_config_var('VERSION')))")
$(call have_lib,python)
endef
# Find libfaketime
define find_libfaketime
SPACED_PATH := $(subst :, ,$(PATH))
libfaketime_LIBS := $(shell find $(HOME)/.local /usr/local $(S_PATH) -name $(libfaketime_name) -print -quit 2> /dev/null)
$(call have_lib,libfaketime)
endef
#
# Integration tests
#
CWRAP_PATH := $(shell pkg-config --libs socket_wrapper)
# TODO: find this in ld search paths
# TODO: this requires newer version than is in the Debian to support FAKETIME_TIMESTAMP_FILE
# TODO: maybe we can bundle it (it's small enough)
FAKETIME_PATH := $(wildcard ~/.local/lib/faketime/libfaketime.so.1)
CWRAP_PATH := $(socket_wrapper_LIBS)
FAKETIME_PATH := $(libfaketime_LIBS)
# Targets
ifeq ($(PLATFORM),Darwin)
preload_syms := DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES="$(FAKETIME_PATH):$(CWRAP_PATH)"
else
preload_syms := LD_PRELOAD="$(FAKETIME_PATH):$(CWRAP_PATH)"
endif
preload_syms := LD_PRELOAD="$(FAKETIME_PATH):$(CWRAP_PATH)"
check-integration:
check-integration: $(libmock_calls) $(_test_integration)
$(call preload_LIBS) $(preload_syms) tests/test_integration.py tests/testdata
.PHONY: check-integration
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment