Klement Sekera | 277b89c | 2016-10-28 13:20:27 +0200 | [diff] [blame] | 1 | .PHONY: verify-python-path |
Damjan Marion | f56b77a | 2016-10-03 19:44:57 +0200 | [diff] [blame] | 2 | |
Klement Sekera | 277b89c | 2016-10-28 13:20:27 +0200 | [diff] [blame] | 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 |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 9 | PYTHON_DEPENDS=scapy==2.3.3 pexpect |
| 10 | SCAPY_SOURCE=$(WS_ROOT)/build-root/python/virtualenv/lib/python2.7/site-packages/ |
Klement Sekera | 277b89c | 2016-10-28 13:20:27 +0200 | [diff] [blame] | 11 | |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 12 | |
| 13 | .pip-install.ok: |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 14 | @virtualenv $(PYTHON_VENV_PATH) |
Klement Sekera | 778c276 | 2016-11-08 02:00:28 +0100 | [diff] [blame] | 15 | @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)" |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 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 |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 27 | @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && cd $(WS_ROOT)/vpp-api/python && python setup.py install" |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 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 |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 34 | @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\"" |
| 35 | |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 36 | retest: reset verify-python-path |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 37 | @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover -p test_$(TEST)\"*.py\"" |
| 38 | |
Klement Sekera | 277b89c | 2016-10-28 13:20:27 +0200 | [diff] [blame] | 39 | .PHONY: wipe doc |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 40 | |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 41 | reset: |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 42 | @rm -f /dev/shm/vpp-unittest-* |
| 43 | @rm -rf /tmp/vpp-unittest-* |
| 44 | |
Neale Ranns | 177bbdc | 2016-11-15 09:46:51 +0000 | [diff] [blame] | 45 | wipe: reset |
| 46 | @rm -f $(PHONIES) |
| 47 | |
Klement Sekera | 277b89c | 2016-10-28 13:20:27 +0200 | [diff] [blame] | 48 | doc: verify-python-path |
Klement Sekera | f62ae12 | 2016-10-11 11:47:09 +0200 | [diff] [blame] | 49 | @virtualenv $(PYTHON_VENV_PATH) |
Klement Sekera | 778c276 | 2016-11-08 02:00:28 +0100 | [diff] [blame] | 50 | @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS) sphinx" |
Klement Sekera | 277b89c | 2016-10-28 13:20:27 +0200 | [diff] [blame] | 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 "" |