Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ sudo: required
dist: xenial
language: cpp

cache:
- ccache

services:
- docker

Expand Down Expand Up @@ -47,8 +50,8 @@ install:
before_script:
- sudo mkdir -p /mnt/huge
- sudo mount -t hugetlbfs nodev /mnt/huge
- export CXX=$VER_CXX
- export CC=$VER_CC
- export CXX="ccache $VER_CXX"
- ccache -s

script:
# travis_wait extends the 10-min timeout to 20mins.
Expand All @@ -68,6 +71,9 @@ after_failure:
- more /tmp/bessd.*.INFO.* | cat # dump all bessd log files
- sudo more /tmp/sanitizer* | cat # dump all sanitizer results

after_script:
- ccache -s

before_deploy:
- for arch in core2 sandybridge haswell; do
export CXXARCHFLAGS="-march=$arch";
Expand Down
32 changes: 22 additions & 10 deletions container_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@
BUILD_SCRIPT = './build.py'
PLUGINS = []

CCACHE_DIR_HOST = '~/.ccache'
CCACHE_DIR_CONTAINER = '/tmp/ccache'


def docker_mount_args(plugins):
"""
Return the string of arguments to "docker run" suitable for
mounting BESS_DIR_HOST as BESS_DIR_CONTAINER and all the
plugins under their original paths.
mounting BESS_DIR_HOST (as BESS_DIR_CONTAINER), ccache, and
all the plugins under their original paths.

Note, the plugins must not live under the BESS_DIR_CONTAINER
directory itself since that will not play well. But plugins
Expand All @@ -65,12 +68,17 @@ def docker_mount_args(plugins):
sys.exit('Error: plugin {!r}: path {!r} is taken by '
'bess'.format(path, BESS_DIR_CONTAINER))

ret = ['-v {}:{}'.format(BESS_DIR_HOST, BESS_DIR_CONTAINER)]
# If the ccache directory does not exist, create one owned by the current
# user (otherwise Docker will create one with root:root)
os.system('mkdir -p %s' % CCACHE_DIR_HOST)

ret = ['-v {}:{}'.format(CCACHE_DIR_HOST, CCACHE_DIR_CONTAINER),
'-v {}:{}'.format(BESS_DIR_HOST, BESS_DIR_CONTAINER)]

# Make sure longer paths that are prefixes of shorter paths
# appear after the shorter paths. That way we mount only
# /foo/bar if both /foo/bar and /foo/bar/sub/dir are listed.
earlier = { BESS_DIR_HOST: True }
earlier = {BESS_DIR_HOST: True}
for path in sorted(plugins, key=lambda x: x + os.path.sep):
# given, e.g., /foo/bar/baz we want to look at /foo, /foo/bar,
# and /foo/bar/baz to see if they're already in the mount list.
Expand Down Expand Up @@ -102,16 +110,20 @@ def shell_quote(cmd):
return "'" + cmd.replace("'", "'\\''") + "'"


def docker_env_args():
env_vars = ['V', 'CXX', 'DEBUG', 'SANITIZE']
return ' '.join(['-e %s' % var for var in env_vars])


def run_docker_cmd(cmd):
run_cmd('docker run -e V -e CXX -e DEBUG -e SANITIZE --rm -t '
'-u %d:%d %s %s sh -c %s' %
(os.getuid(), os.getgid(), docker_mount_args(PLUGINS),
IMAGE, shell_quote(cmd)))
run_cmd('docker run %s --rm -t -u %d:%d %s %s sh -c %s' %
(docker_env_args(), os.getuid(), os.getgid(),
docker_mount_args(PLUGINS), IMAGE, shell_quote(cmd)))


def run_shell():
run_cmd('docker run -e V -e CXX -e DEBUG -e SANITIZE --rm -it %s %s' %
(docker_mount_args(PLUGINS), IMAGE))
run_cmd('docker run %s --rm -it %s %s' %
(docker_env_args(), docker_mount_args(PLUGINS), IMAGE))


def find_current_plugins():
Expand Down
1 change: 0 additions & 1 deletion core/gate_hooks/track.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ CommandResponse Track::CommandReset(const bess::pb::EmptyArg &) {
}

void Track::ProcessBatch(const bess::PacketBatch *batch) {
LOG(ERROR) << current_worker.wid();
TrackStats *stat = &worker_stats_[current_worker.wid()];

size_t cnt = batch->cnt();
Expand Down
6 changes: 4 additions & 2 deletions env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ RUN mkdir -p /build

# Pre-build DPDK from the specified BESS branch
ARG BESS_DPDK_BRANCH=master
ARG DPDK_ARCH=x86_64
RUN cd /build && \
git clone -b ${BESS_DPDK_BRANCH} https://github.com/netsys/bess && \
cd /build/bess && \
setarch ${DPDK_ARCH} ./build.py dpdk && \
./build.py dpdk && \
mv /build/bess/deps/dpdk-17.11 /build/dpdk-17.11 && \
rm -rf /build/bess

ENV CCACHE_DIR=/tmp/ccache
ENV CCACHE_COMPRESS=true

WORKDIR /build/bess
1 change: 1 addition & 0 deletions env/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@
- ca-certificates
- g++-8
- clang-6.0
- ccache
12 changes: 3 additions & 9 deletions env/rebuild_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
TARGET_REPO = 'nefelinetworks/bess_build'

imgs = {
'bionic64': {'arch': 'x86_64', 'base': 'ubuntu:bionic',
'tag_suffix': ''},
# i386 is not supported any longer
# 'trusty32': {'arch': 'i386', 'base': 'i386/ubuntu:trusty',
# 'tag_suffix': '_32'},
'bionic64': {'base': 'ubuntu:bionic', 'tag_suffix': ''},
}


Expand All @@ -60,7 +56,6 @@ def run_cmd(cmd, shell=False):


def build(env):
arch = imgs[env]['arch']
base = imgs[env]['base']
tag_suffix = imgs[env]['tag_suffix']
bess_dpdk_branch = os.getenv('BESS_DPDK_BRANCH', 'master')
Expand All @@ -69,10 +64,9 @@ def build(env):
run_cmd('docker build '
'--build-arg BASE_IMAGE={base} '
'--build-arg BESS_DPDK_BRANCH={branch} '
'--build-arg DPDK_ARCH={arch} '
'-t {target}:latest{suffix} -t {target}:{version}{suffix} '
'.'.format(base=base, branch=bess_dpdk_branch, arch=arch,
target=TARGET_REPO, version=version, suffix=tag_suffix))
'.'.format(base=base, branch=bess_dpdk_branch, target=TARGET_REPO,
version=version, suffix=tag_suffix))

print('Build succeeded: {}:{}{}'.format(TARGET_REPO, version, tag_suffix))
print('Build succeeded: {}:latest{}'.format(TARGET_REPO, tag_suffix))
Expand Down