diff options
author | mwilck@arcor.de <mwilck@arcor.de> | 2013-09-14 22:47:10 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-10-16 06:29:42 +0200 |
commit | 1a2872fe9a481a9c0255b7471f5e9d62267b44ca (patch) | |
tree | 89017fe8ed9ba106ed172b9114fca2d21307b52e /tests/env-ddf-template | |
parent | Be consistent in return types from byteswap macros (diff) | |
download | mdadm-1a2872fe9a481a9c0255b7471f5e9d62267b44ca.tar.xz mdadm-1a2872fe9a481a9c0255b7471f5e9d62267b44ca.zip |
DDF tests: allow to run on systems without /dev/sda
Some ddf tests scripts assume that /dev/sda is always present.
That's wrong e.g. on VMs. Use a more general approach.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'tests/env-ddf-template')
-rw-r--r-- | tests/env-ddf-template | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/env-ddf-template b/tests/env-ddf-template index 1c1ca124..aa57fab4 100644 --- a/tests/env-ddf-template +++ b/tests/env-ddf-template @@ -1,3 +1,12 @@ +get_rootdev() { + local dev=$(stat -c %D /) + local maj=$(expr $dev : '\(..\)') + local min=${dev#$maj} + local bd=/dev/$(basename $(readlink /sys/dev/block/$((0x$maj)):$((0x$min)))) + [ -b $bd ] || exit 1 + echo $bd +} + get_sysdir() { local mddev=$1 [ -L $mddev ] && mddev=$(readlink -f $mddev) |