3 # Copyright (C) 2008-2009 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 test_description='Test usage of loop devices'
20 privileges_required_=1
21 device_mapper_required_=1
26 # Stop immediately, upon failure.
27 # Otherwise, subsequent tests would fail,
28 # too and just obscure the earlier failure.
32 test -n "$d1" && losetup -d "$d1"
36 emit_expected_diagnostic()
39 'Error: Error informing the kernel about modifications to partiti' \
40 'Warning: The kernel was unable to re-read the partition table on'
44 "setup: create loop devices" \
45 'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1")'
48 'run parted -s "$d1" mklabel msdos' \
49 'parted -s $d1 mklabel msdos > out 2>&1'
50 test_expect_success 'check for empty output' 'compare out /dev/null'
53 'run parted -s "$d1" mkpart primary 1 10' \
54 'parted -s $d1 mkpart primary 1 10 > out 2>&1'
55 test_expect_success 'prepare actual/expected output' \
56 'emit_expected_diagnostic > exp &&
57 cut -b1-64 out > k && mv k out'
58 test_expect_success 'check for expected output' 'compare exp out'