aboutsummaryrefslogtreecommitdiff
path: root/tests/losetup.test
blob: f30a0fe2c70eb72771857eaf1ed46c4ad7b584ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

[ -f testing.sh ] && . testing.sh

if [ "$(id -u)" -ne 0 ]
then
  echo "$SHOWSKIP: losetup (not root)"
  return 2>/dev/null
  exit
fi

#testing "name" "command" "result" "infile" "stdin"

truncate -s 1M blah.img &&
FILE="$(readlink -f blah.img)"
DEV="$(printf '%04s' $(stat -t blah.img | awk '{print $7}'))"
NODE="$(stat -t blah.img | awk '{print $8}')"

losetup -f 
losetup -f -s
losetup -f file

losetup -d

rm blah.img