diff options
author | Andrew Yourtchenko <ayourtch@gmail.com> | 2023-09-26 16:01:21 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2023-10-03 13:23:25 +0000 |
commit | bc37878ecbad0a3a24801f1ad5af04a209b4c201 (patch) | |
tree | ad53a00aa4a6fd49f94a10483839f4fff0a0f2d4 | |
parent | 08057947f3da441d571420d4594ce1e3888516ea (diff) |
build: add ability to disable some plugins from packaging and tests
When custom-packaging the VPP artifacts, it can be useful to exclude
some of the core plugins from packaging/testing, for some reasons.
A removal of a plugin(s) from the worktree needs to be tracked as
a separate change, and thus is tricky from the maintenance
point of view.
This change adds the ability to "pretend they do not exist" -
plugins which are added to the comma-separated environment
variable "VPP_EXCLUDED_PLUGINS" will not be added to the build
process and not packaged.
The tests do not have the 1:1 relationship as plugins,
so they might need to be modified separately. This change
includes some of these modifications as an example.
Type: feature
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: Id31562d00a01ced1acbb4996a633517cbd6f09d8
-rw-r--r-- | build-data/packages/vpp.mk | 3 | ||||
-rw-r--r-- | src/plugins/CMakeLists.txt | 22 | ||||
-rw-r--r-- | test/Makefile | 10 | ||||
-rw-r--r-- | test/asf/test_quic.py | 1 | ||||
-rw-r--r-- | test/config.py | 9 | ||||
-rw-r--r-- | test/test_abf.py | 7 | ||||
-rw-r--r-- | test/test_acl_plugin.py | 2 | ||||
-rw-r--r-- | test/test_acl_plugin_l2l3.py | 2 | ||||
-rw-r--r-- | test/test_acl_plugin_macip.py | 2 | ||||
-rw-r--r-- | test/test_ikev2.py | 2 | ||||
-rw-r--r-- | test/test_wireguard.py | 7 |
11 files changed, 65 insertions, 2 deletions
diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk index ad1d1fc9a28..40aa8c79d23 100644 --- a/build-data/packages/vpp.mk +++ b/build-data/packages/vpp.mk @@ -30,6 +30,9 @@ vpp_cmake_args += -DCMAKE_PREFIX_PATH:PATH="$(vpp_cmake_prefix_path)" ifeq ("$(V)","1") vpp_cmake_args += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON endif +ifneq ($(VPP_EXCLUDED_PLUGINS),) +vpp_cmake_args += -DVPP_EXCLUDED_PLUGINS="$(VPP_EXCLUDED_PLUGINS)" +endif ifneq ($(VPP_EXTRA_CMAKE_ARGS),) vpp_cmake_args += $(VPP_EXTRA_CMAKE_ARGS) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index e54eaa2c4cb..43ad4cc2a25 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -23,7 +23,27 @@ FILE(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt ) + +set(VPP_EXCLUDED_PLUGINS + "" + CACHE + STRING "Comma-separated list of core plugins excluded from packaging and tests" +) + +# create the list of the plugins that we need to exclude from packaging +SET(excluded_plugins "") +STRING(REGEX REPLACE "[,]+" ";" exc_plugins "${VPP_EXCLUDED_PLUGINS}") +foreach (e ${exc_plugins}) + message(WARNING "Excluding plugin due to VPP_EXCLUDED_PLUGINS: '${e}'") + list(APPEND excluded_plugins ${e}) +endforeach() + foreach (f ${files}) get_filename_component(dir ${f} DIRECTORY) - add_subdirectory(${dir}) + + # if a plugin is in the list of excluded plugin, do not add that subdirectory + LIST(FIND excluded_plugins "${dir}" exc_index) + if(${exc_index} EQUAL "-1") + add_subdirectory(${dir}) + endif() endforeach() diff --git a/test/Makefile b/test/Makefile index 939b0e14813..4ff0c152a30 100644 --- a/test/Makefile +++ b/test/Makefile @@ -254,9 +254,17 @@ ifneq ($(EXTERN_APIDIR),) ARG17=--extern-apidir=$(EXTERN_APIDIR) endif +EXC_PLUGINS_ARG= +ifneq ($(VPP_EXCLUDED_PLUGINS),) +# convert the comma-separated list into N invocations of the argument to exclude a plugin +EXC_PLUGINS_ARG=$(shell echo "${VPP_EXCLUDED_PLUGINS}" | sed 's/\([^,]*\)/--excluded-plugin=\1/g; s/,/ /g') +endif + + + EXTRA_ARGS=$(ARG0) $(ARG1) $(ARG2) $(ARG3) $(ARG4) $(ARG5) $(ARG6) $(ARG7) $(ARG8) $(ARG9) $(ARG10) $(ARG11) $(ARG12) $(ARG13) $(ARG14) $(ARG15) $(ARG16) $(ARG17) -RUN_TESTS_ARGS=--failed-dir=$(FAILED_DIR) --verbose=$(V) --jobs=$(TEST_JOBS) --filter=$(TEST) --retries=$(RETRIES) --venv-dir=$(VENV_PATH) --vpp-ws-dir=$(WS_ROOT) --vpp-tag=$(TAG) --rnd-seed=$(RND_SEED) --vpp-worker-count="$(VPP_WORKER_COUNT)" --keep-pcaps $(PLUGIN_PATH_ARGS) $(TEST_PLUGIN_PATH_ARGS) $(EXTRA_ARGS) +RUN_TESTS_ARGS=--failed-dir=$(FAILED_DIR) --verbose=$(V) --jobs=$(TEST_JOBS) --filter=$(TEST) --retries=$(RETRIES) --venv-dir=$(VENV_PATH) --vpp-ws-dir=$(WS_ROOT) --vpp-tag=$(TAG) --rnd-seed=$(RND_SEED) --vpp-worker-count="$(VPP_WORKER_COUNT)" --keep-pcaps $(PLUGIN_PATH_ARGS) $(EXC_PLUGINS_ARG) $(TEST_PLUGIN_PATH_ARGS) $(EXTRA_ARGS) RUN_SCRIPT_ARGS=--python-opts=$(PYTHON_OPTS) define retest-func diff --git a/test/asf/test_quic.py b/test/asf/test_quic.py index 4f816a36f0c..0d615d52132 100644 --- a/test/asf/test_quic.py +++ b/test/asf/test_quic.py @@ -52,6 +52,7 @@ class QUICAppWorker(Worker): return False +@unittest.skipIf("quic" in config.excluded_plugins, "Exclude QUIC plugin tests") class QUICTestCase(VppTestCase): """QUIC Test Case""" diff --git a/test/config.py b/test/config.py index 5d2ef1dab4f..e5c52b997d6 100644 --- a/test/config.py +++ b/test/config.py @@ -387,6 +387,15 @@ parser.add_argument( ) parser.add_argument( + "--excluded-plugin", + dest="excluded_plugins", + required=False, + action="append", + default=[], + help="Exclude the tests that indicate they require this plugin(s)", +) + +parser.add_argument( "-d", "--socket-dir", dest="socket_dir", diff --git a/test/test_abf.py b/test/test_abf.py index 87e6842dc5f..d284c7a1a85 100644 --- a/test/test_abf.py +++ b/test/test_abf.py @@ -3,6 +3,8 @@ from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 import unittest +from config import config + from framework import VppTestCase, VppTestRunner from vpp_ip import DpoProto from vpp_ip_route import ( @@ -119,6 +121,11 @@ class VppAbfAttach(VppObject): return "abf-attach-%d-%d" % (self.policy_id, self.sw_if_index) +@unittest.skipIf( + "acl" in config.excluded_plugins, + "Exclude ABF plugin tests due to absence of ACL plugin", +) +@unittest.skipIf("abf" in config.excluded_plugins, "Exclude ABF plugin tests") class TestAbf(VppTestCase): """ABF Test Case""" diff --git a/test/test_acl_plugin.py b/test/test_acl_plugin.py index 036a5dbc0c2..235016e45b1 100644 --- a/test/test_acl_plugin.py +++ b/test/test_acl_plugin.py @@ -5,6 +5,7 @@ import unittest import random +from config import config from scapy.packet import Raw from scapy.layers.l2 import Ether from scapy.layers.inet import IP, TCP, UDP, ICMP @@ -20,6 +21,7 @@ from vpp_acl import AclRule, VppAcl, VppAclInterface, VppEtypeWhitelist from vpp_ip import INVALID_INDEX +@unittest.skipIf("acl" in config.excluded_plugins, "Exclude ACL plugin tests") @tag_fixme_vpp_workers class TestACLplugin(VppTestCase): """ACL plugin Test Case""" diff --git a/test/test_acl_plugin_l2l3.py b/test/test_acl_plugin_l2l3.py index 343e611751b..8caca0b225b 100644 --- a/test/test_acl_plugin_l2l3.py +++ b/test/test_acl_plugin_l2l3.py @@ -29,6 +29,7 @@ from socket import inet_pton, AF_INET, AF_INET6 from random import choice, shuffle from pprint import pprint from ipaddress import ip_network +from config import config import scapy.compat from scapy.packet import Raw @@ -45,6 +46,7 @@ import time from vpp_acl import AclRule, VppAcl, VppAclInterface +@unittest.skipIf("acl" in config.excluded_plugins, "Exclude ACL plugin tests") class TestACLpluginL2L3(VppTestCase): """TestACLpluginL2L3 Test Case""" diff --git a/test/test_acl_plugin_macip.py b/test/test_acl_plugin_macip.py index 6a1ba589182..9543ee261dd 100644 --- a/test/test_acl_plugin_macip.py +++ b/test/test_acl_plugin_macip.py @@ -11,6 +11,7 @@ from struct import pack, unpack import re import unittest from ipaddress import ip_network, IPv4Network, IPv6Network +from config import config import scapy.compat from scapy.packet import Raw @@ -39,6 +40,7 @@ from vpp_acl import ( from vpp_papi import MACAddress +@unittest.skipIf("acl" in config.excluded_plugins, "Exclude ACL plugin tests") class MethodHolder(VppTestCase): DEBUG = False diff --git a/test/test_ikev2.py b/test/test_ikev2.py index f0fd2055379..5e2625d0211 100644 --- a/test/test_ikev2.py +++ b/test/test_ikev2.py @@ -580,6 +580,7 @@ class IKEv2SA(object): return digest.finalize() +@unittest.skipIf("ikev2" in config.excluded_plugins, "Exclude IKEv2 plugin tests") class IkePeer(VppTestCase): """common class for initiator and responder""" @@ -1667,6 +1668,7 @@ class Ikev2Params(object): ) +@unittest.skipIf("ikev2" in config.excluded_plugins, "Exclude IKEv2 plugin tests") class TestApi(VppTestCase): """Test IKEV2 API""" diff --git a/test/test_wireguard.py b/test/test_wireguard.py index 5511dc48d83..4e9679283c4 100644 --- a/test/test_wireguard.py +++ b/test/test_wireguard.py @@ -6,6 +6,7 @@ import base64 import os from hashlib import blake2s +from config import config from scapy.packet import Packet from scapy.packet import Raw from scapy.layers.l2 import Ether, ARP @@ -509,6 +510,9 @@ def is_handshake_init(p): return wg_p[Wireguard].message_type == 1 +@unittest.skipIf( + "wireguard" in config.excluded_plugins, "Exclude Wireguard plugin tests" +) class TestWg(VppTestCase): """Wireguard Test Case""" @@ -2848,6 +2852,9 @@ class WireguardHandoffTests(TestWg): """Multi-tunnel on the same port""" +@unittest.skipIf( + "wireguard" in config.excluded_plugins, "Exclude Wireguard plugin tests" +) class TestWgFIB(VppTestCase): """Wireguard FIB Test Case""" |