Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
util-linux
util-linux-loop-reuse-07.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-loop-reuse-07.patch of Package util-linux
From ab9795aca848d6c7f5845bbb7ef52f99a255a112 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec <sbrabec@suse.cz> Date: Thu, 14 Jul 2016 15:30:09 +0200 Subject: [PATCH 7/20] tests: Add loop-overlay test The test will check proper loop device reuse and error in case of overlapping loop device. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> --- tests/expected/libmount/loop-overlay | 7 ++++ tests/ts/libmount/loop-overlay | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/expected/libmount/loop-overlay create mode 100755 tests/ts/libmount/loop-overlay diff --git a/tests/expected/libmount/loop-overlay b/tests/expected/libmount/loop-overlay new file mode 100644 index 0000000..ab6c68b --- /dev/null +++ b/tests/expected/libmount/loop-overlay @@ -0,0 +1,7 @@ +second should fail + overlapping loop device exists +should succeed +both should fail + overlapping loop device exists + overlapping loop device exists +Success diff --git a/tests/ts/libmount/loop-overlay b/tests/ts/libmount/loop-overlay new file mode 100755 index 0000000..6fcb81d --- /dev/null +++ b/tests/ts/libmount/loop-overlay @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (C) 2016 Stanislav Brabec <sbrabec@suse.cz> +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +TS_TOPDIR="${0%/*}/../.." +TS_DESC="loop (fstab)" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LOSETUP" +ts_check_test_command "$TS_CMD_MOUNT" +ts_check_test_command "$TS_CMD_UMOUNT" + +ts_skip_nonroot +ts_check_prog "mkfs.ext3" +ts_check_prog "dd" +ts_check_prog "stat" +# Default from functions.sh:ts_image_init() +mib=${1:-"5"} + +IMG=$(ts_image_init) + +mkfs.ext3 -F "$IMG" &> /dev/null || ts_die "Cannot make ext3 on $IMG" +OFFSET=`stat -c %s "$IMG"` +dd if=$IMG of=$IMG oflag=append bs=${mib}M count=1 conv=notrunc status=none + +[ -d "$TS_MOUNTPOINT-1" ] || mkdir -p $TS_MOUNTPOINT-1 +[ -d "$TS_MOUNTPOINT-2" ] || mkdir -p $TS_MOUNTPOINT-2 + +echo "second should fail" >>$TS_OUTPUT +$TS_CMD_MOUNT -oloop "$IMG" "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1 +$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" 2>&1 | sed 's/.*://' >>$TS_OUTPUT + +$TS_CMD_UMOUNT "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1 + +echo "should succeed" >>$TS_OUTPUT +$TS_CMD_MOUNT -oloop,sizelimit=$OFFSET "$IMG" "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1 +$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" >> $TS_OUTPUT 2>&1 +$TS_CMD_UMOUNT "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1 +$TS_CMD_UMOUNT "$TS_MOUNTPOINT-2" >> $TS_OUTPUT 2>&1 + +echo "both should fail" >>$TS_OUTPUT +LOOPDEV=$($TS_CMD_LOSETUP --find) +$TS_CMD_LOSETUP --offset 1 --sizelimit $OFFSET $LOOPDEV "$IMG" +$TS_CMD_MOUNT -oloop,sizelimit=$OFFSET "$IMG" "$TS_MOUNTPOINT-1" 2>&1 | sed 's/.*://' >>$TS_OUTPUT +$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" 2>&1 | sed 's/.*://' >>$TS_OUTPUT +$TS_CMD_LOSETUP --detach $LOOPDEV + +ts_log "Success" +ts_finalize -- 2.9.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor