diff --git a/Makefile b/Makefile index 5c0ca54630ad4ad5cb81d85baef633c156071f88..21507611564a811a40466ab282db9d376bd09e7c 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/help.mk b/help.mk index 1ceef2f30b38fffece14fa10e55776d67c5f3e42..8740ff6e04207498d74e5d0af1026465c9334e8b 100644 --- a/help.mk +++ b/help.mk @@ -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 ) diff --git a/platform.mk b/platform.mk index 39712ed7aa84dd57d068b8f90b3fa553003fc076..724cd4222dd3475f8355c1d86de2cebc8be31501 100644 --- a/platform.mk +++ b/platform.mk @@ -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 + diff --git a/tests/integration.mk b/tests/integration.mk index d59b1bf445b3532446784626dce792f8de316591..d68fbf914e7584a2036d982af7a3a4171cedf70f 100644 --- a/tests/integration.mk +++ b/tests/integration.mk @@ -1,20 +1,14 @@ # # 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