0279b29f32
Change-Id: Ia8247841fdbe76e1d888aab49ae213b4216af273 Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
102 lines
3.5 KiB
Makefile
102 lines
3.5 KiB
Makefile
.PHONY: verify-python-path
|
|
|
|
verify-python-path:
|
|
ifndef VPP_PYTHON_PREFIX
|
|
$(error VPP_PYTHON_PREFIX is not set)
|
|
endif
|
|
|
|
PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
|
|
PYTHON_DEPENDS=scapy==2.3.3 pexpect
|
|
SCAPY_SOURCE=$(WS_ROOT)/build-root/python/virtualenv/lib/python2.7/site-packages/
|
|
BUILD_COV_DIR = $(BR)/test-cov
|
|
|
|
|
|
.pip-install.ok:
|
|
@virtualenv $(PYTHON_VENV_PATH)
|
|
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)"
|
|
@touch $@
|
|
|
|
.pip-patch.ok: .pip-install.ok
|
|
@echo --- patching ---
|
|
for f in $(CURDIR)/patches/scapy-2.3.3/*.patch ; do \
|
|
echo Applying patch: $$(basename $$f) ; \
|
|
patch -p1 -d $(SCAPY_SOURCE) < $$f ; \
|
|
done
|
|
@touch $@
|
|
|
|
.install.ok: .pip-patch.ok
|
|
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && cd $(WS_ROOT)/vpp-api/python && python setup.py install"
|
|
@touch $@
|
|
|
|
PHONIES=.install.ok .pip-patch.ok .pip-install.ok
|
|
.PHONY: $(PHONIES)
|
|
|
|
define retest-func
|
|
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
|
|
endef
|
|
|
|
test: reset verify-python-path .install.ok
|
|
$(call retest-func)
|
|
|
|
retest: reset verify-python-path
|
|
$(call retest-func)
|
|
|
|
.PHONY: wipe doc
|
|
|
|
reset:
|
|
@rm -f /dev/shm/vpp-unittest-*
|
|
@rm -rf /tmp/vpp-unittest-*
|
|
|
|
wipe: reset
|
|
@rm -f $(PHONIES)
|
|
|
|
doc: verify-python-path
|
|
@virtualenv $(PYTHON_VENV_PATH)
|
|
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) sphinx"
|
|
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html"
|
|
|
|
wipe-doc:
|
|
@make -C doc wipe BR=$(BR)
|
|
|
|
cov: wipe-cov reset verify-python-path .install.ok
|
|
@lcov --zerocounters --directory $(VPP_TEST_BUILD_DIR)
|
|
$(call retest-func)
|
|
@mkdir $(BUILD_COV_DIR)
|
|
@lcov --capture --directory $(VPP_TEST_BUILD_DIR) --output-file $(BUILD_COV_DIR)/coverage.info
|
|
@genhtml $(BUILD_COV_DIR)/coverage.info --output-directory $(BUILD_COV_DIR)/html
|
|
@echo
|
|
@echo "Build finished. Code coverage report is in $(BUILD_COV_DIR)/html/index.html"
|
|
|
|
wipe-cov: wipe
|
|
@rm -rf $(BUILD_COV_DIR)
|
|
|
|
help:
|
|
@echo "Running tests:"
|
|
@echo ""
|
|
@echo " test - build and run functional tests"
|
|
@echo " test-debug - build and run functional tests (debug build)"
|
|
@echo " retest - run functional tests"
|
|
@echo " retest-debug - run functional tests (debug build)"
|
|
@echo " test-wipe - wipe (temporary) files generated by unit tests"
|
|
@echo ""
|
|
@echo "Arguments controlling test runs:"
|
|
@echo " V=[0|1|2] - set test verbosity level"
|
|
@echo " DEBUG=<type> - set VPP debugging kind"
|
|
@echo " DEBUG=core - detect coredump and load it in gdb on crash"
|
|
@echo " DEBUG=gdb - allow easy debugging by printing VPP PID "
|
|
@echo " and waiting for user input before running "
|
|
@echo " and tearing down a testcase"
|
|
@echo " DEBUG=gdbserver - run gdb inside a gdb server, otherwise "
|
|
@echo " same as above"
|
|
@echo " STEP=[yes|no] - ease debugging by stepping through a testcase "
|
|
@echo " TEST=<name> - only run specific test"
|
|
@echo ""
|
|
@echo "Creating test documentation"
|
|
@echo " test-doc - generate documentation for test framework"
|
|
@echo " test-wipe-doc - wipe documentation for test framework"
|
|
@echo ""
|
|
@echo "Creating test code coverage report"
|
|
@echo " test-cov - generate code coverage report for test framework"
|
|
@echo " test-wipe-cov - wipe code coverage report for test framework"
|
|
@echo ""
|