Skip to contentSkip to conversation

selinux-testsuite: Allow nfs test script to close cleanly

PATCH Superseded Richard Haines 1 participant 1 message Feb 20, 2020 SELinux security module

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux-testsuite: Allow nfs test script to close cleanly

Whenever 'make test' fails, close cleanly.

---
 tools/nfs.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tools/nfs.sh +12 -0
index 314f898..f99c76b 100755
@@ -1,4 +1,16 @@
 #!/bin/sh -e
+
+# If 'make test' fails, close down cleanly
+function err_exit() {
+	popd
+	umount /mnt/selinux-testsuite
+	exportfs -u localhost:$MOUNT
+	rmdir /mnt/selinux-testsuite
+	systemctl stop nfs-server
+}
+
+trap 'err_exit' EXIT
+
 MOUNT=`stat --print %m .`
 TESTDIR=`pwd`
 systemctl start nfs-server
Signature · 1 line
2.24.1