Skip to content

Commit

Permalink
tests/main.sh: support running without having built lxcfs
Browse files Browse the repository at this point in the history
This is the case in adt.

Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
hallyn committed Dec 3, 2015
1 parent b4bf96e commit bb682ba
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tests/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit bb682ba

Please sign in to comment.