From 0fe038ef06981245ac6d4f0a71b8d8916b2dd202 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Tue, 5 Nov 2024 22:17:41 +0900 Subject: [PATCH] Skip tests of test if the shell does not implement it If the testee does not implement the test utility as a built-in, the test cases in tests/test-p.tst tests the behavior of the external utility found in $PATH, which may (or may not) affect the results. We should skip the tests if we are not sure if the shell supports the built-in. --- tests/test-p.tst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test-p.tst b/tests/test-p.tst index b77035d0..9e26d9e0 100644 --- a/tests/test-p.tst +++ b/tests/test-p.tst @@ -2,6 +2,19 @@ posix="true" +# This file is for testing the shell built-in, so we should skip the tests +# if the shell does not seem to implement the test built-in. +case $("$TESTEE" -c 'command -V test') in + (*built-in*|*builtin*) + # Okay, the testee seems to support the test command as a built-in. + # This check is not POSIXly portable because the output of "command -V" + # is unspecified in POSIX, but it works for yash and most other shells. + ;; + (*) + skip=true + ;; +esac + umask u=rwx,go= >file