lxc-test-cloneconfig revision 67702c2129c462b5e8124020a496fbf6b7ae5540
# lxc: linux Container library
# Authors:
# Serge Hallyn <serge.hallyn@ubuntu.com>
#
# This is a test script for the lxc-user-nic program
# 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
set -e
s=`mktemp -d /tmp/lxctest-XXXXXX`
DONE=0
key=$1
desc=$2
echo "Test $testnum failed"
echo "unequal number of $desc"
false
fi
}
}
verify_unchanged_number lxc.network.type "network defs"
}
verify_unchanged_number lxc.network.hwaddr "hwaddr defs"
grep ^lxc.network.hwaddr $CONTAINER_PATH/config | while read line; do
echo "looking for $addr in $CONTAINER2_PATH/config"
if grep -q $addr $CONTAINER2_PATH/config; then
echo "Test $testnum failed"
echo "hwaddr $addr was not changed"
false
fi
done
}
verify_unchanged_number lxc.hook "hooks"
grep ^lxc.hook $CONTAINER_PATH/config | while read line; do
echo "Test $testnum failed"
echo "Failed to find $nline in:"
fi
done
}
# Simple nic
lxc.network.type = veth
lxc.network.link = lxcbr0
EOF
# Simple nic with hwaddr; verify hwaddr changed
lxc.network.type = veth
lxc.network.link = lxcbr0
EOF
# No nics, but nic from include
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.hook.start = /bin/bash
EOF
lxc.include = $s/1.include
EOF
# No nics, one clone hook in /bin
lxc.hook.start = /bin/bash
EOF
# Figure out container dirname
# We need this in 5.conf
# No nics, one clone hook in $container
lxc.hook.start = $CONTAINER_PATH/x1
EOF
CONTAINER2_PATH="${CONTAINER_PATH}2"
testnum=1
echo "Test $testnum starting ($f)"
# verify that # nics did not change
# verify hwaddr, if any changed
# verify hooks are correct
done
DONE=1