X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=test%2FMakefile;h=5616e9c3e55376982cdf6c9b58a0abb6960ee3e1;hb=efd6de87d3268f1ab499799cefb2e8b32a613f79;hp=0ee61a23c0b3c8fd07ce7479a83d2abc10cbd16a;hpb=558ceabc6c08f275ce6c6e7ff295e74272eb851a;p=vpp.git diff --git a/test/Makefile b/test/Makefile index 0ee61a23c0b..5616e9c3e55 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,14 +13,9 @@ ifndef TEST_DIR $(error TEST_DIR is not set) endif -export TEST_BR = $(BR)/build-test -export TEST_DOC_BR = $(TEST_BR)/doc -export BUILD_TEST_SRC = $(TEST_BR)/src +export TEST_BR = $(TEST_DIR) FAILED_DIR=/tmp/vpp-failed-unittests/ -PLUGIN_TEST_DIRS=$(shell find $(PLUGIN_SRC_DIR) -type d -name test -exec echo -n " -d {}" \;) -CORE_TEST_DIRS=$(shell find $(WS_ROOT)/src -not \( -path $(INTERN_PLUGIN_SRC_DIR) -prune \) -type d -name test -exec echo -n " -d {}" \;) -VPP_TEST_DIRS=$(shell ls -d $(TEST_DIR)$(PLUGIN_TEST_DIRS)$(CORE_TEST_DIRS) $(EXTERN_TESTS)) -VPP_TEST_SRC=$(shell for dir in $(VPP_TEST_DIRS) ; do ls $$dir/*.py 2>/dev/null; done) +VPP_TEST_DIRS=$(shell ls -d $(TEST_DIR) $(EXTERN_TESTS)) FORCE_NO_WIPE=0 ifeq ($(DEBUG),gdb) @@ -70,7 +65,7 @@ ifneq ($(EXTERN_TESTS),) UNITTEST_EXTRA_OPTS=$(UNITTEST_FAILFAST_OPTS) -d $(EXTERN_TESTS) endif -VENV_PATH=$(TEST_BR)/venv +VENV_PATH=$(TEST_DIR)/venv ifeq ($(TEST_DEBUG),1) VENV_RUN_DIR:=$(VENV_PATH)/run-debug @@ -84,15 +79,10 @@ else PYTHON_INTERP=$(PYTHON) endif -empty:= -space:= $(empty) $(empty) -export PYTHONPATH=$(subst $(space),:,$(VPP_TEST_DIRS)) -export PYTHONPYCACHEPREFIX=$(TEST_BR)/pycache - PYTHON_VERSION=$(shell $(PYTHON_INTERP) -c 'import sys; print(sys.version_info.major)') -PIP_VERSION=20.1.1 +PIP_VERSION=21.3.1 # Keep in sync with requirements.txt -PIP_TOOLS_VERSION=5.1.2 +PIP_TOOLS_VERSION=6.4.0 PYTHON_DEPENDS=requirements-$(PYTHON_VERSION).txt SCAPY_SOURCE=$(shell find $(VENV_PATH)/lib/python* -name site-packages) BUILD_COV_DIR=$(TEST_BR)/coverage @@ -158,7 +148,7 @@ PLUGIN_SRC_DIR=$(INTERN_PLUGIN_SRC_DIR) endif define retest-func -@env VPP_IN_GDB=$(VPP_IN_GDB) FORCE_FOREGROUND=$(FORCE_FOREGROUND) FAILED_DIR=$(FAILED_DIR) VENV_PATH=$(VENV_PATH) scripts/setsid_wrapper.sh $(FORCE_FOREGROUND) $(VENV_PATH)/bin/activate $(PYTHON_INTERP) $(PYTHON_PROFILE_OPTS) $(BUILD_TEST_SRC)/run_tests.py -d $(BUILD_TEST_SRC) $(UNITTEST_EXTRA_OPTS) || env FAILED_DIR=$(FAILED_DIR) COMPRESS_FAILED_TEST_LOGS=$(COMPRESS_FAILED_TEST_LOGS) scripts/compress_failed.sh +@env VPP_IN_GDB=$(VPP_IN_GDB) FORCE_FOREGROUND=$(FORCE_FOREGROUND) FAILED_DIR=$(FAILED_DIR) VENV_PATH=$(VENV_PATH) scripts/setsid_wrapper.sh $(FORCE_FOREGROUND) $(VENV_PATH)/bin/activate $(PYTHON_INTERP) $(PYTHON_PROFILE_OPTS) run_tests.py -d $(TEST_DIR) $(UNITTEST_EXTRA_OPTS) || env FAILED_DIR=$(FAILED_DIR) COMPRESS_FAILED_TEST_LOGS=$(COMPRESS_FAILED_TEST_LOGS) scripts/compress_failed.sh endef .PHONY: sanity @@ -167,8 +157,8 @@ ifeq ($(SANITY),no) SANITY_IMPORT_VPP_PAPI_CMD=true SANITY_RUN_VPP_CMD=true else -SANITY_IMPORT_VPP_PAPI_CMD=source $(VENV_PATH)/bin/activate && $(PYTHON_INTERP) $(BUILD_TEST_SRC)/sanity_import_vpp_papi.py -SANITY_RUN_VPP_CMD=source $(VENV_PATH)/bin/activate && $(PYTHON_INTERP) $(BUILD_TEST_SRC)/sanity_run_vpp.py +SANITY_IMPORT_VPP_PAPI_CMD=source $(VENV_PATH)/bin/activate && $(PYTHON_INTERP) sanity_import_vpp_papi.py +SANITY_RUN_VPP_CMD=source $(VENV_PATH)/bin/activate && $(PYTHON_INTERP) sanity_run_vpp.py endif ifndef TEST_JOBS @@ -203,23 +193,14 @@ sanity: test-dep echo \"*******************************************************************\" &&\ false)" -.PHONY: ext-test-apps -ext-test-apps: - make -C ext test-apps - -$(BUILD_TEST_SRC): verify-env - @rm -rf $@ - @mkdir -p $@ - @for file in $(VPP_TEST_SRC); do if [ ! -L $$file ] && [ ! -e $(BUILD_TEST_SRC)/$$(basename $$file) ] ; then ln -s $$file $(BUILD_TEST_SRC) ; fi ; done - $(FAILED_DIR): reset @mkdir -p $@ .PHONY: test-dep -test-dep: $(BUILD_TEST_SRC) $(PAPI_INSTALL_DONE) $(FAILED_DIR) +test-dep: $(PAPI_INSTALL_DONE) $(FAILED_DIR) .PHONY: test -test: test-dep ext-test-apps sanity +test: test-dep sanity $(call retest-func) .PHONY: retest @@ -229,8 +210,6 @@ retest: verify-env sanity $(FAILED_DIR) .PHONY: shell shell: test-dep @echo "source $(VENV_PATH)/bin/activate;\ - cd $(BUILD_TEST_SRC);\ - export PYTHONPATH=$(PYTHONPATH);\ export RND_SEED=$(RND_SEED);\ echo '***';\ echo PYTHONPATH=$(PYTHONPATH);\ @@ -256,25 +235,8 @@ reset: .PHONY: wipe wipe: reset - @make -C ext clean @rm -rf $(VENV_PATH) @rm -rf $(patsubst %,%/__pycache__, $(VPP_TEST_DIRS)) - @rm -rf $(BUILD_TEST_SRC) - -$(TEST_DOC_BR): $(PIP_INSTALL_DONE) - @mkdir -p $@ - @bash -c "source $(VENV_PATH)/bin/activate && make -C doc html" - -.PHONY: doc -doc: $(BUILD_TEST_SRC) $(PIP_PATCH_DONE) $(TEST_DOC_BR) - @echo - @echo "Test Documentation URL: $(TEST_DOC_BR)/html/index.html" - @echo "Run 'make test-wipe-doc test-doc' to rebuild the test docs" - @echo - -.PHONY: wipe-doc -wipe-doc: - @rm -rf $(TEST_DOC_BR) $(BUILD_COV_DIR): @mkdir -p $@ @@ -301,11 +263,11 @@ wipe-papi: @rm -rf $(PAPI_INSTALL_DONE) $(PAPI_WIPE_DIST) .PHONY: wipe-all -wipe-all: wipe wipe-papi wipe-doc wipe-cov +wipe-all: wipe wipe-papi wipe-cov @rm -rf $(TEST_BR) .PHONY: checkstyle-diff -checkstyle-diff: $(BUILD_TEST_SRC) $(PIP_INSTALL_DONE) +checkstyle-diff: $(PIP_INSTALL_DONE) @bash -c "source $(VENV_PATH)/bin/activate &&\ $(PYTHON_INTERP) -m pip install pycodestyle" @bash -c "source $(VENV_PATH)/bin/activate &&\ @@ -326,11 +288,11 @@ start-gdb: sanity $(call retest-func) .PHONY: checkstyle -checkstyle: $(BUILD_TEST_SRC) $(PIP_INSTALL_DONE) +checkstyle: $(PIP_INSTALL_DONE) @bash -c "source $(VENV_PATH)/bin/activate &&\ $(PYTHON_INTERP) -m pip install pycodestyle" @bash -c "source $(VENV_PATH)/bin/activate &&\ - pycodestyle --show-source --ignore=W504,E126,E241,E226,E305,E704,E741,E722 -v $(BUILD_TEST_SRC)/*.py ||\ + pycodestyle --show-source --ignore=W504,E126,E241,E226,E305,E704,E741,E722 -v *.py ||\ (echo \"*******************************************************************\" &&\ echo \"* Test framework PEP8 compliance check FAILED (checked all files)\" &&\ echo \"*******************************************************************\" &&\ @@ -355,9 +317,8 @@ help: @echo " test-gcov - build and run functional tests (gcov build)" @echo " test-wipe - wipe (temporary) files generated by unit tests" @echo " test-wipe-cov - wipe code coverage report for test framework" - @echo " test-wipe-doc - wipe documentation for test framework" @echo " test-wipe-papi - rebuild vpp_papi sources" - @echo " test-wipe-all - wipe (temporary) files generated by unit tests, docs, and coverage" + @echo " test-wipe-all - wipe (temporary) files generated by unit tests, and coverage" @echo " test-shell - enter shell with test environment" @echo " test-shell-debug - enter shell with test environment (debug build)" @echo " test-checkstyle - check PEP8 compliance for test framework" @@ -427,10 +388,6 @@ help: @echo " VPP_IN_GDB_NO_RMDIR=0 - don't remove existing tmp dir but fail instead" @echo " VPP_IN_GDB_CMDLINE=1 - add 'interactive' to VPP arguments to run with command line" @echo "" - @echo "Creating test documentation" - @echo " test-doc - generate documentation for test framework" - @echo " test-wipe-doc - wipe documentation for test framework" - @echo "" @echo "Creating test code coverage report" @echo " test-cov - generate code coverage report for test framework" @echo " test-wipe-cov - wipe code coverage report for test framework"