diff mbox series

generic/594: require setquota tool supports project quota

Message ID 20200419104936.30095-1-zlang@redhat.com (mailing list archive)
State New, archived
Headers show
Series generic/594: require setquota tool supports project quota | expand

Commit Message

Zorro Lang April 19, 2020, 10:49 a.m. UTC
The old setquota tool doesn't support project quota, it doesn't has
"-P, --project" option. So _notrun the test to avoid a failure.

Signed-off-by: Zorro Lang <zlang@redhat.com>
---
 common/quota      | 9 +++++++++
 tests/generic/594 | 1 +
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/common/quota b/common/quota
index 4e07fef1..240e0bbc 100644
--- a/common/quota
+++ b/common/quota
@@ -124,6 +124,15 @@  _scratch_enable_pquota()
 	esac
 }
 
+_require_setquota_project()
+{
+	setquota --help 2>&1 | \
+		grep -q "\-P, \-\-project[[:space:]]*set limits for project"
+	if [ "$?" -ne 0 ];then
+		_notrun "setquota doesn't support project quota (-P)"
+	fi
+}
+
 #
 # checks for user nobody in /etc/passwd and /etc/group.
 #
diff --git a/tests/generic/594 b/tests/generic/594
index e501d54c..2665e5b4 100755
--- a/tests/generic/594
+++ b/tests/generic/594
@@ -34,6 +34,7 @@  rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_setquota_project
 # V4 XFS doesn't support to mount project and group quota together
 if [ "$FSTYP" = "xfs" ];then
 	_require_scratch_xfs_crc