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

tests: updated with 'policy' modules, tweaks

parent 3da8d2c8
...@@ -27,11 +27,12 @@ env: ...@@ -27,11 +27,12 @@ env:
- CFLAGS="${CFLAGS} -O0 -g -fPIC" - CFLAGS="${CFLAGS} -O0 -g -fPIC"
- LD_LIBRARY_PATH="${HOME}/.local/lib" - LD_LIBRARY_PATH="${HOME}/.local/lib"
- DYLD_LIBRARY_PATH="${HOME}/.local/lib" - DYLD_LIBRARY_PATH="${HOME}/.local/lib"
- MAKEOPTS="-j2" - SOCKET_WRAPPER_DIR="${HOME}/test-dir"
before_script: before_script:
- ./scripts/bootstrap-depends.sh ${HOME}/.local - ./scripts/bootstrap-depends.sh ${HOME}/.local
- mkdir ${SOCKET_WRAPPER_DIR}
script: script:
- make ${MAKEOPTS} install COVERAGE=1 PREFIX=${HOME}/.local - make -j2 install COVERAGE=1 PREFIX=${HOME}/.local
- make check COVERAGE=1 PREFIX=${HOME}/.local - make check COVERAGE=1 PREFIX=${HOME}/.local
after_success: after_success:
- test $TRAVIS_OS_NAME = linux && coveralls -i lib -i daemon -x ".c" --gcov-options '\-lp' - test $TRAVIS_OS_NAME = linux && coveralls -i lib -i daemon -x ".c" --gcov-options '\-lp'
......
...@@ -27,6 +27,6 @@ $(libfaketime): $(libfaketime_DIR)/Makefile ...@@ -27,6 +27,6 @@ $(libfaketime): $(libfaketime_DIR)/Makefile
@CFLAGS="" $(MAKE) -C $(libfaketime_DIR) @CFLAGS="" $(MAKE) -C $(libfaketime_DIR)
check-integration: $(libfaketime) check-integration: $(libfaketime)
$(preload_LIBS) $(preload_syms) tests/test_integration.py $(TESTS) daemon/kresd ./kresd.j2 config $(preload_LIBS) $(preload_syms) tests/test_integration.py $(TESTS) $(abspath daemon/kresd) ./kresd.j2 config
.PHONY: check-integration .PHONY: check-integration
net.listen('{{SELF_ADDR}}',53) net.listen('{{SELF_ADDR}}',53)
cache.size = 1*MB cache.size = 1*MB
modules = {'stats', 'block', 'hints'} modules = {'stats', 'policy', 'hints'}
hints.root({['k.root-servers.net'] = '{{ROOT_ADDR}}'}) hints.root({['k.root-servers.net'] = '{{ROOT_ADDR}}'})
option('NO_MINIMIZE', {{NO_MINIMIZE}}) option('NO_MINIMIZE', {{NO_MINIMIZE}})
option('ALLOW_LOCAL', true) option('ALLOW_LOCAL', true)
......
#!/usr/bin/env python #!/usr/bin/env python
import traceback
class Test: class Test:
""" Small library to imitate CMocka output. """ """ Small library to imitate CMocka output. """
...@@ -26,7 +25,7 @@ class Test: ...@@ -26,7 +25,7 @@ class Test:
passed += 1 passed += 1
print('[ OK ] %s' % name) print('[ OK ] %s' % name)
except Exception as e: except Exception as e:
print('[ FAIL ] %s (%s) at %s' % (name, str(e), traceback.print_exc()[0])) print('[ FAIL ] %s (%s)' % (name, str(e)))
# Clear test set # Clear test set
self.tests = [] self.tests = []
......
...@@ -224,7 +224,6 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa ...@@ -224,7 +224,6 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa
daemon_env = os.environ.copy() daemon_env = os.environ.copy()
setup_env(daemon_env, config, config_name, j2template) setup_env(daemon_env, config, config_name, j2template)
# Start binary # Start binary
binary_name = os.path.abspath(binary_name)
daemon_proc = None daemon_proc = None
daemon_log = open('%s/server.log' % TMPDIR, 'w') daemon_log = open('%s/server.log' % TMPDIR, 'w')
daemon_args = [binary_name] + binary_additional_pars daemon_args = [binary_name] + binary_additional_pars
...@@ -237,6 +236,7 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa ...@@ -237,6 +236,7 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while True: while True:
if daemon_proc.poll() != None: if daemon_proc.poll() != None:
print(open('%s/server.log' % TMPDIR).read())
raise Exception('process died "%s", logs in "%s"' % (os.path.basename(binary_name), TMPDIR)) raise Exception('process died "%s", logs in "%s"' % (os.path.basename(binary_name), TMPDIR))
try: try:
sock.connect((testserver.get_local_addr_str(socket.AF_INET, CHILD_IFACE), 53)) sock.connect((testserver.get_local_addr_str(socket.AF_INET, CHILD_IFACE), 53))
......
# Preload libraries # Preload libraries
preload_PATH := tests:contrib/libfaketime/src preload_PATH := $(abspath contrib/libfaketime/src)
ifeq ($(PLATFORM),Darwin) ifeq ($(PLATFORM),Darwin)
preload_LIBS := @DYLD_FORCE_FLAT_NAMESPACE=1 \ preload_LIBS := @DYLD_FORCE_FLAT_NAMESPACE=1 \
DYLD_LIBRARY_PATH="$(preload_PATH):${DYLD_LIBRARY_PATH}" DYLD_LIBRARY_PATH="$(preload_PATH):${DYLD_LIBRARY_PATH}"
......
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