Debian Codegraph @

tests/ts/blkid/dm-err

raw
1 #!/bin/bash
2
3 #
4 # Copyright (C) 2016 Karel Zak <[email protected]>
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="DM error"
21
22 . "$TS_TOPDIR"/functions.sh
23 ts_init "$*"
24
25 ts_check_test_command "$TS_CMD_BLKID"
26
27 ts_skip_nonroot
28 ts_check_prog "dmsetup"
29
30 DEVNAME="blkid-dm-err"
31 DEVICE="/dev/mapper/${DEVNAME}"
32
33 ts_log "Initialize device"
34 echo "0 262144 error" | dmsetup create $DEVNAME
35
36 # Some tests are run in LXD containers on Travis CI where `mknod` doesn't always work
37 # https://docs.travis-ci.com/user/multi-cpu-architectures/#security-and-lxd-container
38 # https://linuxcontainers.org/lxd/docs/master/syscall-interception
39 if [ "$TRAVIS" == "true" ] && [ ! -b "$DEVICE" ]; then
40 ts_skip "$DEVICE wasn't created"
41 fi
42
43 ts_log "Probe device"
44 $TS_CMD_BLKID --probe --output udev $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
45 echo "Return code: $?" >> $TS_OUTPUT
46
47 udevadm settle
48 ts_log "Deinitialize device"
49
50 dmsetup remove $DEVNAME
51
52 ts_finalize