Python API: Change from cPython to CFFI.
[vpp.git] / test / Makefile
index 1bb3c6c..4338e09 100644 (file)
@@ -30,7 +30,7 @@ UNITTEST_EXTRA_OPTS="-f"
 endif
 
 PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
-PYTHON_DEPENDS=scapy==2.3.3 pexpect subprocess32 git+https://github.com/klement/py-lispnetworking@setup
+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
 
@@ -62,12 +62,35 @@ define retest-func
        @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py discover $(UNITTEST_EXTRA_OPTS) -p test_\"*.py\""
 endef
 
-test: verify-python-path verify-no-running-vpp reset $(PAPI_INSTALL_DONE)
+.PHONY: sanity
+
+sanity: verify-no-running-vpp
+       @bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python sanity_import_vpp_papi.py ||\
+               (echo \"*******************************************************************\" &&\
+                echo \"* Sanity check failed, cannot import vpp_papi\" &&\
+                echo \"* to debug: \" &&\
+                echo \"* 1. enter test shell:   make test-shell\" &&\
+                echo \"* 2. execute debugger:   gdb python -ex 'run sanity_import_vpp_papi.py'\" &&\
+                echo \"*******************************************************************\" &&\
+                false)"
+
+test: verify-python-path $(PAPI_INSTALL_DONE) sanity reset 
        $(call retest-func)
 
-retest: verify-python-path verify-no-running-vpp reset
+retest: verify-python-path sanity reset
        $(call retest-func)
 
+shell: verify-python-path $(PAPI_INSTALL_DONE)
+       @echo "source $(PYTHON_VENV_PATH)/bin/activate;\
+               echo '***';\
+               echo VPP_TEST_BUILD_DIR=$(VPP_TEST_BUILD_DIR);\
+               echo VPP_TEST_BIN=$(VPP_TEST_BIN);\
+               echo VPP_TEST_PLUGIN_PATH=$(VPP_TEST_PLUGIN_PATH);\
+               echo VPP_TEST_INSTALL_PATH=$(VPP_TEST_INSTALL_PATH);\
+               echo LD_LIBRARY_PATH=$(LD_LIBRARY_PATH);\
+               echo '***';\
+               exec </dev/tty" | bash -i
+
 .PHONY: wipe doc
 
 reset:
@@ -126,6 +149,8 @@ help:
        @echo " retest              - run functional tests"
        @echo " retest-debug        - run functional tests (debug build)"
        @echo " test-wipe           - wipe (temporary) files generated by unit tests"
+       @echo " test-shell          - enter shell with test environment"
+       @echo " test-shell-debug    - enter shell with test environment (debug build)"
        @echo ""
        @echo "Arguments controlling test runs:"
        @echo " V=[0|1|2]            - set test verbosity level"