summaryrefslogtreecommitdiff
path: root/testsuite/devices.test
blob: 04b9e6a6dd79b9f800afff2cd19e025f757f4a02 (plain)
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
#! /bin/sh

# Copyright (C) 2002 by Martin Pool <mbp@samba.org>

# This program is distributable under the terms of the GNU GPL (see
# COPYING).

# Test rsync handling of devices.  This can only run if you're root.

. $srcdir/testsuite/rsync.fns

set -x

# Build some hardlinks

fromdir="$scratchdir/from"
todir="$scratchdir/to"

case `id -u` in
'') ;; # If "id" failed, try to continue...
0) ;;
*) test_skipped "Rsync won't copy devices unless we're root" ;;
esac

# TODO: Need to test whether hardlinks are possible on this OS/filesystem

mkdir "$fromdir"
mknod "$fromdir/char" c 41 67  || test_skipped "Can't create char device node unless root"
mknod "$fromdir/char2" c 42 68  || test_skipped "Can't create char device node unless root"
mknod "$fromdir/char3" c 42 69  || test_skipped "Can't create char device node unless root"
mknod "$fromdir/block" b 42 69 || test_skipped "Can't create block device node unless root"
mknod "$fromdir/block2" b 42 73 || test_skipped "Can't create block device node unless root"
mknod "$fromdir/block3" b 105 73 || test_skipped "Can't create block device node unless root"

checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"

# The script would have aborted on error, so getting here means we've won.
exit 0