diff mbox series

nfs-utils: tests: Skip test if /dev/log is missing

Message ID 20220122194932.118951-1-carnil@debian.org (mailing list archive)
State New, archived
Headers show
Series nfs-utils: tests: Skip test if /dev/log is missing | expand

Commit Message

Salvatore Bonaccorso Jan. 22, 2022, 7:49 p.m. UTC
From: Ben Hutchings <benh@debian.org>

Some build environments don't have a /dev/log, without which
the daemons will fail to run.

* Add a check_dev_log function to skip a test if it's missing
* Call it in t0001-statd-basic-mon-unmon.sh

Signed-off-by: Ben Hutchings <benh@debian.org>
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
---
 tests/t0001-statd-basic-mon-unmon.sh | 3 ++-
 tests/test-lib.sh                    | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Steve Dickson Jan. 31, 2022, 4:56 p.m. UTC | #1
On 1/22/22 14:49, Salvatore Bonaccorso wrote:
> From: Ben Hutchings <benh@debian.org>
> 
> Some build environments don't have a /dev/log, without which
> the daemons will fail to run.
> 
> * Add a check_dev_log function to skip a test if it's missing
> * Call it in t0001-statd-basic-mon-unmon.sh
> 
> Signed-off-by: Ben Hutchings <benh@debian.org>
> Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
Committed... (tag: nfs-utils-2-6-2-rc1)

steved.
> ---
>   tests/t0001-statd-basic-mon-unmon.sh | 3 ++-
>   tests/test-lib.sh                    | 9 +++++++++
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/t0001-statd-basic-mon-unmon.sh b/tests/t0001-statd-basic-mon-unmon.sh
> index 92517a144851..e1065e766ccc 100755
> --- a/tests/t0001-statd-basic-mon-unmon.sh
> +++ b/tests/t0001-statd-basic-mon-unmon.sh
> @@ -21,8 +21,9 @@
>   
>   . ./test-lib.sh
>   
> -# This test needs root privileges
> +# This test needs root privileges and /dev/log
>   check_root
> +check_dev_log
>   
>   start_statd
>   if [ $? -ne 0 ]; then
> diff --git a/tests/test-lib.sh b/tests/test-lib.sh
> index e47ad13539ac..b62ac2a6db4d 100644
> --- a/tests/test-lib.sh
> +++ b/tests/test-lib.sh
> @@ -37,6 +37,15 @@ check_root() {
>   	fi
>   }
>   
> +# Most tests require /dev/log. Skip the test if it doesn't exist in this
> +# environment.
> +check_dev_log() {
> +	if ! [ -e /dev/log ]; then
> +		echo "*** Skipping this tests as it requires /dev/log ***"
> +		exit 77
> +	fi
> +}
> +
>   # is lockd registered as a service?
>   lockd_registered() {
>   	rpcinfo -p | grep -q nlockmgr
diff mbox series

Patch

diff --git a/tests/t0001-statd-basic-mon-unmon.sh b/tests/t0001-statd-basic-mon-unmon.sh
index 92517a144851..e1065e766ccc 100755
--- a/tests/t0001-statd-basic-mon-unmon.sh
+++ b/tests/t0001-statd-basic-mon-unmon.sh
@@ -21,8 +21,9 @@ 
 
 . ./test-lib.sh
 
-# This test needs root privileges
+# This test needs root privileges and /dev/log
 check_root
+check_dev_log
 
 start_statd
 if [ $? -ne 0 ]; then
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index e47ad13539ac..b62ac2a6db4d 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -37,6 +37,15 @@  check_root() {
 	fi
 }
 
+# Most tests require /dev/log. Skip the test if it doesn't exist in this
+# environment.
+check_dev_log() {
+	if ! [ -e /dev/log ]; then
+		echo "*** Skipping this tests as it requires /dev/log ***"
+		exit 77
+	fi
+}
+
 # is lockd registered as a service?
 lockd_registered() {
 	rpcinfo -p | grep -q nlockmgr