runapitests.sh revision 14d9c0f09d1a55d124ef210a4b4e205c9fe7596c
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka#!/bin/sh
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkacleanup() {
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka rm -f /etc/lxc/test-busybox.conf
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka rm -f liblxc.so.0
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka}
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkaif [ `id -u` -ne 0 ]; then
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka echo "Run as root"
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka exit 1
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkafi
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkacat > /etc/lxc/test-busybox.conf << EOF
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkalxc.network.type=veth
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkalxc.network.link=lxcbr0
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkalxc.network.flags=up
6515faa115664909351ac241763bcb374ff62608Jakub JirutkaEOF
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka[ -f liblxc.so.0 ] || ln -s src/lxc/liblxc.so ./liblxc.so.0
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkaexport LD_LIBRARY_PATH=.
6515faa115664909351ac241763bcb374ff62608Jakub JirutkaTESTS="lxc-test-containertests lxc-test-locktests lxc-test-startone"
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkafor curtest in $TESTS; do
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka echo "running $curtest"
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka ./src/tests/$curtest
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka if [ $? -ne 0 ]; then
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka echo "Test $curtest failed. Stopping"
2a9a0a08077d88ee1d70ca46ca122216f3d1c89aNatanael Copa cleanup
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka exit 1
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka fi
8ec981fc8b0105da5f071e40811e0c2472a6c3c9Stéphane Graberdone
207bf0e475f1dc6e9a2dac2cee3a209b56427855Stéphane Graberecho "All tests passed"
6515faa115664909351ac241763bcb374ff62608Jakub Jirutkacleanup
6515faa115664909351ac241763bcb374ff62608Jakub Jirutka