lxc-test-unpriv revision 8bb165038d60d59084c1fafee171948244f0f86a
# lxc: linux Container library
# Authors:
# Serge Hallyn <serge.hallyn@ubuntu.com>
#
# This is a test script for unprivileged containers
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# This test assumes an Ubuntu host
echo "ERROR: Must run as root."
exit 1
fi
# Test if we're using an overlayfs module that handles symlinks correctly. If
# not, we skip these tests since overlay clones will not work correctly.
MOUNTDIR="${TMPDIR}/ovl_symlink_test"
mkdir "${MOUNTDIR}/lowerdir" "${MOUNTDIR}/upperdir" "${MOUNTDIR}/overlayfs"
mount -t overlayfs -o lowerdir="${MOUNTDIR}/lowerdir",upperdir="${MOUNTDIR}/upperdir" none "${MOUNTDIR}/overlayfs"
CORRECT_LINK_TARGET="${MOUNTDIR}/overlayfs/dummy_file"
exec 9> "${CORRECT_LINK_TARGET}"
DETECTED_LINK_TARGET=$(readlink -q /proc/$$/fd/9)
# cleanup
exec 9>&-
umount "${MOUNTDIR}/overlayfs"
# This overlay module does not correctly handle symlinks, so skip the
# tests.
if [ "${DETECTED_LINK_TARGET}" != "${CORRECT_LINK_TARGET}" ]; then
exit 0
fi
fi
DONE=0
KNOWN_RELEASES="precise trusty xenial yakkety zesty"
cd /
echo "FAIL"
exit 1
fi
echo "PASS"
}
env http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
}
# create a test user
ARCH=$(dpkg --print-architecture)
fi
set -eu
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.id_map = u 0 910000 9999
lxc.id_map = g 0 910000 9999
EOF
cd $HDIR
done
else
done
fi
# default release is trusty, or the systems release if recognized
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
done
fi
# Copy the download template cache if available
# Make sure we can start it - twice
done
echo "Testing containers under different cgroups per subsystem"
echo "Testing lxc-attach and lxc-cgroup from different cgroup"
fi
DONE=1