Hi!
> +tst_acquire_device()
> +{
We should check that tst_tmpdir() has been called here, i.e. that
TST_TMPDIR is non-empty string.
> + if [ -n "${LTP_DEV}" ]; then
> + tst_resm TINFO "Using test device LTP_DEV='${LTP_DEV}'"
> + stat ${LTP_DEV} | grep -q "block special file"
[ -b "$LTP_DEV" ] ?
> + if [ $? -ne 0 ]; then
> + tst_brkm TBROK "${LTP_DEV} is not a block device"
> + fi
> + TST_DEVICE=${LTP_DEV}
> + return
> + fi
> +
> + ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=20480
> +
> + TST_DEVICE=$(losetup -f)
> + if [ $? -ne 0 ]; then
> + tst_brkm TBROK "Couldn't find free loop device"
> + fi
> +
> + tst_resm TINFO "Found free device '${TST_DEVICE}'"
> +
> + ROD_SILENT losetup ${TST_DEVICE} test_dev.img
> +}
> +
> +tst_release_device()
> +{
> + losetup -a | grep -q ${TST_DEVICE}
> + if [ $? -eq 0 ]; then
> + losetup -d ${TST_DEVICE}
> + if [ $? -ne 0 ];then
> + tst_resm TWARN "'losetup -d ${TST_DEVICE}' failed"
> + fi
> + fi
> +
> + if [ -f "test_dev.img" ]; then
> + rm test_dev.img
> + fi
We don't have to delete the file here, the tst_rmdir() will do that for
us.
> +}
> +
> # Check that test name is set
> if [ -z "$TCID" ]; then
> tst_brkm TBROK "TCID is not defined"
Otherwise it looks fine.
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list