]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tests/ts/blkid/iso-partitions
Revert "libblkid: improve identification of ISO9660 partition"
[thirdparty/util-linux.git] / tests / ts / blkid / iso-partitions
CommitLineData
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
19TS_TOPDIR="${0%/*}/../.."
20TS_DESC="iso-partitions"
21
22. $TS_TOPDIR/functions.sh
23
24ts_init "$*"
25
26ts_check_test_command "$TS_CMD_BLKID"
27ts_check_test_command "$TS_CMD_PARTX"
a72a1986 28ts_check_prog xz
7ef86a08
DD
29
30ts_skip_nonroot
31
32# set global variable TS_DEVICE
33ts_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.
37xz -dc ${TS_SELF}/iso-partitions.img.xz > ${TS_DEVICE}
38udevadm settle
39
40ts_init_subtest "partitions"
41$TS_CMD_PARTX -a ${TS_DEVICE} &>/dev/null
42udevadm 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
46echo -- >> $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
50echo -- >> $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
56sed -i \
57 -e 's/^\(ID_PART_ENTRY_DISK\)=.*/\1=__ts_majorminor__/' \
58 $TS_OUTPUT
59
60ts_finalize_subtest
61
62# Remove the partition table and check that the ISO metadata is shown on the
63# main disk device.
64ts_init_subtest "no_partitions"
65dd if=/dev/zero of=${TS_DEVICE} bs=512 count=1 &>/dev/null
66udevadm settle
67$TS_CMD_PARTX -d ${TS_DEVICE} &>/dev/null
68udevadm settle
69$TS_CMD_BLKID -p -o udev ${TS_DEVICE} >> $TS_OUTPUT
70ts_finalize_subtest
71
72ts_finalize