aboutsummaryrefslogtreecommitdiffstats
path: root/test/Makefile
diff options
context:
space:
mode:
authorvagrant <vagrant@localhost.localdomain>2017-04-07 01:48:47 +0000
committerFlorin Coras <florin.coras@gmail.com>2017-04-19 07:12:23 +0000
commit937bf30183d39859c4a0717fa1a801cd556cfcfa (patch)
tree0cc8f754eda411866306cbc346b8a1d57d1cb0c5 /test/Makefile
parentd367768270a3d19447af1a7059068e1f20fd15a6 (diff)
make test: python interpreter customization
Allow using custom python interpreter via 'PYTHON' env variable. E.g. env PYTHON=pypy make test. Get latest pip automatically to properly function in environments, where old pip is available and a proxy is required. This allows testing pypy in a centos vagrant-provided vm. Change-Id: I67a658fc927303468cc67f0ac192317ca2907625 Signed-off-by: Klement Sekera <ksekera@cisco.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'test/Makefile')
-rw-r--r--test/Makefile24
1 files changed, 18 insertions, 6 deletions
diff --git a/test/Makefile b/test/Makefile
index 787dd9d12c7..da45fb838ce 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -36,17 +36,29 @@ endif
PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
PYTHON_DEPENDS=scapy==2.3.3 pexpect subprocess32 cffi git+https://github.com/klement/py-lispnetworking@setup
-SCAPY_SOURCE=$(PYTHON_VENV_PATH)/lib/python2.7/site-packages/
-BUILD_COV_DIR = $(BR)/test-cov
+SCAPY_SOURCE=$(shell find $(PYTHON_VENV_PATH) -name site-packages)
+BUILD_COV_DIR=$(BR)/test-cov
+GET_PIP_SCRIPT=$(VPP_PYTHON_PREFIX)/get-pip.py
PIP_INSTALL_DONE=$(VPP_PYTHON_PREFIX)/pip-install.done
PIP_PATCH_DONE=$(VPP_PYTHON_PREFIX)/pip-patch.done
PAPI_INSTALL_DONE=$(VPP_PYTHON_PREFIX)/papi-install.done
PAPI_INSTALL_FLAGS=$(PIP_INSTALL_DONE) $(PIP_PATCH_DONE) $(PAPI_INSTALL_DONE)
-$(PIP_INSTALL_DONE):
- @virtualenv $(PYTHON_VENV_PATH) -p python2.7
+ifeq ($(PYTHON),)
+PYTHON_INTERP=python2.7
+else
+PYTHON_INTERP=$(PYTHON)
+endif
+
+$(GET_PIP_SCRIPT):
+ @mkdir -p $(VPP_PYTHON_PREFIX)
+ @bash -c "cd $(VPP_PYTHON_PREFIX) && curl -O https://bootstrap.pypa.io/get-pip.py"
+
+$(PIP_INSTALL_DONE): $(GET_PIP_SCRIPT)
+ @virtualenv $(PYTHON_VENV_PATH) -p $(PYTHON_INTERP)
+ @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python $(GET_PIP_SCRIPT)"
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install $(PYTHON_DEPENDS)"
@touch $@
@@ -114,7 +126,7 @@ wipe: reset
@rm -f $(PAPI_INSTALL_FLAGS)
doc: verify-python-path $(PIP_PATCH_DONE)
- @virtualenv $(PYTHON_VENV_PATH) -p python2.7
+ @virtualenv $(PYTHON_VENV_PATH) -p $(PYTHON_INTERP)
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install sphinx sphinx-rtd-theme"
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && make -C doc WS_ROOT=$(WS_ROOT) BR=$(BR) NO_VPP_PAPI=1 html"
@@ -139,7 +151,7 @@ wipe-cov: wipe
.PHONY: checkstyle
checkstyle: verify-python-path
- @virtualenv $(PYTHON_VENV_PATH) -p python2.7
+ @virtualenv $(PYTHON_VENV_PATH) -p $(PYTHON_INTERP)
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && pip install pep8"
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate &&\
pep8 --show-source -v $(WS_ROOT)/test/*.py ||\