# Copyright (c) 2016 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. export WS_ROOT=$(CURDIR) export BR=$(WS_ROOT)/build-root CCACHE_DIR?=$(BR)/.ccache GDB?=gdb PLATFORM?=vpp SAMPLE_PLUGIN?=no ,:=, define disable_plugins $(if $(1), \ "plugins {" \ $(patsubst %,"plugin %_plugin.so { disable }",$(subst $(,), ,$(1))) \ " }" \ ,) endef MINIMAL_STARTUP_CONF=" \ unix { \ interactive \ cli-listen /run/vpp/cli.sock \ gid $(shell id -g) \ $(if $(wildcard startup.vpp),"exec startup.vpp",) \ } \ $(if $(DPDK_CONFIG), "dpdk { $(DPDK_CONFIG) }",) \ $(call disable_plugins,$(DISABLED_PLUGINS)) \ " GDB_ARGS= -ex "handle SIGUSR1 noprint nostop" # # OS Detection # # We allow Darwin (MacOS) for docs generation; VPP build will still fail. ifneq ($(shell uname),Darwin) OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') endif ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID)) PKG=deb else ifeq ($(filter rhel centos fedora opensuse,$(OS_ID)),$(OS_ID)) PKG=rpm endif # +libganglia1-dev if building the gmond plugin DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config DEB_DEPENDS += lcov chrpath autoconf nasm indent DEB_DEPENDS += python-all python-dev python-virtualenv python-pip libffi6 ifeq ($(OS_VERSION_ID),14.04) DEB_DEPENDS += openjdk-8-jdk-headless else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8) DEB_DEPENDS += openjdk-8-jdk-headless APT_ARGS = -t jessie-backports else DEB_DEPENDS += default-jdk-headless endif RPM_DEPENDS = redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils RPM_DEPENDS += openssl-devel https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm apr-devel RPM_DEPENDS += python-devel ifeq ($(OS_ID)-$(OS_VERSION_ID),fedora-25) RPM_DEPENDS += python2-virtualenv RPM_DEPENDS_GROUPS = 'C Development Tools and Libraries' else RPM_DEPENDS += python-virtualenv RPM_DEPENDS_GROUPS = 'Development Tools' endif # +ganglia-devel if building the ganglia plugin RPM_DEPENDS += chrpath libffi-devel rpm-build ifeq ($(OS_ID),fedora) RPM_DEPENDS += nasm else RPM_DEPENDS += https://kojipkgs.fedoraproject.org//packages/nasm/2.12.02/2.fc26/x86_64/nasm-2.12.02-2.fc26.x86_64.rpm endif EPEL_DEPENDS = libconfuse-devel epel-rpm-macros ifeq ($(filter rhel centos,$(OS_ID)),$(OS_ID)) EPEL_DEPENDS += lcov else RPM_DEPENDS += lcov endif RPM_SUSE_DEPENDS = autoconf automake bison ccache chrpath distribution-release gcc6 glibc-devel-static RPM_SUSE_DEPENDS += java-1_8_0-openjdk-devel libopenssl-devel libtool lsb-release make openssl-devel RPM_SUSE_DEPENDS += python-devel python-pip python-rpm-macros shadow nasm ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),) STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf endif ifeq ($(findstring y,$(UNATTENDED)),y) CONFIRM=-y FORCE=--force-yes endif TARGETS = vpp ifneq ($(SAMPLE_PLUGIN),no) TARGETS += sample-plugin endif .PHONY: help bootstrap wipe wipe-release build build-release rebuild rebuild-release .PHONY: run run-release debug debug-release build-vat run-vat pkg-deb pkg-rpm .PHONY: ctags cscope .PHONY: test test-debug retest retest-debug test-doc test-wipe-doc test-help test-wipe .PHONY: test-cov test-wipe-cov help: @echo "Make Targets:" @echo " bootstrap - prepare tree for build" @echo " install-dep - install software dependencies" @echo " wipe - wipe all products of debug build " @echo " wipe-release - wipe all products of release build " @echo " build - build debug binaries" @echo " build-release - build release binaries" @echo " build-coverity - build coverity artifacts" @echo " rebuild - wipe and build debug binares" @echo " rebuild-release - wipe and build release binares" @echo " run - run debug binary" @echo " run-release - run release binary" @echo " debug - run debug binary with debugger" @echo " debug-release - run release binary with debugger" @echo " test - build and run (basic) functional tests" @echo " test-debug - build and run (basic) functional tests (debug build)" @echo " test-all - build and run (all) functional tests" @echo " test-all-debug - build and run (all) functional tests (debug build)" @echo " test-shell - enter shell with test environment" @echo " test-shell-debug - enter shell with test environment (debug build)" @echo " test-wipe - wipe files generated by unit tests" @echo " retest - run functional tests" @echo " retest-debug - run functional tests (debug build)" @echo " test-help - show help on test framework" @echo " run-vat - run vpp-api-test tool" @echo " pkg-deb - build DEB packages" @echo " pkg-rpm - build RPM packages" @echo " dpdk-install-dev - install
import gc
import pprint
import vpp_papi
from vpp_papi_provider import VppPapiProvider
import objgraph
from pympler import tracker
tr = tracker.SummaryTracker()

"""
  Internal debug module

  The module provides functions for debugging test framework
"""


def on_tear_down_class(cls):
    gc.collect()
    tr.print_diff()
    objects = gc.get_objects()
    counter = 0
    with open(cls.tempdir + '/python_objects.txt', 'w') as f:
        interesting = [
            o for o