GRE tests and fixes
[vpp.git] / test / Makefile
1 .PHONY: verify-python-path
2
3 verify-python-path:
4 ifndef VPP_PYTHON_PREFIX
5         $(error VPP_PYTHON_PREFIX is not set)
6 endif
7
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
12
13 .pip-install.ok:
14         @virtualenv $(PYTHON_VENV_PATH)
15         @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)"
16         @touch $@
17
18 .pip-patch.ok: .pip-install.ok
19         @echo --- patching ---
20         for f in $(CURDIR)/patches/scapy-2.3.3/*.patch ; do \
21                 echo Applying patch: $$(basename $$f) ; \
22                 patch -p1 -d $(SCAPY_SOURCE) < $$f ; \
23         done
24         @touch $@
25
26 .install.ok: .pip-patch.ok
27         @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && cd $(WS_ROOT)/vpp-api/python && python setup.py install"
28         @touch $@
29
30 PHONIES=.install.ok .pip-patch.ok .pip-install.ok
31 .PHONY: $(PHONIES)
32
33 test: reset verify-python-path .install.ok
34         @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
35
36 retest: reset verify-python-path
37         @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
38
39 .PHONY: wipe doc
40
41 reset:
42         @rm -f /dev/shm/vpp-unittest-*
43         @rm -rf /tmp/vpp-unittest-*
44
45 wipe: reset
46         @rm -f $(PHONIES)
47
48 doc: verify-python-path
49         @virtualenv $(PYTHON_VENV_PATH)
50         @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) sphinx"
51         @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html"
52
53 wipe-doc:
54         @make -C doc wipe BR=$(BR)
55
56 help:
57         @echo "Running tests:"
58         @echo ""
59         @echo " test                - build and run functional tests"
60         @echo " test-debug          - build and run functional tests (debug build)"
61         @echo " retest              - run functional tests"
62         @echo " retest-debug        - run functional tests (debug build)"
63         @echo " wipe-test           - wipe (temporary) files generated by unit tests"
64         @echo ""
65         @echo "Arguments controlling test runs:"
66         @echo " V=[0|1|2]            - set test verbosity level"
67         @echo " DEBUG=<type>         - set VPP debugging kind"
68         @echo "    DEBUG=core        - detect coredump and load it in gdb on crash"
69         @echo "    DEBUG=gdb         - allow easy debugging by printing VPP PID "
70         @echo "                        and waiting for user input before running "
71         @echo "                        and tearing down a testcase"
72         @echo "    DEBUG=gdbserver   - run gdb inside a gdb server, otherwise "
73         @echo "                        same as above"
74         @echo " STEP=[yes|no]        - ease debugging by stepping through a testcase "
75         @echo " TEST=<name>          - only run specific test"
76         @echo ""
77         @echo "Creating test documentation"
78         @echo " test-doc            - generate documentation for test framework"
79         @echo " wipe-test-doc       - wipe documentation for test framework"
80         @echo ""