[go: up one dir, main page]

File: touch.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 (52 lines) | stat: -rwxr-xr-x 1,596 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
#!/bin/sh

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

prepare 16

. $srcdir/touch.inc.sh

if [ -z "$touch" ]; then
    skip 16 "touch not found"
else

    for chroot in chroot fakechroot; do

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

            t=`$srcdir/$chroot.sh $testtree $touch /tmp/$chroot-touch.txt 2>&1`
            test "$t" = "" || not
            ok "$chroot touch" $t
            test -f $testtree/tmp/$chroot-touch.txt || not
            ok "$chroot $chroot-touch.txt exists"

            sleep 1

            t=`$srcdir/$chroot.sh $testtree $touch -r /tmp/$chroot-touch.txt /tmp/$chroot-touch2.txt 2>&1`
            test "$t" = "" || not
            ok "$chroot touch -r" $t
            test -f $testtree/tmp/$chroot-touch2.txt || not
            ok "$chroot $chroot-touch2.txt exists"
            test $testtree/tmp/$chroot-touch2.txt -nt $testtree/tmp/$chroot-touch.txt && not
            ok "$chroot $chroot-touch2.txt is not newer than touch.txt"
            test $testtree/tmp/$chroot-touch2.txt -ot $testtree/tmp/$chroot-touch.txt && not
            ok "$chroot $chroot-touch2.txt is not older than $chroot-touch.txt"

            sleep 1

            t=`$srcdir/$chroot.sh $testtree $touch -m /tmp/$chroot-touch.txt 2>&1`
            test "$t" = "" || not
            ok "$chroot touch -m" $t

            test $testtree/tmp/$chroot-touch.txt -nt $testtree/tmp/$chroot-touch2.txt || not
            ok "$chroot $chroot-touch.txt is newer than $chroot-touch2.txt"
        fi

    done

fi

cleanup