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=$(PYTHON_VENV_PATH)/lib/python2.7/site-packages/
11 BUILD_COV_DIR = $(BR)/test-cov
13 PIP_INSTALL_DONE=$(VPP_PYTHON_PREFIX)/pip-install.done
14 PIP_PATCH_DONE=$(VPP_PYTHON_PREFIX)/pip-patch.done
15 PAPI_INSTALL_DONE=$(VPP_PYTHON_PREFIX)/papi-install.done
17 PAPI_INSTALL_FLAGS=$(PIP_INSTALL_DONE) $(PIP_PATCH_DONE) $(PAPI_INSTALL_DONE)
20 @virtualenv $(PYTHON_VENV_PATH)
21 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)"
24 $(PIP_PATCH_DONE): $(PIP_INSTALL_DONE)
25 @echo --- patching ---
26 for f in $(CURDIR)/patches/scapy-2.3.3/*.patch ; do \
27 echo Applying patch: $$(basename $$f) ; \
28 patch -p1 -d $(SCAPY_SOURCE) < $$f ; \
32 $(PAPI_INSTALL_DONE): $(PIP_PATCH_DONE)
33 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && cd $(WS_ROOT)/vpp-api/python && python setup.py install"
37 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
40 test: reset verify-python-path $(PAPI_INSTALL_DONE)
43 retest: reset verify-python-path
49 @rm -f /dev/shm/vpp-unittest-*
50 @rm -rf /tmp/vpp-unittest-*
53 @rm -rf $(PYTHON_VENV_PATH)
54 @rm -f $(PAPI_INSTALL_FLAGS)
56 doc: verify-python-path
57 @virtualenv $(PYTHON_VENV_PATH)
58 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) sphinx"
59 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html"
64 @make -C doc wipe BR=$(BR)
66 cov: wipe-cov reset verify-python-path $(PAPI_INSTALL_DONE)
67 @lcov --zerocounters --directory $(VPP_TEST_BUILD_DIR)
69 @mkdir $(BUILD_COV_DIR)
70 @lcov --capture --directory $(VPP_TEST_BUILD_DIR) --output-file $(BUILD_COV_DIR)/coverage.info
71 @genhtml $(BUILD_COV_DIR)/coverage.info --output-directory $(BUILD_COV_DIR)/html
73 @echo "Build finished. Code coverage report is in $(BUILD_COV_DIR)/html/index.html"
78 @rm -rf $(BUILD_COV_DIR)
81 @echo "Running tests:"
83 @echo " test - build and run functional tests"
84 @echo " test-debug - build and run functional tests (debug build)"
85 @echo " retest - run functional tests"
86 @echo " retest-debug - run functional tests (debug build)"
87 @echo " test-wipe - wipe (temporary) files generated by unit tests"
89 @echo "Arguments controlling test runs:"
90 @echo " V=[0|1|2] - set test verbosity level"
91 @echo " DEBUG=<type> - set VPP debugging kind"
92 @echo " DEBUG=core - detect coredump and load it in gdb on crash"
93 @echo " DEBUG=gdb - allow easy debugging by printing VPP PID "
94 @echo " and waiting for user input before running "
95 @echo " and tearing down a testcase"
96 @echo " DEBUG=gdbserver - run gdb inside a gdb server, otherwise "
97 @echo " same as above"
98 @echo " STEP=[yes|no] - ease debugging by stepping through a testcase "
99 @echo " TEST=<name> - only run specific test"
101 @echo "Creating test documentation"
102 @echo " test-doc - generate documentation for test framework"
103 @echo " test-wipe-doc - wipe documentation for test framework"
105 @echo "Creating test code coverage report"
106 @echo " test-cov - generate code coverage report for test framework"
107 @echo " test-wipe-cov - wipe code coverage report for test framework"