~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to tests/t4200-partprobe.sh

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-21 10:23:16 UTC
  • mfrom: (7.2.32 sid)
  • Revision ID: package-import@ubuntu.com-20140721102316-jsyv3yzmbo8vlde5
Tags: 3.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
 
2
# partprobe must not examine more than 16 partitions
2
3
 
3
 
# Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
4
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
4
5
 
5
6
# This program is free software; you can redistribute it and/or modify
6
7
# it under the terms of the GNU General Public License as published by
15
16
# You should have received a copy of the GNU General Public License
16
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
 
18
 
test_description='partprobe must not examine more than 16 partitions'
19
 
 
20
 
privileges_required_=1
21
 
erasable_device_required_=1
22
 
dvhtool_required_=1
23
 
 
24
 
: ${srcdir=.}
25
 
. $srcdir/test-lib.sh
 
19
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
 
20
require_erasable_
 
21
require_root_
 
22
require_dvhtool_
 
23
 
26
24
dev=$DEVICE_TO_ERASE
27
25
 
28
 
test_expect_success \
29
 
    "setup: create a DVH partition table on $dev" \
30
 
    '
31
 
    dd if=/dev/zero of=$dev bs=512 count=1 seek=10000 &&
32
 
    parted -s $dev mklabel dvh
33
 
    '
 
26
# setup: create a DVH partition table on $dev"
 
27
dd if=/dev/zero of=$dev bs=512 count=1 seek=10000 || fail=1
 
28
parted -s $dev mklabel dvh || fail=1
34
29
 
35
 
test_expect_success \
36
 
    "setup: use dvhtool to create a 17th (invalid?) partition" \
37
 
    '
38
 
    dd if=/dev/zero of=d bs=1 count=4k &&
39
 
    dvhtool -d $dev --unix-to-vh d data
40
 
    '
 
30
# setup: use dvhtool to create a 17th (invalid?) partition"
 
31
dd if=/dev/zero of=d bs=1 count=4k || fail=1
 
32
dvhtool -d $dev --unix-to-vh d data || fail=1
41
33
 
42
34
# Here's sample output from the parted...print command below:
43
35
# BYT;
44
 
# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk;
 
36
# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk:;
45
37
# 9:0s:4095s:4096s:::;
46
38
# 17:4s:11s:8s::data:;
47
39
 
48
 
test_expect_success \
49
 
    "ensure that dvhtool did what we want" \
50
 
    '
51
 
    parted -m -s $dev unit s print > out 2>&1 &&
52
 
    grep "^17:.*::data:;\$" out
53
 
    '
 
40
# ensure that dvhtool did what we want"
 
41
parted -m -s $dev unit s print > out 2>&1 || fail=1
 
42
grep "^17:.*::data:;\$" out || fail=1
54
43
 
55
44
# Parted 1.8.9 and earlier would mistakenly try to access partition #17.
56
 
test_expect_success \
57
 
    "ensure that partprobe succeeds and produces no output" \
58
 
    '
59
 
    partprobe -s $dev > out 2>err &&
60
 
    compare err /dev/null &&
61
 
    echo "$dev: dvh partitions 9 <17>" > exp &&
62
 
    compare out exp
63
 
    '
 
45
# ensure that partprobe succeeds and produces no output"
 
46
partprobe -s $dev > out 2>err || fail=1
 
47
compare /dev/null err || fail=1
 
48
echo "$dev: dvh partitions 9 <17>" > exp || fail=1
 
49
compare exp out || fail=1
64
50
 
65
 
test_done
 
51
Exit $fail