beta-0.89.2
[luatex.git] / source / texk / kpathsea / tests / kpseaccess.test
blob5006bcf1afa2cc8305e3e7e51cb391cc47a66a4a
1 #! /bin/sh
3 # Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org>
4 # You may freely use, modify and/or distribute this file.
6 ret=0
8 pass () {
9 echo "***** unexpected success of './kpseaccess $@'"
10 ret=77
13 fail () {
14 echo "***** unexpected failure of './kpseaccess $@'"
15 ret=77
18 ./kpseaccess '' nonesuch && exit 1
19 ./kpseaccess - nonesuch && exit 1
20 ./kpseaccess r nonesuch && exit 1
21 ./kpseaccess w nonesuch && exit 1
22 ./kpseaccess x nonesuch && exit 1
24 ./kpseaccess '' access.o || exit 1
25 ./kpseaccess - access.o || exit 1
26 ./kpseaccess rw access.o || exit 1
27 # From the access(3p) POSIX manpage:
28 # If the process has appropriate privileges, an implementation may indicate
29 # success for X_OK even if none of the execute file permission bits are set.
30 ./kpseaccess x access.o && pass x access.o
32 # Testing write access to kpseaccess itself might fail with ETXTBSY.
33 ./kpseaccess rwx kpsewhich || {
34 fail rwx kpsewhich
35 ./kpseaccess r kpsewhich || fail r kpsewhich
36 ./kpseaccess w kpsewhich || fail w kpsewhich
37 ./kpseaccess x kpsewhich || fail x kpsewhich
40 ./kpseaccess r $srcdir/access.c || exit 1
41 ./kpseaccess x $srcdir/access.c && pass x $srcdir/access.c
43 if ./kpseaccess w $srcdir/access.c; then
44 echo 'file "$srcdir/access.c" is writable'
45 else
46 echo 'file "$srcdir/access.c" is not writable'
49 exit $ret