diff --git a/.travis.yml b/.travis.yml index f04be04ddbd..bf5298909eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,13 @@ go: - tip matrix: + include: + - go: 1.11.x + env: + - RUNC_USE_SYSTEMD=1 + script: + - make BUILDTAGS="${BUILDTAGS}" all + - sudo PATH="$PATH" make localintegration RUNC_USE_SYSTEMD=1 allow_failures: - go: tip diff --git a/libcontainer/specconv/spec_linux.go b/libcontainer/specconv/spec_linux.go index a1579892363..f68cac011a6 100644 --- a/libcontainer/specconv/spec_linux.go +++ b/libcontainer/specconv/spec_linux.go @@ -325,7 +325,7 @@ func createCgroupConfig(opts *CreateOpts) (*configs.Cgroup, error) { // for e.g. "system.slice:docker:1234" parts := strings.Split(myCgroupPath, ":") if len(parts) != 3 { - return nil, fmt.Errorf("expected cgroupsPath to be of format \"slice:prefix:name\" for systemd cgroups") + return nil, fmt.Errorf("expected cgroupsPath to be of format \"slice:prefix:name\" for systemd cgroups, got %q instead", myCgroupPath) } c.Parent = parts[0] c.ScopePrefix = parts[1] diff --git a/tests/integration/checkpoint.bats b/tests/integration/checkpoint.bats index 92fe559e042..87696df6ee9 100644 --- a/tests/integration/checkpoint.bats +++ b/tests/integration/checkpoint.bats @@ -3,6 +3,10 @@ load helpers function setup() { + if [[ -n "${RUNC_USE_SYSTEMD}" ]] ; then + skip "CRIU test suite is skipped on systemd cgroup driver for now." + fi + teardown_busybox setup_busybox } diff --git a/tests/integration/exec.bats b/tests/integration/exec.bats index c598718dee8..0ff2e6364b5 100644 --- a/tests/integration/exec.bats +++ b/tests/integration/exec.bats @@ -133,7 +133,7 @@ function teardown() { runc run -d --console-socket $CONSOLE_SOCKET test_busybox [ "$status" -eq 0 ] - run bash -c "cat hello > preserve-fds.test; exec 3 preserve-fds.test; exec 3/ { print $5; exit }') CGROUP_CPU_BASE_PATH=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\/ { print $5; exit }') -CGROUPS_PATH="/runc-cgroups-integration-test/test-cgroup" +if [[ -n "${RUNC_USE_SYSTEMD}" ]] ; then + CGROUPS_PATH="/machine.slice/runc-cgroups-integration-test.scope" +else + CGROUPS_PATH="/runc-cgroups-integration-test/test-cgroup" +fi CGROUP_MEMORY="${CGROUP_MEMORY_BASE_PATH}${CGROUPS_PATH}" # CONFIG_MEMCG_KMEM support @@ -61,7 +65,7 @@ function runc() { # Raw wrapper for runc. function __runc() { - "$RUNC" --log /proc/self/fd/2 --root "$ROOT" "$@" + "$RUNC" ${RUNC_USE_SYSTEMD+--systemd-cgroup} --log /proc/self/fd/2 --root "$ROOT" "$@" } # Wrapper for runc spec, which takes only one argument (the bundle path). @@ -118,7 +122,11 @@ function runc_rootless_cgroup() { # Helper function to set cgroupsPath to the value of $CGROUPS_PATH function set_cgroups_path() { bundle="${1:-.}" - sed -i 's/\("linux": {\)/\1\n "cgroupsPath": "\/runc-cgroups-integration-test\/test-cgroup",/' "$bundle/config.json" + cgroups_path="/runc-cgroups-integration-test/test-cgroup" + if [[ -n "${RUNC_USE_SYSTEMD}" ]] ; then + cgroups_path="machine.slice:runc-cgroups:integration-test" + fi + sed -i 's#\("linux": {\)#\1\n "cgroupsPath": "'"${cgroups_path}"'",#' "$bundle/config.json" } # Helper function to set a resources limit