Debian Codegraph @

tests/012_test_chown.sh

raw symbols SCIP
1 #!/bin/bash
2 # test chown function handling.
3 set -ex
4
5 TESTDIR=$(mktemp -d )
6 set -- $(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 echo "W: Needs multiple groups for user $(id) for this test to succeed, test skipped"
16 exit 77
17 fi
18
19 cd ${TESTDIR}
20 mkdir 1/
21
22 # make a few files for testing.
23 touch 1/a 1/b 1/c 1/d
24 dd if=/dev/zero of=1/e bs=512 count=2
25 chgrp $ORIGID 1/a 1/b 1/c 1/d
26 ls -li 1/ > ls.prev
27
28 sleep 1s
29
30 cp -al 1/ 2
31
32 echo " 2/ before"
33 ls -li 2/
34 cow-shell 012_test_chown $NEWID 2/a 2/b 2/c
35 echo " 2/ after"
36 ls -li 2/
37
38 rm -rf 2/
39
40 ls -li 1/ > ls.after
41
42
43 echo " 1/ differences; should not exist"
44 diff -u ls.prev ls.after
45
46 rm -rf ${TESTDIR}