Commit ead03815 authored by Marek Vavruša's avatar Marek Vavruša

tests: added README.rst, libfaketime as a git submodule, fixed depends

parent c8c7cc78
[submodule "contrib/socket_wrapper"]
path = contrib/socket_wrapper
url = git://git.samba.org/socket_wrapper.git
[submodule "contrib/libfaketime"]
path = contrib/libfaketime
url = https://github.com/wolfcw/libfaketime.git
......@@ -29,7 +29,6 @@ $(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)
......
Subproject commit 18f5ec0671705bac190787a8612fc2a58b1be1d1
This diff is collapsed.
......@@ -21,5 +21,4 @@ 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,13 +31,6 @@ 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)
......@@ -132,9 +125,3 @@ define find_python
$(call have_lib,python)
endef
# Find libfaketime
define find_libfaketime
libfaketime_LIBS := $(shell find ./contrib -name $(libfaketime_name) -print -quit 2> /dev/null)
$(call have_lib,libfaketime)
endef
## Unit tests
## Integration tests
Unit tests
==========
The tests depend on cmocka_.
.. code-block:: bash
$ make check-unit
.. todo:: Writing tests.
Integration tests
=================
The tests depend on cwrap's `socket_wrapper`_, libfaketime_ and Python.
The libfaketime is included in ``contrib/libfaketime`` as it depends on rather latest version of it,
it is automatically synchronised with ``make``.
Execute the tests by:
.. code-block:: bash
$ make check-integration
.. todo:: Writing tests.
.. _cmocka: https://cmocka.org/
.. _`socket_wrapper`: https://cwrap.org/socket_wrapper.html
.. _libfaketime: https://cwrap.org/socket_wrapper.html
......@@ -3,17 +3,28 @@
#
CWRAP_PATH := $(socket_wrapper_LIBS)
FAKETIME_PATH := $(libfaketime_LIBS)
# Targets
libfaketime_DIR := contrib/libfaketime
libfaketime := $(abspath $(libfaketime_DIR))/src/libfaketime$(LIBEXT).1
# Platform-specific targets
ifeq ($(PLATFORM),Darwin)
preload_syms := DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES="$(FAKETIME_PATH):$(CWRAP_PATH)"
preload_syms := DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES="$(libfaketime):$(CWRAP_PATH)"
else
preload_syms := LD_PRELOAD="$(FAKETIME_PATH):$(CWRAP_PATH)"
preload_syms := LD_PRELOAD="$(libfaketime):$(CWRAP_PATH)"
endif
check-integration:
$(call preload_LIBS) $(preload_syms) tests/test_integration.py tests/testdata
# Synchronize submodules
$(libfaketime_DIR):
@git submodule init
$(libfaketime_DIR)/Makefile: $(libfaketime_DIR)
@git submodule update
# Build libfaketime contrib
$(libfaketime): $(libfaketime_DIR)/Makefile
@$(MAKE) -C $(libfaketime_DIR)
check-integration: $(libfaketime)
$(preload_LIBS) $(preload_syms) tests/test_integration.py tests/testdata
.PHONY: check-integration
# Preload libraries
preload_PATH := tests
preload_PATH := tests:contrib/libfaketime/src
ifeq ($(PLATFORM),Darwin)
preload_LIBS := @DYLD_FORCE_FLAT_NAMESPACE=1 \
DYLD_LIBRARY_PATH="$(preload_PATH):${DYLD_LIBRARY_PATH}"
......@@ -10,14 +10,19 @@ endif
# Unit tests
ifeq ($(HAS_cmocka), yes)
include tests/unit.mk
else
$(warning cmocka not found, skipping unit tests)
endif
# Integration tests
ifeq ($(HAS_python), yes)
ifeq ($(HAS_python)|$(HAS_socket_wrapper), yes|yes)
include tests/integration.mk
endif # HAS_python
endif # HAS_cmocka
else
$(warning python or socket_wrapper not found, skipping integration tests)
endif
# Targets
tests: check-unit check-integration
tests-clean: $(foreach test,$(tests_BIN),$(test)-clean) libmock_calls-clean _test_integration-clean
tests-clean: $(foreach test,$(tests_BIN),$(test)-clean)
.PHONY: tests tests-clean
......@@ -26,6 +26,7 @@ tests_LIBS := $(libkres_TARGET) $(libkres_LIBS) $(cmocka_LIBS)
# Make test binaries
define make_test
$(1)_CFLAGS := -Wno-deprecated-declarations
$(1)_SOURCES := tests/$(1).c
$(1)_LIBS := $(tests_LIBS)
$(1)_DEPEND := $(tests_DEPEND)
......
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