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
This commit is contained in:
Andrew Yourtchenko
2023-09-26 16:01:21 +02:00
committed by Damjan Marion
parent 08057947f3
commit bc37878ecb
11 changed files with 65 additions and 2 deletions
+3
View File
@@ -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)
+21 -1
View File
@@ -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()
+9 -1
View File
@@ -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
+1
View File
@@ -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"""
+9
View File
@@ -386,6 +386,15 @@ parser.add_argument(
help="Runs tests against a running VPP.",
)
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",
+7
View File
@@ -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"""
+2
View File
@@ -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"""
+2
View File
@@ -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"""
+2
View File
@@ -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
+2
View File
@@ -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"""
+7
View File
@@ -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"""