]>
git.proxmox.com Git - mirror_lxc.git/blob - src/tests/lxc-test-ubuntu
3 # lxc-test-ubuntu: some tests of ubuntu-specific features of lxc.
4 # Some features of lxc - networking and LSM configuration for instance -
5 # are generally configured by the distro packages. This program
6 # tests the Ubuntu configuration.
8 # These require the ubuntu lxc package to be installed.
10 # General lxc functionality testing does not belong here.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU Lesser General Public
14 # License as published by the Free Software Foundation; either
15 # version 2.1 of the License, or (at your option) any later version.
17 # This library is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # Lesser General Public License for more details.
22 # You should have received a copy of the GNU Lesser General Public
23 # License along with this library; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
34 # Only run on a normally configured ubuntu lxc system
35 if [ ! -d /sys
/class
/net
/lxcbr0
]; then
36 echo "lxcbr0 is not configured."
39 if [ "$(id -u)" != "0" ]; then
40 echo "ERROR: Must run as root."
44 for template
in ubuntu ubuntu-cloud
; do
45 # need a different name for each container so dnsmasq doesn't
46 # mess us up with its caching
47 if which uuidgen
2>&1 > /dev
/null
; then
50 name
=lxc-test-
$template
53 lxc-create
-t $template -n $name || FAIL
"creating $template container"
54 lxc-start
-n $name -d || FAIL
"starting $template container"
55 lxc-wait
-n $name -s RUNNING || FAIL
"waiting for $template container to run"
57 for tries
in `seq 1 20`; do
58 lxcip
=$
(lxc-info
-i -n $name -H |
head -n 1)
59 [ -z "$lxcip" ] ||
break
62 [ -n "$lxcip" ] || FAIL
"to start networking in $template container"
64 ping -c 1 $lxcip || FAIL
"to ping $template container"
66 lxcpid
=`lxc-info -n $name -p -H`
67 aa
=`cat /proc/$lxcpid/attr/current`
68 if [ "$aa" != "lxc-container-default-with-nesting (enforce)" -a \
69 "$aa" != "lxc-container-default-cgns (enforce)" -a \
70 "$aa" != "lxc-container-default (enforce)" ]; then
71 FAIL
" to correctly set apparmor profile (profile is \"$aa\")"