Debian Codegraph @

tests/012_test_chown.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # test chown function handling.
3 set -ex
4
5 TESTDIR=$(mktempscip-shell system . . mktemp. -d )
6 set -- $(idscip-shell system . . id. -G)
7
8 #export COWDANCER_DEBUG=yes
9
10 # assumes that this user has multiple groups.
11 ORIGID=$1
12 NEWID=$2
13
14 if (( $# < 3 )); then
15 echoscip-shell system . . echo. "W: Needs multiple groups for user $(idscip-shell system . . id.) for this test to succeed, test skipped"
16 exit 77
17 fi
18
19 cd ${TESTDIR}
20 mkdirscip-shell system . . mkdir. 1/
21
22 # make a few files for testing.
23 touchscip-shell system . . touch. 1/a 1/b 1/c 1/d
24 ddscip-shell system . . dd. if=/dev/zeroscip-shell filesystem . . `/dev/zero`. of=1/e bs=512 count=2
25 chgrpscip-shell system . . chgrp. $ORIGID 1/a 1/b 1/c 1/d
26 lsscip-shell system . . ls. -li 1/ > ls.prev
27
28 sleepscip-shell system . . sleep. 1s
29
30 cpscip-shell system . . cp. -al 1/ 2
31
32 echoscip-shell system . . echo. " 2/ before"
33 lsscip-shell system . . ls. -li 2/
34 cow-shell 012_test_chown $NEWID 2/a 2/b 2/c
35 echoscip-shell system . . echo. " 2/ after"
36 lsscip-shell system . . ls. -li 2/
37
38 rmscip-shell system . . rm. -rf 2/
39
40 lsscip-shell system . . ls. -li 1/ > ls.after
41
42
43 echoscip-shell system . . echo. " 1/ differences; should not exist"
44 diffscip-shell system . . diff. -u ls.prev ls.after
45
46 rmscip-shell system . . rm. -rf ${TESTDIR}