diff options
author | Eric Blake <eblake@redhat.com> | 2012-02-25 07:14:29 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-02-25 07:14:29 -0700 |
commit | ff3011217dc8bf66fc8f355f18436d1b3ab6a575 (patch) | |
tree | 99bae1d631b2b360f8ccbb2b16c1a3edc916002a | |
parent | 9e4e0a37d7b7200f671c2eadb3478a77d2dd7c9c (diff) | |
download | autoconf-ff3011217dc8bf66fc8f355f18436d1b3ab6a575.tar.gz |
tests: add test for AS_EXECUTABLE_P
Now that this is public, we should regression test it.
* tests/m4sh.at (AS@&t@_EXECUTABLE): New test.
Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r-- | tests/m4sh.at | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/m4sh.at b/tests/m4sh.at index e9da4038..38667e49 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -552,6 +552,58 @@ AT_CLEANUP +## ----------------- ## +## AS_EXECUTABLE_P. ## +## ----------------- ## + +# Check for executable regular files. +AT_SETUP([AS@&t@_EXECUTABLE_P]) +AT_KEYWORDS([m4sh]) + +AT_DATA_M4SH([script.as], +[[AS_INIT + +if AS_EXECUTABLE_P([/]); then + echo fail +else + echo 1 +fi +cat > foo.sh <<\EOF || AS_EXIT([1]) +#/bin/sh +exit 0 +EOF +# File systems like FAT tend to fake executable permissions on all files. +# At this point, foo.sh should be executable iff permissions are faked. +AS_EXECUTABLE_P([foo.sh]) +st1=$? +(./foo.sh) >/dev/null 2>&1 +st2=$? +case $st1:$st2 in + 1:126 | 0:0 ) echo 2 ;; + *) echo "fail ($st1:$st2)" ;; +esac +# Now things better be executable +chmod a+x foo.sh || AS_EXIT([2]) +mkdir 'two spaces' || AS_EXIT([3]) +'two spaces'/../foo.sh || AS_EXIT([4]) +if AS_EXECUTABLE_P(["two spaces/../foo.sh"]); then + echo 3 +else + echo fail +fi +]]) + +AT_CHECK_M4SH +AT_CHECK([$CONFIG_SHELL ./script], [], +[[1 +2 +3 +]]) + +AT_CLEANUP + + + ## --------- ## ## AS_EXIT. ## ## --------- ## |