blob: 75fcd0a7a695df4c526602c523da5333f4c66862 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/bin/bash
# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
TS_TOPDIR="$(dirname $0)/../.."
TS_DESC="mount"
. $TS_TOPDIR/functions.sh
ts_init "$*"
ts_skip_nonroot
TESTPROG="$TS_HELPER_LIBMOUNT_CONTEXT"
LABEL=libmount-test
UUID=$(uuidgen)
modprobe --dry-run --quiet scsi_debug
[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
ts_log "Init device"
rmmod scsi_debug &> /dev/null
modprobe scsi_debug dev_size_mb=100
[ "$?" == 0 ] || ts_die "Cannot init device"
sleep 3
DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device"
DEVICE="/dev/${DEVNAME}"
ts_log "Create partitions"
$TS_CMD_FDISK ${DEVICE} >> /dev/null 2>&1 <<EOF
n
p
1
w
q
EOF
DEVICE="/dev/${DEVNAME}1"
sleep 3
ts_log "Create filesystem"
mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null
ts_log "Do tests..."
export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
> $LIBMOUNT_MTAB
ts_init_subtest "by-devname"
mkdir -p $TS_MOUNTPOINT &> /dev/null
$TESTPROG --mount $DEVICE $TS_MOUNTPOINT &> $TS_OUTPUT
grep -q $DEVICE $LIBMOUNT_MTAB || \
echo "(by device) cannot found $DEVICE in $LIBMOUNT_MTAB" &> $TS_OUTPUT
umount $TS_MOUNTPOINT
ts_finalize_subtest
ts_init_subtest "by-label"
mkdir -p $TS_MOUNTPOINT &> /dev/null
$TESTPROG --mount LABEL="$LABEL" $TS_MOUNTPOINT &> $TS_OUTPUT
grep -q $DEVICE $LIBMOUNT_MTAB || \
echo "(by label) cannot found $DEVICE in $LIBMOUNT_MTAB" &> $TS_OUTPUT
umount $TS_MOUNTPOINT
ts_finalize_subtest
ts_init_subtest "by-uuid"
mkdir -p $TS_MOUNTPOINT &> /dev/null
$TESTPROG --mount UUID="$UUID" $TS_MOUNTPOINT &> $TS_OUTPUT
grep -q $DEVICE $LIBMOUNT_MTAB || \
echo "(by uuid) cannot found $DEVICE in $LIBMOUNT_MTAB" &> $TS_OUTPUT
umount $TS_MOUNTPOINT
ts_finalize_subtest
ts_log "...done."
rmmod scsi_debug
ts_finalize
|