summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/tests
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-06 23:52:15 +0000
committerKarl Berry <karl@freefriends.org>2013-08-06 23:52:15 +0000
commit6f855519650fde622bd6326b68315d8cf2650380 (patch)
treeef13638aa742c62c26c2964c2b3ff8b166b188a9 /Build/source/texk/kpathsea/tests
parenta2703f81b605770555f3b6ff889723fb17d15c25 (diff)
do not ignore text on a non-terminated final line, plus new test; move all kpse tests to subdir
git-svn-id: svn://tug.org/texlive/trunk@31370 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/tests')
-rwxr-xr-xBuild/source/texk/kpathsea/tests/cnfnewline.test16
-rw-r--r--Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf1
-rwxr-xr-xBuild/source/texk/kpathsea/tests/kpseaccess.test50
-rwxr-xr-xBuild/source/texk/kpathsea/tests/kpsereadlink.test13
-rwxr-xr-xBuild/source/texk/kpathsea/tests/kpsestat.test19
-rwxr-xr-xBuild/source/texk/kpathsea/tests/kpsewhich.test21
6 files changed, 120 insertions, 0 deletions
diff --git a/Build/source/texk/kpathsea/tests/cnfnewline.test b/Build/source/texk/kpathsea/tests/cnfnewline.test
new file mode 100755
index 00000000000..d1e64d7d6ad
--- /dev/null
+++ b/Build/source/texk/kpathsea/tests/cnfnewline.test
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Copyright 2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir/tests/cnfnewline; export TEXMFCNF
+
+val=`./kpsewhich --debug=-1 --var-value=lastvar`
+test x"$val" = xlastval || exit 1
+
+# verbose for testing.
+#if test x"$val" = xlastval; then
+# echo "$0: ok"
+#else
+# echo "$0: bad, got \`$val'"
+# exit 1
+#fi
diff --git a/Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf b/Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf
new file mode 100644
index 00000000000..a3a189023f4
--- /dev/null
+++ b/Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf
@@ -0,0 +1 @@
+lastvar = lastval # with comment, but no final newline \ No newline at end of file
diff --git a/Build/source/texk/kpathsea/tests/kpseaccess.test b/Build/source/texk/kpathsea/tests/kpseaccess.test
new file mode 100755
index 00000000000..5006bcf1afa
--- /dev/null
+++ b/Build/source/texk/kpathsea/tests/kpseaccess.test
@@ -0,0 +1,50 @@
+#! /bin/sh
+
+# Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+ret=0
+
+pass () {
+ echo "***** unexpected success of './kpseaccess $@'"
+ ret=77
+}
+
+fail () {
+ echo "***** unexpected failure of './kpseaccess $@'"
+ ret=77
+}
+
+./kpseaccess '' nonesuch && exit 1
+./kpseaccess - nonesuch && exit 1
+./kpseaccess r nonesuch && exit 1
+./kpseaccess w nonesuch && exit 1
+./kpseaccess x nonesuch && exit 1
+
+./kpseaccess '' access.o || exit 1
+./kpseaccess - access.o || exit 1
+./kpseaccess rw access.o || exit 1
+# From the access(3p) POSIX manpage:
+# If the process has appropriate privileges, an implementation may indicate
+# success for X_OK even if none of the execute file permission bits are set.
+./kpseaccess x access.o && pass x access.o
+
+# Testing write access to kpseaccess itself might fail with ETXTBSY.
+./kpseaccess rwx kpsewhich || {
+ fail rwx kpsewhich
+ ./kpseaccess r kpsewhich || fail r kpsewhich
+ ./kpseaccess w kpsewhich || fail w kpsewhich
+ ./kpseaccess x kpsewhich || fail x kpsewhich
+}
+
+./kpseaccess r $srcdir/access.c || exit 1
+./kpseaccess x $srcdir/access.c && pass x $srcdir/access.c
+
+if ./kpseaccess w $srcdir/access.c; then
+ echo 'file "$srcdir/access.c" is writable'
+else
+ echo 'file "$srcdir/access.c" is not writable'
+fi
+
+exit $ret
+
diff --git a/Build/source/texk/kpathsea/tests/kpsereadlink.test b/Build/source/texk/kpathsea/tests/kpsereadlink.test
new file mode 100755
index 00000000000..7770a00bd03
--- /dev/null
+++ b/Build/source/texk/kpathsea/tests/kpsereadlink.test
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+# Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test "x$LN_S" = 'xln -s' || exit 77
+
+./kpsereadlink $LT_OBJDIR/libkpathsea.lai && exit 1
+
+link=`./kpsereadlink $LT_OBJDIR/libkpathsea.la` || exit 1
+
+test "x$link" = x../libkpathsea.la || exit 1
+
diff --git a/Build/source/texk/kpathsea/tests/kpsestat.test b/Build/source/texk/kpathsea/tests/kpsestat.test
new file mode 100755
index 00000000000..8e1cf8526a4
--- /dev/null
+++ b/Build/source/texk/kpathsea/tests/kpsestat.test
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+# Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+./kpsestat = nonesuch 2>/dev/null && exit 1
+
+for f in . kpsestat kpsestat.o; do
+ echo "kpsestat = $f => `./kpsestat = $f`"
+done
+
+for m in -rw g-r u-w o+x -rw,u+s -rw,g+s -rw,o+t; do
+ echo "kpsestat $m kpsestat.o => `./kpsestat $m kpsestat.o`"
+done
+
+echo "kpsestat = \$srcdir => `./kpsestat = $srcdir`"
+echo "kpsestat = \$srcdir/ => `./kpsestat = $srcdir/`"
+echo "kpsestat = \$srcdir/kpsestat.c => `./kpsestat = $srcdir/kpsestat.c`"
+
diff --git a/Build/source/texk/kpathsea/tests/kpsewhich.test b/Build/source/texk/kpathsea/tests/kpsewhich.test
new file mode 100755
index 00000000000..b15f2b35400
--- /dev/null
+++ b/Build/source/texk/kpathsea/tests/kpsewhich.test
@@ -0,0 +1,21 @@
+#! /bin/sh
+# Copyright 2010-2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir
+export TEXMFCNF
+
+./kpsewhich --var-value=TEXMFCNF || exit 1 # environment variable
+
+./kpsewhich --var-value=TEXMFMAIN || exit 1
+
+./kpsewhich --expand-var=\$TEXMFMAIN || exit 1
+
+TEXINPUTS=$srcdir/../tests/texmf \
+ ./kpsewhich --all plain || exit 1
+
+AFMFONTS=$srcdir/../tests/texmf \
+ ./kpsewhich afmtest.afm || exit 1
+
+BSTINPUTS=$srcdir/../tests/texmf \
+ ./kpsewhich plain.bst || exit 1