]> git.proxmox.com Git - mirror_lxc.git/blob - runapitests.sh
Always try to create lxcpath
[mirror_lxc.git] / runapitests.sh
1 #!/bin/sh
2 # liblxcapi
3 #
4 # Copyright © 2012 Serge Hallyn <serge.hallyn@ubuntu.com>.
5 # Copyright © 2012 Canonical Ltd.
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21 cleanup() {
22 rm -f /etc/lxc/test-busybox.conf
23 rm -f liblxc.so.0
24 }
25
26 if [ `id -u` -ne 0 ]; then
27 echo "Run as root"
28 exit 1
29 fi
30
31 cat > /etc/lxc/test-busybox.conf << EOF
32 lxc.network.type=veth
33 lxc.network.link=lxcbr0
34 lxc.network.flags=up
35 EOF
36
37 [ -f liblxc.so.0 ] || ln -s src/lxc/liblxc.so ./liblxc.so.0
38 export LD_LIBRARY_PATH=.
39 TESTS="lxc-test-containertests lxc-test-locktests lxc-test-startone"
40 for curtest in $TESTS; do
41 echo "running $curtest"
42 ./src/tests/$curtest
43 if [ $? -ne 0 ]; then
44 echo "Test $curtest failed. Stopping"
45 cleanup
46 exit 1
47 fi
48 done
49 echo "All tests passed"
50 cleanup