tests: move test source to vpp/test 93/32293/2
authorDave Wallace <dwallacelf@gmail.com>
Thu, 13 May 2021 01:43:59 +0000 (21:43 -0400)
committerDamjan Marion <dmarion@me.com>
Thu, 13 May 2021 09:33:06 +0000 (09:33 +0000)
- Generate copyright year and version
  instead of using hard-coded data

Type: refactor

Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I6058f5025323b3aa483f5df4a2c4371e27b5914e

95 files changed:
.gitignore
src/plugins/srv6-am/test/vpp_srv6.py [deleted symlink]
src/plugins/srv6-as/test/vpp_srv6.py [deleted symlink]
test/Makefile
test/bfd.py [moved from src/vnet/bfd/test/bfd.py with 100% similarity]
test/doc/Makefile
test/doc/conf.py
test/test_abf.py [moved from src/plugins/abf/test/test_abf.py with 100% similarity]
test/test_acl_plugin.py [moved from src/plugins/acl/test/test_acl_plugin.py with 100% similarity]
test/test_acl_plugin_conns.py [moved from src/plugins/acl/test/test_acl_plugin_conns.py with 100% similarity]
test/test_acl_plugin_l2l3.py [moved from src/plugins/acl/test/test_acl_plugin_l2l3.py with 100% similarity]
test/test_acl_plugin_macip.py [moved from src/plugins/acl/test/test_acl_plugin_macip.py with 100% similarity]
test/test_adl.py [moved from src/plugins/adl/test/test_adl.py with 100% similarity]
test/test_arping.py [moved from src/plugins/arping/test/test_arping.py with 100% similarity]
test/test_bfd.py [moved from src/vnet/bfd/test/test_bfd.py with 100% similarity]
test/test_bier.py [moved from src/vnet/bier/test/test_bier.py with 100% similarity]
test/test_bihash.py [moved from src/vppinfra/test/test_bihash.py with 100% similarity]
test/test_bond.py [moved from src/vnet/bonding/test/test_bond.py with 100% similarity]
test/test_buffers.py [moved from src/vlib/test/test_buffers.py with 100% similarity]
test/test_cdp.py [moved from src/plugins/cdp/test/test_cdp.py with 100% similarity]
test/test_classifier.py [moved from src/vnet/classify/test/test_classifier.py with 100% similarity]
test/test_classifier_ip6.py [moved from src/vnet/classify/test/test_classifier_ip6.py with 100% similarity]
test/test_classify_l2_acl.py [moved from src/plugins/acl/test/test_classify_l2_acl.py with 100% similarity]
test/test_cli.py [moved from src/vlib/test/test_cli.py with 100% similarity]
test/test_cnat.py [moved from src/plugins/cnat/test/test_cnat.py with 100% similarity]
test/test_counters.py [moved from src/vlib/test/test_counters.py with 100% similarity]
test/test_crypto.py [moved from src/vnet/crypto/test/test_crypto.py with 100% similarity]
test/test_det44.py [moved from src/plugins/nat/test/test_det44.py with 100% similarity]
test/test_dhcp.py [moved from src/plugins/dhcp/test/test_dhcp.py with 100% similarity]
test/test_dhcp6.py [moved from src/plugins/dhcp/test/test_dhcp6.py with 100% similarity]
test/test_dns.py [moved from src/plugins/dns/test/test_dns.py with 100% similarity]
test/test_dslite.py [moved from src/plugins/nat/test/test_dslite.py with 100% similarity]
test/test_dvr.py [moved from src/vnet/fib/test/test_dvr.py with 100% similarity]
test/test_endian.py [moved from src/vpp-api/test/test_endian.py with 100% similarity]
test/test_fib.py [moved from src/vnet/fib/test/test_fib.py with 100% similarity]
test/test_flowprobe.py [moved from src/plugins/flowprobe/test/test_flowprobe.py with 100% similarity]
test/test_gbp.py [moved from src/plugins/gbp/test/test_gbp.py with 100% similarity]
test/test_geneve.py [moved from src/plugins/geneve/test/test_geneve.py with 100% similarity]
test/test_gre.py [moved from src/vnet/gre/test/test_gre.py with 100% similarity]
test/test_gro.py [moved from src/vnet/gso/test/test_gro.py with 100% similarity]
test/test_gso.py [moved from src/vnet/gso/test/test_gso.py with 100% similarity]
test/test_gtpu.py [moved from src/plugins/gtpu/test/test_gtpu.py with 100% similarity]
test/test_igmp.py [moved from src/plugins/igmp/test/test_igmp.py with 100% similarity]
test/test_ikev2.py [moved from src/plugins/ikev2/test/test_ikev2.py with 100% similarity]
test/test_ipsec_nat.py [moved from src/plugins/nat/test/test_ipsec_nat.py with 100% similarity]
test/test_l2tp.py [moved from src/plugins/l2tp/test/test_l2tp.py with 100% similarity]
test/test_l3xc.py [moved from src/plugins/l3xc/test/test_l3xc.py with 100% similarity]
test/test_lacp.py [moved from src/plugins/lacp/test/test_lacp.py with 100% similarity]
test/test_lb.py [moved from src/plugins/lb/test/test_lb.py with 100% similarity]
test/test_lb_api.py [moved from src/plugins/lb/test/test_lb_api.py with 100% similarity]
test/test_linux_cp.py [moved from src/plugins/linux-cp/test/test_linux_cp.py with 100% similarity]
test/test_lisp.py [moved from src/plugins/lisp/test/test_lisp.py with 100% similarity]
test/test_mactime.py [moved from src/plugins/mactime/test/test_mactime.py with 100% similarity]
test/test_map.py [moved from src/plugins/map/test/test_map.py with 100% similarity]
test/test_map_br.py [moved from src/plugins/map/test/test_map_br.py with 100% similarity]
test/test_memif.py [moved from src/plugins/memif/test/test_memif.py with 100% similarity]
test/test_mss_clamp.py [moved from src/plugins/mss_clamp/test/test_mss_clamp.py with 100% similarity]
test/test_nat44_ed.py [moved from src/plugins/nat/test/test_nat44_ed.py with 100% similarity]
test/test_nat44_ei.py [moved from src/plugins/nat/test/test_nat44_ei.py with 100% similarity]
test/test_nat64.py [moved from src/plugins/nat/test/test_nat64.py with 100% similarity]
test/test_nat66.py [moved from src/plugins/nat/test/test_nat66.py with 100% similarity]
test/test_ping.py [moved from src/plugins/ping/test/test_ping.py with 100% similarity]
test/test_pnat.py [moved from src/plugins/nat/test/test_pnat.py with 100% similarity]
test/test_policer.py [moved from src/vnet/policer/test/test_policer.py with 100% similarity]
test/test_policer_input.py [moved from src/vnet/policer/test/test_policer_input.py with 100% similarity]
test/test_pppoe.py [moved from src/plugins/pppoe/test/test_pppoe.py with 100% similarity]
test/test_quic.py [moved from src/plugins/quic/test/test_quic.py with 100% similarity]
test/test_srv6.py [moved from src/plugins/srv6-am/test/test_srv6.py with 100% similarity]
test/test_srv6_ad.py [moved from src/plugins/srv6-ad/test/test_srv6_ad.py with 100% similarity]
test/test_srv6_ad_flow.py [moved from src/plugins/srv6-ad-flow/test/test_srv6_ad_flow.py with 100% similarity]
test/test_srv6_as.py [moved from src/plugins/srv6-as/test/test_srv6_as.py with 100% similarity]
test/test_srv6_mobile.py [moved from src/plugins/srv6-mobile/test/test_srv6_mobile.py with 100% similarity]
test/test_svs.py [moved from src/plugins/svs/test/test_svs.py with 100% similarity]
test/test_urpf.py [moved from src/plugins/urpf/test/test_urpf.py with 100% similarity]
test/test_vapi.py [moved from src/vpp-api/test/test_vapi.py with 100% similarity]
test/test_vpe_api.py [moved from src/vpp-api/test/test_vpe_api.py with 100% similarity]
test/test_vppinfra.py [moved from src/vppinfra/test/test_vppinfra.py with 100% similarity]
test/test_vrrp.py [moved from src/plugins/vrrp/test/test_vrrp.py with 100% similarity]
test/test_vxlan.py [moved from src/vnet/vxlan/test/test_vxlan.py with 100% similarity]
test/test_vxlan6.py [moved from src/vnet/vxlan/test/test_vxlan6.py with 100% similarity]
test/test_vxlan_gbp.py [moved from src/vnet/vxlan/test/test_vxlan_gbp.py with 100% similarity]
test/test_vxlan_gpe.py [moved from src/vnet/vxlan/test/test_vxlan_gpe.py with 100% similarity]
test/test_wireguard.py [moved from src/plugins/wireguard/test/test_wireguard.py with 100% similarity]
test/vpp_acl.py [moved from src/plugins/acl/test/vpp_acl.py with 100% similarity]
test/vpp_bier.py [moved from src/vnet/bier/test/vpp_bier.py with 100% similarity]
test/vpp_bond_interface.py [moved from src/vnet/bonding/test/vpp_bond_interface.py with 100% similarity]
test/vpp_dhcp.py [moved from src/plugins/dhcp/test/vpp_dhcp.py with 100% similarity]
test/vpp_igmp.py [moved from src/plugins/igmp/test/vpp_igmp.py with 100% similarity]
test/vpp_ikev2.py [moved from src/plugins/ikev2/test/vpp_ikev2.py with 100% similarity]
test/vpp_lb.py [moved from src/plugins/lb/test/vpp_lb.py with 100% similarity]
test/vpp_memif.py [moved from src/plugins/memif/test/vpp_memif.py with 100% similarity]
test/vpp_pppoe_interface.py [moved from src/plugins/pppoe/test/vpp_pppoe_interface.py with 100% similarity]
test/vpp_srv6.py [moved from src/plugins/srv6-ad/test/vpp_srv6.py with 100% similarity]
test/vpp_vxlan_gbp_tunnel.py [moved from src/vnet/vxlan/test/vpp_vxlan_gbp_tunnel.py with 100% similarity]
test/vpp_vxlan_tunnel.py [moved from src/vnet/vxlan/test/vpp_vxlan_tunnel.py with 100% similarity]

index d91975e..80c4e4f 100644 (file)
@@ -20,6 +20,9 @@
 /test/run/
 /test/build/
 /test/coverage/
+/test/venv/
+/test/vapi_test/
+/test/doc/build/
 /build-config.mk
 /build/external/*.tar.gz
 /build/external/*.tar.xz
@@ -117,4 +120,4 @@ compile_commands.json
 /extras/vpptop/build/*
 
 # debian packaging
-.pc
\ No newline at end of file
+.pc
diff --git a/src/plugins/srv6-am/test/vpp_srv6.py b/src/plugins/srv6-am/test/vpp_srv6.py
deleted file mode 120000 (symlink)
index 78f7566..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../srv6-ad/test/vpp_srv6.py
\ No newline at end of file
diff --git a/src/plugins/srv6-as/test/vpp_srv6.py b/src/plugins/srv6-as/test/vpp_srv6.py
deleted file mode 120000 (symlink)
index 78f7566..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../srv6-ad/test/vpp_srv6.py
\ No newline at end of file
index 0ee61a2..8209588 100644 (file)
@@ -13,14 +13,10 @@ 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)
+export TEST_DOC_BR = $(TEST_DIR)/doc/build
 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 +66,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,11 +80,6 @@ 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
 # Keep in sync with requirements.txt
@@ -158,7 +149,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 +158,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
@@ -207,16 +198,11 @@ sanity: test-dep
 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
@@ -229,8 +215,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);\
@@ -259,14 +243,13 @@ 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)
+doc: $(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"
@@ -305,7 +288,7 @@ wipe-all: wipe wipe-papi wipe-doc 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 +309,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 \"*******************************************************************\" &&\
similarity index 100%
rename from src/vnet/bfd/test/bfd.py
rename to test/bfd.py
index 608df0a..2d06ced 100644 (file)
@@ -19,9 +19,6 @@ endif
 ifndef TEST_DOC_BR
        $(error TEST_DOC_BR is not set)
 endif
-ifndef BUILD_TEST_SRC
-       $(error BUILD_TEST_SRC is not set)
-endif
 ifeq ($(IN_VENV),0)
        $(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
 endif
@@ -32,7 +29,7 @@ regen-api-doc: verify-virtualenv
        @cp $(SRC_DOC_DIR)/index.rst $(API_DOC_GEN_DIR)
        @cp $(SRC_DOC_DIR)/indices.rst $(API_DOC_GEN_DIR)
        @cp $(SRC_DOC_DIR)/overview.rst $(API_DOC_GEN_DIR)
-       sphinx-apidoc -o $(API_DOC_GEN_DIR) -H "Module documentation" $(BUILD_TEST_SRC)
+       sphinx-apidoc -o $(API_DOC_GEN_DIR) -H "Module documentation" $(TEST_DIR)
 
 .PHONY: html
 html: regen-api-doc verify-virtualenv
index f5e9749..f73cde2 100644 (file)
@@ -18,7 +18,9 @@
 #
 import os
 import sys
-sys.path.insert(0, os.path.abspath('../../build-root/build-test/src'))
+import subprocess
+from datetime import date
+sys.path.insert(0, os.path.abspath('..'))
 
 # -- General configuration ------------------------------------------------
 
@@ -59,17 +61,18 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'VPP test framework'
-copyright = u'2019, VPP team'
-author = u'VPP team'
+copyright = f'{date.today().year}, FD.io VPP team'
+author = u'FD.io VPP team'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = u'20.01'
+output = subprocess.run(['../../src/scripts/version'], stdout=subprocess.PIPE)
+version = f'{output.stdout.decode("utf-8")}'
 # The full version, including alpha/beta/rc tags.
-release = u'20.01-rc0'
+release = f'{output.stdout.decode("utf-8")}'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
similarity index 100%
rename from src/vlib/test/test_cli.py
rename to test/test_cli.py
similarity index 100%
rename from src/plugins/lb/test/vpp_lb.py
rename to test/vpp_lb.py