Re: [PATCH 1/2] btrfs-progs: tests, add support for running commands under root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




-------- Original Message --------
Subject: [PATCH 1/2] btrfs-progs: tests, add support for running commands under root
From: David Sterba <dsterba@xxxxxxx>
To: <linux-btrfs@xxxxxxxxxxxxxxx>
Date: 2015年01月15日 01:25
Most of the checks run fine without root, but some of them may need to
do a mount test or access the data. Add the support to selectively run
commands under root, hardcoded to sudo for now.
I'm a little worried about using sudo in such test.
If the test is ran by a script, test will be stuck waiting for input and timeout after a long time.

I prefer NOT RUN just like xfstests.

Thanks
Qu

Signed-off-by: David Sterba <dsterba@xxxxxxx>
---

  tests/common | 15 +++++++++++++++
  1 file changed, 15 insertions(+)

diff --git a/tests/common b/tests/common
index 80a538165949..84a4b9d335e2 100644
--- a/tests/common
+++ b/tests/common
@@ -47,3 +47,18 @@ check_all_images()
  		rm $i.restored
  	done
  }
+
+# some tests need to mount the recovered image and do verifications call
+# 'setup_root_helper' and then check for have_root_helper == 1 if the test
+# needs to fail otherwise; using sudo by default for now
+sudo=
+have_root_helper=0
+export sudo
+export have_root_helper
+setup_root_helper()
+{
+	if [ $UID != 0 ]; then
+		sudo=sudo
+	fi
+	have_root_helper=1
+}

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux