ASAN_OPTIONS?=verify_asan_link_order=0:detect_leaks=0:abort_on_error=1:unmap_shadow_on_exit=1:disable_coredump=0 export ASAN_OPTIONS .PHONY: verify-env verify-env: ifndef WS_ROOT $(error WS_ROOT is not set) endif ifndef BR $(error BR is not set) endif 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 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; done) .PHONY: verify-no-running-vpp ifdef VPP_ZOMBIE_NOCHECK VPP_PIDS= else VPP_PIDS=$(shell pgrep -d, -x vpp_main) endif ifeq ($(DEBUG),gdb) FORCE_FOREGROUND=1 else ifeq ($(DEBUG),gdbserver) FORCE_FOREGROUND=1 else ifeq ($(DEBUG),gdb-all) FORCE_FOREGROUND=1 else ifeq ($(DEBUG),gdbserver-all) FORCE_FOREGROUND=1 else ifeq ($(DEBUG),core) FORCE_FOREGROUND=1 else ifeq ($(STEP),yes) FORCE_FOREGROUND=1 else ifeq ($(STEP),y) FORCE_FOREGROUND=1 else ifeq ($(STEP),1) FORCE_FOREGROUND=1 else FORCE_FOREGROUND=0 endif ifdef PROFILE_OUTPUT PROFILE_OUTPUT_OPTS=-o $(PROFILE_OUTPUT) endif ifndef PROFILE_SORT_BY PROFILE_SORT_BY=cumtime endif ifeq ($(PROFILE),1) PYTHON_PROFILE_OPTS=-m cProfile $(PROFILE_OUTPUT_OPTS) -s $(PROFILE_SORT_BY) FORCE_FOREGROUND=1 endif verify-no-running-vpp: @if [ "$(VPP_PIDS)" != "" ]; then \ echo; \ echo "*** Existing vpp processes detected (PID(s): $(VPP_PIDS)). Running tests under these conditions is not supported. ***"; \ echo; \ ps -fp $(VPP_PIDS);\ echo; \ false; \ fi UNITTEST_EXTRA_OPTS= UNITTEST_FAILFAST_OPTS= ifeq ($(FAILFAST),1) UNITTEST_EXTRA_OPTS=-f endif ifneq ($(EXTERN_TESTS),) UNITTEST_EXTRA_OPTS=$(UNITTEST_FAILFAST_OPTS) -d $(EXTERN_TESTS) endif VENV_PATH=$(TEST_BR)/venv ifeq ($(TEST_DEBUG),1) VENV_RUN_DIR:=$(VENV_PATH)/run-debug else VENV_RUN_DIR:=$(VENV_PATH)/run endif ifeq ($(PYTHON),) PYTHON_INTERP=python3 else PYTHON_INTERP=$(PYTHON) endif PYTHON_VERSION=$(shell $(PYTHON_INTERP) -c 'import sys; print(sys.version_info.major)') PIP_VERSION=20.1.1 # Keep in sync with requirements.txt PIP_TOOLS_VERSION=5.1.2 PYTHON_DEPENDS=requirements-$(PYTHON_VERSION).txt SCAPY_SOURCE=$(shell find $(VENV_PATH)/lib/python* -name site-packages) BUILD_COV_DIR=$(TEST_BR)/coverage PIP_TOOLS_INSTALL_DONE=$(VENV_RUN_DIR)/pip-tools-install-$(PYTHON_VERSION)-$(PIP_TOOLS_VERSION).done PIP_INSTALL_DONE=$(VENV_RUN_DIR)/pip-install-$(PYTHON_VERSION)-$(PIP_VERSION).done PIP_PATCH_DONE=$(VENV_RUN_DIR)/pip-patch-$(PYTHON_VERSION).done PAPI_INSTALL_DONE=$(VENV_RUN_DIR)/papi-install-$(PYTHON_VERSION).done PAPI_PYTHON_SRC_DIR=$(WS_ROOT)/src/vpp-api/python PAPI_WIPE_DIST=$(WS_ROOT)/src/vpp-api/vapi/__pycache__ \ $(PAPI_PYTHON_SRC_DIR)/build \ $(PAPI_PYTHON_SRC_DIR)/vpp_papi.egg-info \ $(PAPI_PYTHON_SRC_DIR)/vpp_papi/__pycache__ $(PIP_TOOLS_INSTALL_DONE): @rm -rf $(VENV_PATH) @mkdir -p $(VENV_RUN_DIR) @virtualenv $(VENV_PATH) -p $(PYTHON_INTERP) # pip version pinning @bash -c "source $(VENV_PATH)/bin/activate && \ $(PYTHON_INTERP) -m pip install pip===$(PIP_VERSION)" @bash -c "source $(VENV_PATH)/bin/activate && \ $(PYTHON_INTERP) -m pip install pip-tools===$(PIP_TOOLS_VERSION)" @touch $@ $(PYTHON_DEPENDS): requirements.txt @bash -c "source $(VENV_PATH)/bin/activate && \ CUSTOM_COMPILE_COMMAND='make test-refresh-deps (or update requirements.txt)' \ $(PYTHON_INTERP) -m piptools compile -q --generate-hashes requirements.txt --output-file $@" $(PIP_INSTALL_DONE): $(PIP_TOOLS_INSTALL_DONE) $(PYTHON_DEPENDS) @bash -c "source $(VENV_PATH)/bin/activate && \ $(PYTHON_INTERP) -m piptools sync $(PYTHON_DEPENDS)" @touch $@ $(PIP_PATCH_DONE): $(PIP_INSTALL_DONE) @echo --- patching --- @sleep 1 # Ensure python recompiles patched *.py files -> *.pyc for f in $(CURDIR)/patches/scapy-2.4.3/*.patch ; do \ echo Applying patch: $$(basename $$f) ; \ patch --forward -p1 -d $(SCAPY_SOURCE) < $$f ; \ retCode=$$?; \ [ $$retCode -gt 1 ] && exit $$retCode; \ done; \ touch $@ $(PAPI_INSTALL_DONE): $(PIP_PATCH_DONE) @bash -c "source $(VENV_PATH)/bin/activate && $(PYTHON_INTERP) -m pip install -e $(PAPI_PYTHON_SRC_DIR)" @touch $@ .PHONY: refresh-deps refresh-deps: clean-deps $(PYTHON_DEPENDS) .PHONY: clean-deps clean-deps: @rm -f $(PYTHON_DEPENDS) INTERN_PLUGIN_SRC_DIR=$(WS_ROOT)/src/plugins ifneq ($(EXTERN_PLUGIN_SRC_DIR),) PLUGIN_SRC_DIR=$(EXTERN_PLUGIN_SRC_DIR) else PLUGIN_SRC_DIR=$(INTERN_PLUGIN_SRC_DIR) endif define retest-func @env 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 endef .PHONY: sanity 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 && PYTHONPATH=$(BUILD_TEST_SRC) $(PYTHON_INTERP) $(BUILD_TEST_SRC)/sanity_run_vpp.py endif ifndef TEST_JOBS PARALLEL_ILLEGAL=0 else ifeq ($(FORCE_FOREGROUND),0) PARALLEL_ILLEGAL=0 else ifeq ($(TEST_JOBS),auto) PARALLEL_ILLEGAL=0 else ifeq ($(TEST_JOBS),1) PARALLEL_ILLEGAL=0 else PARALL
# Copyright (c) 2018 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
add_vpp_plugin(igmp
SOURCES
igmp.c
igmp_query.c
igmp_report.c
igmp_group.c
igmp_src.c
igmp_config.c
igmp_cli.c
igmp_api.c
igmp_input.c
igmp_timer.c
igmp_pkt.c
igmp_ssm_range.c
igmp_format.c
API_FILES
igmp.api
)