From bb682ba86cded9adf814cf3c9742a9f7a3dfad11 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Wed, 2 Dec 2015 21:02:01 -0600 Subject: [PATCH] tests/main.sh: support running without having built lxcfs This is the case in adt. Signed-off-by: Serge Hallyn --- tests/main.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/main.sh b/tests/main.sh index 7b7b516a..71388d67 100755 --- a/tests/main.sh +++ b/tests/main.sh @@ -18,8 +18,10 @@ cleanup() { if [ $p -ne -1 ]; then kill -9 $p fi - umount -l ${LXCFSDIR} - rmdir ${LXCFSDIR} + if [ ${LXCFSDIR} != "/var/lib/lxcfs" ]; then + umount -l ${LXCFSDIR} + rmdir ${LXCFSDIR} + fi if [ ${FAILED} -eq 1 ]; then echo "FAILED at $TESTCASE" exit 1 @@ -31,9 +33,16 @@ cleanup() { TESTCASE="setup" lxcfs=${topdir}/lxcfs -echo "Running ${lxcfs} ${LXCFSDIR}" -${lxcfs} ${LXCFSDIR} & -p=$! +if [ -x ${lxcfs} ]; then + echo "Running ${lxcfs} ${LXCFSDIR}" + ${lxcfs} ${LXCFSDIR} & + p=$! +else + pidof lxcfs + echo "Using host lxcfs" + rmdir $LXCFSDIR + export LXCFSDIR=/var/lib/lxcfs +fi trap cleanup EXIT SIGHUP SIGINT SIGTERM