-#!/bin/sh
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# lustre/tests/llmountcleanup.sh
+#
+# Destroy the lustre filesystem and client created by
+# llmount.sh
+#
+
+usage() {
+ less -F <<EOF
+Usage: ${0##*/}
+Destroy the lustre filesystem and client created by llmount.sh
+ -h, --help This help
-SRCDIR="`dirname $0`"
-. $SRCDIR/common.sh
-
-$DEBCTL get_debug > /tmp/debug
-
-if [ "`mount | grep '/mnt/lustre'`" ]; then
- umount /mnt/lustre || fail "cannot unmount"
-fi
-
-killall acceptor
-rmmod llite
-rmmod mdc
-
-$OBDCTL <<EOF
-name2dev OSCDEV
-cleanup
-detach
-name2dev LDLMDEV
-cleanup
-detach
-name2dev RPCDEV
-cleanup
-detach
-name2dev OSTDEV
-cleanup
-detach
-name2dev OBDDEV
-cleanup
-detach
-name2dev MDSDEV
-cleanup
-detach
-quit
EOF
-
-rmmod obdecho
-rmmod mds
-rmmod osc
-rmmod ost
-rmmod obdfilter
-rmmod obdext2
-rmmod ldlm
-rmmod ptlrpc
-rmmod obdclass
-
-$PTLCTL <<EOF
-setup tcp
-disconnect
-del_uuid self
-del_uuid mds
-del_uuid ost
-del_uuid ldlm
-quit
-EOF
-
-rmmod kqswnal
-rmmod ksocknal
-rmmod portals
-
-losetup -d ${LOOP}0
-losetup -d ${LOOP}1
-losetup -d ${LOOP}2
+ exit
+}
+
+# Replace long option with corresponding short option
+for arg in "$@"; do
+ shift
+ case "$arg" in
+ --help) set -- "$@" '-h';;
+ *) set -- "$@" "$arg";;
+ esac
+done
+
+while getopts "h" opt
+do
+ case "$opt" in
+ h|\?) usage;;
+ esac
+done
+
+LUSTRE=${LUSTRE:-$(dirname "$0")/..}
+. "$LUSTRE/tests/test-framework.sh"
+init_test_env "$@"
+
+cleanupall -f