From b13154de3eca5ba28fbb4854d916cd0be5febeed Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Fri, 2 Nov 2012 20:15:39 +0400 Subject: Imported Upstream version 2.22 --- tests/ts/eject/umount | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100755 tests/ts/eject/umount (limited to 'tests/ts/eject/umount') diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount new file mode 100755 index 0000000..3081c1f --- /dev/null +++ b/tests/ts/eject/umount @@ -0,0 +1,111 @@ +#!/bin/bash + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="umount" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +# +# Note that eject --force is required because scsi_debug is +# not removable device. +# + +modprobe --dry-run --quiet scsi_debug +[ "$?" == 0 ] || ts_skip "missing scsi_debug module" + +rmmod scsi_debug &> /dev/null + +function init_device { + modprobe scsi_debug dev_size_mb=100 + [ "$?" == 0 ] || ts_die "Cannot init device" + + sleep 3 + + DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') + [ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device" + + echo "/dev/${DEVNAME}" + +} + +function init_partitions { + local dev=$1 + + ts_log "Create partitions" + $TS_CMD_FDISK $dev >> /dev/null 2>&1 <