1 .PHONY: verify-python-path
4 ifndef VPP_PYTHON_PREFIX
5 $(error VPP_PYTHON_PREFIX is not set)
8 PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
9 PYTHON_DEPENDS=scapy==2.3.3 pexpect
10 SCAPY_SOURCE=$(WS_ROOT)/build-root/python/virtualenv/lib/python2.7/site-packages/
11 BUILD_COV_DIR = $(BR)/test-cov
15 @virtualenv $(PYTHON_VENV_PATH)
16 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)"
19 .pip-patch.ok: .pip-install.ok
20 @echo --- patching ---
21 for f in $(CURDIR)/patches/scapy-2.3.3/*.patch ; do \
22 echo Applying patch: $$(basename $$f) ; \
23 patch -p1 -d $(SCAPY_SOURCE) < $$f ; \
27 .install.ok: .pip-patch.ok
28 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && cd $(WS_ROOT)/vpp-api/python && python setup.py install"
31 PHONIES=.install.ok .pip-patch.ok .pip-install.ok
35 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
38 test: reset verify-python-path .install.ok
41 retest: reset verify-python-path
47 @rm -f /dev/shm/vpp-unittest-*
48 @rm -rf /tmp/vpp-unittest-*
53 doc: verify-python-path
54 @virtualenv $(PYTHON_VENV_PATH)
55 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) sphinx"
56 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html"
59 @make -C doc wipe BR=$(BR)
61 cov: wipe-cov reset verify-python-path .install.ok
62 @lcov --zerocounters --directory $(VPP_TEST_BUILD_DIR)
64 @mkdir $(BUILD_COV_DIR)
65 @lcov --capture --directory $(VPP_TEST_BUILD_DIR) --output-file $(BUILD_COV_DIR)/coverage.info
66 @genhtml $(BUILD_COV_DIR)/coverage.info --output-directory $(BUILD_COV_DIR)/html
68 @echo "Build finished. Code coverage report is in $(BUILD_COV_DIR)/html/index.html"
71 @rm -rf $(BUILD_COV_DIR)
74 @echo "Running tests:"
76 @echo " test - build and run functional tests"
77 @echo " test-debug - build and run functional tests (debug build)"
78 @echo " retest - run functional tests"
79 @echo " retest-debug - run functional tests (debug build)"
80 @echo " test-wipe - wipe (temporary) files generated by unit tests"
82 @echo "Arguments controlling test runs:"
83 @echo " V=[0|1|2] - set test verbosity level"
84 @echo " DEBUG=<type> - set VPP debugging kind"
85 @echo " DEBUG=core - detect coredump and load it in gdb on crash"
86 @echo " DEBUG=gdb - allow easy debugging by printing VPP PID "
87 @echo " and waiting for user input before running "
88 @echo " and tearing down a testcase"
89 @echo " DEBUG=gdbserver - run gdb inside a gdb server, otherwise "
90 @echo " same as above"
91 @echo " STEP=[yes|no] - ease debugging by stepping through a testcase "
92 @echo " TEST=<name> - only run specific test"
94 @echo "Creating test documentation"
95 @echo " test-doc - generate documentation for test framework"
96 @echo " test-wipe-doc - wipe documentation for test framework"
98 @echo "Creating test code coverage report"
99 @echo " test-cov - generate code coverage report for test framework"
100 @echo " test-wipe-cov - wipe code coverage report for test framework"