2006-05-06 02:37:41 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Readlink tests.
|
|
|
|
# Copyright 2006 by Natanael Copa <n@tanael.org>
|
2010-08-16 23:44:46 +05:30
|
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
2006-05-06 02:37:41 +05:30
|
|
|
|
2009-11-05 05:11:22 +05:30
|
|
|
. ./testing.sh
|
2006-05-06 02:37:41 +05:30
|
|
|
|
|
|
|
TESTDIR=readlink_testdir
|
|
|
|
TESTFILE="$TESTDIR/testfile"
|
|
|
|
TESTLINK="testlink"
|
|
|
|
FAILLINK="$TESTDIR/$TESTDIR/testlink"
|
|
|
|
|
|
|
|
# create the dir and test files
|
|
|
|
mkdir -p "./$TESTDIR"
|
|
|
|
touch "./$TESTFILE"
|
|
|
|
ln -s "./$TESTFILE" "./$TESTLINK"
|
|
|
|
|
|
|
|
testing "readlink on a file" "readlink ./$TESTFILE" "" "" ""
|
|
|
|
testing "readlink on a link" "readlink ./$TESTLINK" "./$TESTFILE\n" "" ""
|
2006-05-06 03:52:30 +05:30
|
|
|
|
|
|
|
optional FEATURE_READLINK_FOLLOW
|
|
|
|
|
2006-05-06 02:37:41 +05:30
|
|
|
testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" ""
|
|
|
|
testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" ""
|
|
|
|
testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" ""
|
|
|
|
testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" ""
|
|
|
|
|
|
|
|
|
|
|
|
# clean up
|
2006-09-17 21:58:10 +05:30
|
|
|
rm -r "$TESTLINK" "$TESTDIR"
|
2010-08-29 08:17:03 +05:30
|
|
|
|
|
|
|
exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
|