blob: de6aaa7a7935047b938523c7279c17e4359415d0 [file] [log] [blame]
Klement Sekera277b89c2016-10-28 13:20:27 +02001.PHONY: verify-python-path
Damjan Marionf56b77a2016-10-03 19:44:57 +02002
Klement Sekera277b89c2016-10-28 13:20:27 +02003verify-python-path:
4ifndef VPP_PYTHON_PREFIX
5 $(error VPP_PYTHON_PREFIX is not set)
6endif
7
8PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
Neale Ranns177bbdc2016-11-15 09:46:51 +00009PYTHON_DEPENDS=scapy==2.3.3 pexpect
10SCAPY_SOURCE=$(WS_ROOT)/build-root/python/virtualenv/lib/python2.7/site-packages/
Klement Sekera277b89c2016-10-28 13:20:27 +020011
Neale Ranns177bbdc2016-11-15 09:46:51 +000012
13.pip-install.ok:
Klement Sekeraf62ae122016-10-11 11:47:09 +020014 @virtualenv $(PYTHON_VENV_PATH)
Klement Sekera778c2762016-11-08 02:00:28 +010015 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)"
Neale Ranns177bbdc2016-11-15 09:46:51 +000016 @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
Klement Sekeraf62ae122016-10-11 11:47:09 +020027 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && cd $(WS_ROOT)/vpp-api/python && python setup.py install"
Neale Ranns177bbdc2016-11-15 09:46:51 +000028 @touch $@
29
30PHONIES=.install.ok .pip-patch.ok .pip-install.ok
31.PHONY: $(PHONIES)
32
33test: reset verify-python-path .install.ok
Klement Sekeraf62ae122016-10-11 11:47:09 +020034 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
35
Neale Ranns177bbdc2016-11-15 09:46:51 +000036retest: reset verify-python-path
Klement Sekeraf62ae122016-10-11 11:47:09 +020037 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\""
38
Klement Sekera277b89c2016-10-28 13:20:27 +020039.PHONY: wipe doc
Klement Sekeraf62ae122016-10-11 11:47:09 +020040
Neale Ranns177bbdc2016-11-15 09:46:51 +000041reset:
Klement Sekeraf62ae122016-10-11 11:47:09 +020042 @rm -f /dev/shm/vpp-unittest-*
43 @rm -rf /tmp/vpp-unittest-*
44
Neale Ranns177bbdc2016-11-15 09:46:51 +000045wipe: reset
46 @rm -f $(PHONIES)
47
Klement Sekera277b89c2016-10-28 13:20:27 +020048doc: verify-python-path
Klement Sekeraf62ae122016-10-11 11:47:09 +020049 @virtualenv $(PYTHON_VENV_PATH)
Klement Sekera778c2762016-11-08 02:00:28 +010050 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) sphinx"
Klement Sekera277b89c2016-10-28 13:20:27 +020051 @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html"
52
53wipe-doc:
54 @make -C doc wipe BR=$(BR)
55
56help:
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 ""