]>
Commit | Line | Data |
---|---|---|
7ef86a08 DD |
1 | #!/bin/bash |
2 | ||
3 | # | |
4 | # Copyright (C) 2019 Endless Mobile, Inc. | |
5 | # | |
6 | # This file is part of util-linux. | |
7 | # | |
8 | # This file is free software; you can redistribute it and/or modify | |
9 | # it under the terms of the GNU General Public License as published by | |
10 | # the Free Software Foundation; either version 2 of the License, or | |
11 | # (at your option) any later version. | |
12 | # | |
13 | # This file is distributed in the hope that it will be useful, | |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
17 | # | |
18 | ||
19 | TS_TOPDIR="${0%/*}/../.." | |
20 | TS_DESC="iso-partitions" | |
21 | ||
22 | . $TS_TOPDIR/functions.sh | |
23 | ||
24 | ts_init "$*" | |
25 | ||
26 | ts_check_test_command "$TS_CMD_BLKID" | |
27 | ts_check_test_command "$TS_CMD_PARTX" | |
a72a1986 | 28 | ts_check_prog xz |
7ef86a08 DD |
29 | |
30 | ts_skip_nonroot | |
31 | ||
32 | # set global variable TS_DEVICE | |
33 | ts_scsi_debug_init dev_size_mb=50 | |
34 | ||
35 | # This image (created by xorriso) has partition 1 pointing to the ISO | |
36 | # area, followed by an unformatted second partition. | |
37 | xz -dc ${TS_SELF}/iso-partitions.img.xz > ${TS_DEVICE} | |
38 | udevadm settle | |
39 | ||
40 | ts_init_subtest "partitions" | |
41 | $TS_CMD_PARTX -a ${TS_DEVICE} &>/dev/null | |
42 | udevadm settle | |
43 | ||
44 | # Check that the ISO metadata is not shown on the main disk device | |
45 | $TS_CMD_BLKID -p -o udev ${TS_DEVICE} >> $TS_OUTPUT | |
46 | echo -- >> $TS_OUTPUT | |
47 | ||
48 | # Check that the ISO metadata is shown on the "ISO partition" | |
49 | $TS_CMD_BLKID -p -o udev ${TS_DEVICE}1 >> $TS_OUTPUT | |
50 | echo -- >> $TS_OUTPUT | |
51 | ||
52 | # Check that the ISO metadata is not shown on the other partition | |
53 | $TS_CMD_BLKID -p -o udev ${TS_DEVICE}2 >> $TS_OUTPUT | |
54 | ||
55 | # substitute major/minor number before comparison | |
56 | sed -i \ | |
57 | -e 's/^\(ID_PART_ENTRY_DISK\)=.*/\1=__ts_majorminor__/' \ | |
58 | $TS_OUTPUT | |
59 | ||
60 | ts_finalize_subtest | |
61 | ||
62 | # Remove the partition table and check that the ISO metadata is shown on the | |
63 | # main disk device. | |
64 | ts_init_subtest "no_partitions" | |
65 | dd if=/dev/zero of=${TS_DEVICE} bs=512 count=1 &>/dev/null | |
66 | udevadm settle | |
67 | $TS_CMD_PARTX -d ${TS_DEVICE} &>/dev/null | |
68 | udevadm settle | |
69 | $TS_CMD_BLKID -p -o udev ${TS_DEVICE} >> $TS_OUTPUT | |
70 | ts_finalize_subtest | |
71 | ||
72 | ts_finalize |