selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selinux-testsuite: Allow nfs test script to close cleanly
@ 2020-02-20 15:43 Richard Haines
  0 siblings, 0 replies; only message in thread
From: Richard Haines @ 2020-02-20 15:43 UTC (permalink / raw)
  To: selinux; +Cc: Richard Haines

Whenever 'make test' fails, close cleanly.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
---
 tools/nfs.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/nfs.sh b/tools/nfs.sh
index 314f898..f99c76b 100755
--- a/tools/nfs.sh
+++ b/tools/nfs.sh
@@ -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
-- 
2.24.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-20 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 15:43 [PATCH] selinux-testsuite: Allow nfs test script to close cleanly Richard Haines

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).