Commit fd2b7320 by Stéphane Graber

tests: Don't hardcode architecture

If on Ubuntu, then match the host's own architecture, this should allow for our tests to pass on the armhf CI environment. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 45794802
...@@ -32,12 +32,17 @@ cleanup() { ...@@ -32,12 +32,17 @@ cleanup() {
echo "PASS" echo "PASS"
} }
ARCH=i386
if type dpkg >/dev/null 2>&1; then
ARCH=$(dpkg --print-architecture)
fi
trap cleanup EXIT HUP INT TERM trap cleanup EXIT HUP INT TERM
set -eu set -eu
# Create a container # Create a container
CONTAINER_NAME=lxc-test-auto CONTAINER_NAME=lxc-test-auto
lxc-create -t download -n $CONTAINER_NAME -- -d ubuntu -r trusty -a i386 lxc-create -t download -n $CONTAINER_NAME -- -d ubuntu -r trusty -a $ARCH
CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs -H)) CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs -H))
cp $CONTAINER_PATH/config $CONTAINER_PATH/config.bak cp $CONTAINER_PATH/config $CONTAINER_PATH/config.bak
......
...@@ -62,6 +62,11 @@ run_cmd() { ...@@ -62,6 +62,11 @@ run_cmd() {
TUSER=lxcunpriv TUSER=lxcunpriv
HDIR=/home/$TUSER HDIR=/home/$TUSER
ARCH=i386
if type dpkg >/dev/null 2>&1; then
ARCH=$(dpkg --print-architecture)
fi
trap cleanup EXIT SIGHUP SIGINT SIGTERM trap cleanup EXIT SIGHUP SIGINT SIGTERM
set -eu set -eu
...@@ -94,7 +99,7 @@ for d in /sys/fs/cgroup/*; do ...@@ -94,7 +99,7 @@ for d in /sys/fs/cgroup/*; do
echo $$ > $d/lxctest/tasks echo $$ > $d/lxctest/tasks
done done
run_cmd lxc-create -t download -n c1 -- -d ubuntu -r trusty -a i386 run_cmd lxc-create -t download -n c1 -- -d ubuntu -r trusty -a $ARCH
run_cmd lxc-start -n c1 -d run_cmd lxc-start -n c1 -d
p1=$(run_cmd lxc-info -n c1 -p -H) p1=$(run_cmd lxc-info -n c1 -p -H)
......
...@@ -64,6 +64,11 @@ run_cmd() { ...@@ -64,6 +64,11 @@ run_cmd() {
fi fi
} }
ARCH=i386
if type dpkg >/dev/null 2>&1; then
ARCH=$(dpkg --print-architecture)
fi
set -eu set -eu
trap cleanup EXIT SIGHUP SIGINT SIGTERM trap cleanup EXIT SIGHUP SIGINT SIGTERM
...@@ -96,8 +101,13 @@ brctl addbr usernic-br1 ...@@ -96,8 +101,13 @@ brctl addbr usernic-br1
ifconfig usernic-br0 0.0.0.0 up ifconfig usernic-br0 0.0.0.0 up
ifconfig usernic-br1 0.0.0.0 up ifconfig usernic-br1 0.0.0.0 up
ARCH=i386
if type dpkg >/dev/null 2>&1; then
ARCH=$(dpkg --print-architecture)
fi
# Create three containers # Create three containers
run_cmd "lxc-create -t download -n b1 -- -d ubuntu -r trusty -a i386" run_cmd "lxc-create -t download -n b1 -- -d ubuntu -r trusty -a $ARCH"
run_cmd "lxc-start -n b1 -d" run_cmd "lxc-start -n b1 -d"
p1=$(run_cmd "lxc-info -n b1 -p -H") p1=$(run_cmd "lxc-info -n b1 -p -H")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment