diff options
Diffstat (limited to 'tests/ts/mount')
-rwxr-xr-x | tests/ts/mount/devname | 48 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-devname | 55 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-devname2label | 52 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-devname2uuid | 51 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-label | 65 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-label2devname | 60 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-label2uuid | 64 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-symlink | 64 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-uuid | 64 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-uuid2devname | 59 | ||||
-rwxr-xr-x | tests/ts/mount/fstab-uuid2label | 64 | ||||
-rwxr-xr-x | tests/ts/mount/label | 58 | ||||
-rwxr-xr-x | tests/ts/mount/move | 60 | ||||
-rwxr-xr-x | tests/ts/mount/mtablock | 52 | ||||
-rwxr-xr-x | tests/ts/mount/noncanonical | 37 | ||||
-rwxr-xr-x | tests/ts/mount/paths | 29 | ||||
-rwxr-xr-x | tests/ts/mount/remount | 54 | ||||
-rwxr-xr-x | tests/ts/mount/special | 43 | ||||
-rwxr-xr-x | tests/ts/mount/uuid | 57 |
19 files changed, 1036 insertions, 0 deletions
diff --git a/tests/ts/mount/devname b/tests/ts/mount/devname new file mode 100755 index 00000000..f0661f32 --- /dev/null +++ b/tests/ts/mount/devname @@ -0,0 +1,48 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="devname" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT + +ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE + +$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-devname b/tests/ts/mount/fstab-devname new file mode 100755 index 00000000..87483afd --- /dev/null +++ b/tests/ts/mount/fstab-devname @@ -0,0 +1,55 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="devname" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add $DEVICE + +# variant A) +$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-devname2label b/tests/ts/mount/fstab-devname2label new file mode 100755 index 00000000..575acaa7 --- /dev/null +++ b/tests/ts/mount/fstab-devname2label @@ -0,0 +1,52 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="devname2label" + +LABEL="testMountD2L" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "LABEL=$LABEL" + +$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-devname2uuid b/tests/ts/mount/fstab-devname2uuid new file mode 100755 index 00000000..d6bf72b9 --- /dev/null +++ b/tests/ts/mount/fstab-devname2uuid @@ -0,0 +1,51 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="devname2uuid" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE + +UUID=$(ts_uuid_by_devname $DEVICE) + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "UUID=$UUID" + +$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-label b/tests/ts/mount/fstab-label new file mode 100755 index 00000000..d47fbb16 --- /dev/null +++ b/tests/ts/mount/fstab-label @@ -0,0 +1,65 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="label" + +LABEL="testFstabLabel" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "LABEL=$LABEL" + +# variant A) +$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +# variant C) +$TS_CMD_MOUNT LABEL=$LABEL 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-label2devname b/tests/ts/mount/fstab-label2devname new file mode 100755 index 00000000..a6e1e7a9 --- /dev/null +++ b/tests/ts/mount/fstab-label2devname @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="label2devname" + +LABEL="testMountL2D" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "$DEVICE" + +# variant A) +$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-label2uuid b/tests/ts/mount/fstab-label2uuid new file mode 100755 index 00000000..18960164 --- /dev/null +++ b/tests/ts/mount/fstab-label2uuid @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="label2uuid" + +LABEL="testMountL2U" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE + +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE + +UUID=$(ts_uuid_by_devname $DEVICE) + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "UUID=$UUID" + +# variant A) +$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-symlink b/tests/ts/mount/fstab-symlink new file mode 100755 index 00000000..336ecdba --- /dev/null +++ b/tests/ts/mount/fstab-symlink @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="symlink" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +LINKNAME="$(pwd)/$TS_OUTDIR/${TS_NAME}_lnk" + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ln -s $DEVICE $LINKNAME + +ts_fstab_add $LINKNAME $TS_MOUNTPOINT "auto" "defaults,user" + +# variant A) -- UID=0 +$TS_CMD_MOUNT $LINKNAME 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME" $DEVICE + +# varian B) +ts_init_suid $TS_CMD_MOUNT +ts_init_suid $TS_CMD_UMOUNT + +su $TS_TESTUSER -c "$TS_CMD_MOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +su $TS_TESTUSER -c "$TS_CMD_UMOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT \ + || ts_die "B) Cannot umount $LINKNAME" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean +rm -f $LINKNAME + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-uuid b/tests/ts/mount/fstab-uuid new file mode 100755 index 00000000..bdd56d77 --- /dev/null +++ b/tests/ts/mount/fstab-uuid @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="uuid" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE + +UUID=$(ts_uuid_by_devname $DEVICE) + +ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "UUID=$UUID" + +# varian A) +$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# varian B) +$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +# varian C) +$TS_CMD_MOUNT UUID=$UUID 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-uuid2devname b/tests/ts/mount/fstab-uuid2devname new file mode 100755 index 00000000..5feac01c --- /dev/null +++ b/tests/ts/mount/fstab-uuid2devname @@ -0,0 +1,59 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="uuid2devname" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE + +UUID=$(ts_uuid_by_devname $DEVICE) + +ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "$DEVICE" + +# variant A) +$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/fstab-uuid2label b/tests/ts/mount/fstab-uuid2label new file mode 100755 index 00000000..fff28ef2 --- /dev/null +++ b/tests/ts/mount/fstab-uuid2label @@ -0,0 +1,64 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="fstab" +TS_DESC="uuid2label" + +LABEL="testMountU2L" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE + +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE + +UUID=$(ts_uuid_by_devname $DEVICE) + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_fstab_add "LABEL=$LABEL" + +# variant A) +$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE +ts_fstab_clean + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/label b/tests/ts/mount/label new file mode 100755 index 00000000..a5b28fa9 --- /dev/null +++ b/tests/ts/mount/label @@ -0,0 +1,58 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="label" + +LABEL="testMountLabel" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL \ + || ts_skip "udev ignores /dev/loop*" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +# variant A) +$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT LABEL=$LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/move b/tests/ts/mount/move new file mode 100755 index 00000000..7e579921 --- /dev/null +++ b/tests/ts/mount/move @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="move " + +ts_init "$*" +ts_skip_nonroot + +PWD=$(pwd) + +DIR_SRC="$PWD/$TS_OUTDIR/mnt-move-src" +DIR_A="$PWD/$TS_OUTDIR/mnt-move-A" +DIR_B="$PWD/$TS_OUTDIR/mnt-move-B" + +[ -d $DIR_SRC ] || mkdir $DIR_SRC +[ -d $DIR_A ] || mkdir $DIR_A +[ -d $DIR_B ] || mkdir $DIR_B + +# bind +$TS_CMD_MOUNT --bind $DIR_SRC $DIR_A + +# check the bind +egrep -q "^$DIR_SRC $DIR_A" /etc/mtab +[ "$?" == "0" ] || ts_die "Cannot found binded $DIR_SRC in /etc/mtab" + +# move +$TS_CMD_MOUNT --move $DIR_A $DIR_B + +# check the move +egrep -q "^$DIR_SRC $DIR_B" /etc/mtab +if [ "$?" != "0" ]; then + $TS_CMD_UMOUNT $DIR_SRC + ts_die "Cannot found moved $DIR_SRC in /etc/mtab" +fi + +# clean up +$TS_CMD_UMOUNT $DIR_SRC +rmdir $DIR_SRC $DIR_A $DIR_B + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/mtablock b/tests/ts/mount/mtablock new file mode 100755 index 00000000..b2f989ed --- /dev/null +++ b/tests/ts/mount/mtablock @@ -0,0 +1,52 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="mtablock" + +ts_init "$*" +ts_skip_nonroot + +# +# Be careful with number of processes. Don't forget that there is time limit +# when the mount waits on the mtab lock. If you define too much processes some +# of them will fail with timeout. +# +# Note: the original version (< 2.13) of util-linux is completely useless for +# this test (maximum for this old version is NLOOPS=10 and NPROCESSES=5 (2-way +# 2GHz machine)). It has terrible performance due a bad timeouts implemntation +# in lock_mtab(). +# +NLOOPS=1000 +NPROCESSES=50 + + +> $TS_OUTPUT.debug +echo 0 > $TS_OUTPUT +SYNCTIME=$(( $(date +%s) + 10 )) + +for id in $(seq 0 $(( $NPROCESSES - 1 ))); do + $TS_CMD_MTABLOCK $id $SYNCTIME $TS_OUTPUT $NLOOPS >> $TS_OUTPUT.debug 2>&1 & +done + +wait + +ts_finalize + diff --git a/tests/ts/mount/noncanonical b/tests/ts/mount/noncanonical new file mode 100755 index 00000000..c732e1bb --- /dev/null +++ b/tests/ts/mount/noncanonical @@ -0,0 +1,37 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="non canonical path" + +ts_init "$*" + +if [ ! -e "/etc" ]; then + ts_skip "/etc not such file of directory" +fi + +# Don't canonicalize SPEC for cifs, nfs, smbfs, ... +$TS_CMD_MOUNT -v -v -v -f -i -n -t cifs //etc /foo | grep "spec:" >> $TS_OUTPUT 2>&1 + +# Canonicalize when FS type undefined and the SPEC exists +$TS_CMD_MOUNT -v -v -v -f -i -n //etc /foo | grep "spec:" >> $TS_OUTPUT 2>&1 + +ts_finalize + diff --git a/tests/ts/mount/paths b/tests/ts/mount/paths new file mode 100755 index 00000000..d77e87b6 --- /dev/null +++ b/tests/ts/mount/paths @@ -0,0 +1,29 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="basic paths" + +ts_init "$*" + +$TS_CMD_MOUNT -n -f -v -v -v /dev/dummy /mnt &> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/mount/remount b/tests/ts/mount/remount new file mode 100755 index 00000000..96d9b9b4 --- /dev/null +++ b/tests/ts/mount/remount @@ -0,0 +1,54 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="remount" + +ts_init "$*" +ts_skip_nonroot + +# mountpoint +[ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext2 $DEVICE &> /dev/null || ts_die "Cannot make ext2 on $DEVICE" $DEVICE + +# mount read-write +$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT || ts_die "Cannot mount $TS_MOUNTPOINT" $DEVICE + +# check the mount +egrep -q "^$DEVICE $TS_MOUNTPOINT" /etc/mtab \ + || ts_die "Cannot found $TS_MOUNTPOINT in /etc/mtab" $DEVICE + +# remount +$TS_CMD_MOUNT -o remount,ro $TS_MOUNTPOINT \ + || ts_die "Cannot remount $TS_MOUNTPOINT" $DEVICE + +# check the remount +egrep -q "^$DEVICE $TS_MOUNTPOINT ext2 ro 0 0" /etc/mtab \ + || ts_die "Cannot found remounted $TS_MOUNTPOINT in /etc/mtab" $DEVICE + +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/mount/special b/tests/ts/mount/special new file mode 100755 index 00000000..9ec78836 --- /dev/null +++ b/tests/ts/mount/special @@ -0,0 +1,43 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="special program" + +MOUNTER="/sbin/mount.mytest" + +ts_init "$*" +ts_skip_nonroot + +cat > $MOUNTER <<\EOF +#!/bin/bash +# This util-linux-ng regression test component +# It's safe to remove me... +# +echo "$0 called with \"$*\"" +EOF +chmod +x $MOUNTER + +$TS_CMD_MOUNT -v -v -v -t mytest /foo /bar &> $TS_OUTPUT + +rm -f $MOUNTER + +ts_finalize + diff --git a/tests/ts/mount/uuid b/tests/ts/mount/uuid new file mode 100755 index 00000000..ee186f07 --- /dev/null +++ b/tests/ts/mount/uuid @@ -0,0 +1,57 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mount" +TS_DESC="uuid" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE + +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE + +UUID=$(ts_uuid_by_devname $DEVICE) + +ts_udev_dev_support "by-uuid" $UUID \ + || ts_skip "udev ignores /dev/loop*" $DEVICE + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +# variant A) +$TS_CMD_MOUNT -U $UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE + +# variant B) +$TS_CMD_MOUNT UUID=$UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +ts_is_mounted $DEVICE || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE + +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + |