Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / busybox / testsuite / readlink.tests
blobc7fc8adf008d390c0e52071ae0506d574e630a8d
1 #!/bin/sh
3 # Readlink tests.
4 # Copyright 2006 by Natanael Copa <n@tanael.org>
5 # Licensed under GPLv2, see file LICENSE in this source tree.
7 . ./testing.sh
9 TESTDIR=readlink_testdir
10 TESTFILE="$TESTDIR/testfile"
11 TESTLINK="testlink"
12 FAILLINK="$TESTDIR/$TESTDIR/testlink"
14 # create the dir and test files
15 mkdir -p "./$TESTDIR"
16 touch "./$TESTFILE"
17 ln -s "./$TESTFILE" "./$TESTLINK"
19 testing "readlink on a file" "readlink ./$TESTFILE" "" "" ""
20 testing "readlink on a link" "readlink ./$TESTLINK" "./$TESTFILE\n" "" ""
22 optional FEATURE_READLINK_FOLLOW
24 testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" ""
25 testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" ""
26 testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" ""
27 testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" ""
30 # clean up
31 rm -r "$TESTLINK" "$TESTDIR"
33 exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))