[go: up one dir, main page]

File: readlink.t

package info (click to toggle)
fakechroot 2.19-3.3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,148 kB
  • sloc: ansic: 6,893; sh: 5,995; makefile: 349; perl: 169; java: 5
file content (57 lines) | stat: -rwxr-xr-x 1,307 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

srcdir=${srcdir:-.}
. $srcdir/common.inc.sh

readlink=`command -v readlink 2>/dev/null`
readlink=${readlink:-/bin/readlink}

imax=$(( 180 - $(pwd | wc -c) ))

prepare $(( 2 + 4 * $imax ))

for chroot in chroot fakechroot; do

    if [ $chroot = "chroot" ] && ! is_root; then
        skip $(( $tap_plan / 2 )) "not root"
    else

        destfile="$(pwd)/$testtreex"
        rm -f $testtree/x
        ln -s "$destfile" $testtree/x

        t=`$srcdir/$chroot.sh $testtree $readlink x 2>&1`
        test "$t" = "$destfile" || not
        ok "$chroot readlink [\$PWD/$testtreex]" $t

        symlink=$chroot-
        destfile=$chroot-

        for i in `$SEQ 1 $imax`; do

            symlink="${symlink}a"
            destfile="${destfile}b"

            if ! touch "$testtree/$destfile" 2>/dev/null; then
                skip 2 "File name too long"
            else

                rm -f "$testtree/$symlink"

                t=`$srcdir/$chroot.sh $testtree /bin/ln -s $destfile $symlink 2>&1`
                test "$t" = "" || not
                ok "$chroot ln -s [$i]" $t

                t=`$srcdir/$chroot.sh $testtree $readlink $symlink 2>&1`
                test "$t" = "$destfile" || not
                ok "$chroot readlink [$i]" $t

            fi

        done

    fi

done

cleanup