From 8387a824b576c41a0a4077cb1973046e91f7d1f6 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 19 Jan 2009 16:50:51 +0100 Subject: tests: create subdirs for test scripts Signed-off-by: Karel Zak --- tests/ts/cal/1m | 60 +++++++++++++++++++++++++ tests/ts/cal/3m | 60 +++++++++++++++++++++++++ tests/ts/cal/year | 60 +++++++++++++++++++++++++ tests/ts/col/multibyte | 29 ++++++++++++ tests/ts/cramfs/mkfs | 91 ++++++++++++++++++++++++++++++++++++++ tests/ts/hwclock/systohc | 59 ++++++++++++++++++++++++ tests/ts/ipcs/function.sh | 83 ++++++++++++++++++++++++++++++++++ tests/ts/ipcs/headers | 60 +++++++++++++++++++++++++ tests/ts/ipcs/limits | 51 +++++++++++++++++++++ tests/ts/ipcs/limits2 | 32 ++++++++++++++ tests/ts/login/checktty | 27 +++++++++++ tests/ts/login/islocal | 28 ++++++++++++ tests/ts/look/separator | 43 ++++++++++++++++++ tests/ts/mount/devname | 48 ++++++++++++++++++++ tests/ts/mount/fstab-devname | 55 +++++++++++++++++++++++ tests/ts/mount/fstab-devname2label | 52 ++++++++++++++++++++++ tests/ts/mount/fstab-devname2uuid | 51 +++++++++++++++++++++ tests/ts/mount/fstab-label | 65 +++++++++++++++++++++++++++ tests/ts/mount/fstab-label2devname | 60 +++++++++++++++++++++++++ tests/ts/mount/fstab-label2uuid | 64 +++++++++++++++++++++++++++ tests/ts/mount/fstab-symlink | 64 +++++++++++++++++++++++++++ tests/ts/mount/fstab-uuid | 64 +++++++++++++++++++++++++++ tests/ts/mount/fstab-uuid2devname | 59 ++++++++++++++++++++++++ tests/ts/mount/fstab-uuid2label | 64 +++++++++++++++++++++++++++ tests/ts/mount/label | 58 ++++++++++++++++++++++++ tests/ts/mount/move | 60 +++++++++++++++++++++++++ tests/ts/mount/mtablock | 52 ++++++++++++++++++++++ tests/ts/mount/noncanonical | 37 ++++++++++++++++ tests/ts/mount/paths | 29 ++++++++++++ tests/ts/mount/remount | 54 ++++++++++++++++++++++ tests/ts/mount/special | 43 ++++++++++++++++++ tests/ts/mount/uuid | 57 ++++++++++++++++++++++++ tests/ts/namei/logic | 36 +++++++++++++++ tests/ts/paths/built-in | 29 ++++++++++++ tests/ts/script/race | 37 ++++++++++++++++ tests/ts/swapon/devname | 46 +++++++++++++++++++ tests/ts/swapon/label | 51 +++++++++++++++++++++ tests/ts/swapon/uuid | 50 +++++++++++++++++++++ 38 files changed, 1968 insertions(+) create mode 100755 tests/ts/cal/1m create mode 100755 tests/ts/cal/3m create mode 100755 tests/ts/cal/year create mode 100755 tests/ts/col/multibyte create mode 100755 tests/ts/cramfs/mkfs create mode 100755 tests/ts/hwclock/systohc create mode 100644 tests/ts/ipcs/function.sh create mode 100755 tests/ts/ipcs/headers create mode 100755 tests/ts/ipcs/limits create mode 100755 tests/ts/ipcs/limits2 create mode 100755 tests/ts/login/checktty create mode 100755 tests/ts/login/islocal create mode 100755 tests/ts/look/separator create mode 100755 tests/ts/mount/devname create mode 100755 tests/ts/mount/fstab-devname create mode 100755 tests/ts/mount/fstab-devname2label create mode 100755 tests/ts/mount/fstab-devname2uuid create mode 100755 tests/ts/mount/fstab-label create mode 100755 tests/ts/mount/fstab-label2devname create mode 100755 tests/ts/mount/fstab-label2uuid create mode 100755 tests/ts/mount/fstab-symlink create mode 100755 tests/ts/mount/fstab-uuid create mode 100755 tests/ts/mount/fstab-uuid2devname create mode 100755 tests/ts/mount/fstab-uuid2label create mode 100755 tests/ts/mount/label create mode 100755 tests/ts/mount/move create mode 100755 tests/ts/mount/mtablock create mode 100755 tests/ts/mount/noncanonical create mode 100755 tests/ts/mount/paths create mode 100755 tests/ts/mount/remount create mode 100755 tests/ts/mount/special create mode 100755 tests/ts/mount/uuid create mode 100755 tests/ts/namei/logic create mode 100755 tests/ts/paths/built-in create mode 100755 tests/ts/script/race create mode 100755 tests/ts/swapon/devname create mode 100755 tests/ts/swapon/label create mode 100755 tests/ts/swapon/uuid (limited to 'tests/ts') diff --git a/tests/ts/cal/1m b/tests/ts/cal/1m new file mode 100755 index 00000000..53a1395e --- /dev/null +++ b/tests/ts/cal/1m @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="cal" +TS_DESC="1 month" + +ts_init "$*" + +set -o pipefail + +USETERM=$( ts_has_option "useterm" "$*" ) +MYTIME="27 09 2006" + +[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" +ts_log "" + +ts_log "Gregorian - Monday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -1m $MYTIME +fi +$TS_CMD_CAL -1m $MYTIME >> $TS_OUTPUT + +ts_log "Gregorian - Sunday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -1s $MYTIME +fi +$TS_CMD_CAL -1s $MYTIME >> $TS_OUTPUT + + +ts_log "Julian - Monday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -1mj $MYTIME +fi +$TS_CMD_CAL -1mj $MYTIME >> $TS_OUTPUT + +ts_log "Julian - Sunday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -1sj $MYTIME +fi +$TS_CMD_CAL -1sj $MYTIME >> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/cal/3m b/tests/ts/cal/3m new file mode 100755 index 00000000..aa815f58 --- /dev/null +++ b/tests/ts/cal/3m @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="cal" +TS_DESC="3 months" + +ts_init "$*" + +set -o pipefail + +USETERM=$( ts_has_option "useterm" "$*" ) +MYTIME="27 09 2006" + +[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" +ts_log "" + +ts_log "Gregorian - Monday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -3m $MYTIME +fi +$TS_CMD_CAL -3m $MYTIME >> $TS_OUTPUT + +ts_log "Gregorian - Sunday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -3s $MYTIME +fi +$TS_CMD_CAL -3s $MYTIME >> $TS_OUTPUT + + +ts_log "Julian - Monday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -3mj $MYTIME +fi +$TS_CMD_CAL -3mj $MYTIME >> $TS_OUTPUT + +ts_log "Julian - Sunday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -3sj $MYTIME +fi +$TS_CMD_CAL -3sj $MYTIME >> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/cal/year b/tests/ts/cal/year new file mode 100755 index 00000000..769373a9 --- /dev/null +++ b/tests/ts/cal/year @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="cal" +TS_DESC="year" + +ts_init "$*" + +set -o pipefail + +USETERM=$( ts_has_option "useterm" "$*" ) +MYTIME="29 11 2006" + +[ "$USETERM" == "yes" ] && TS_VERBOSE="yes" +ts_log "" + +ts_log "Gregorian - Monday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -ym $MYTIME +fi +$TS_CMD_CAL -ym $MYTIME >> $TS_OUTPUT + +ts_log "Gregorian - Sunday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -ys $MYTIME +fi +$TS_CMD_CAL -ys $MYTIME >> $TS_OUTPUT + + +ts_log "Julian - Monday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -ymj $MYTIME +fi +$TS_CMD_CAL -ymj $MYTIME >> $TS_OUTPUT + +ts_log "Julian - Sunday-based week" +if [ "$USETERM" == "yes" ]; then + $TS_CMD_CAL -ysj $MYTIME +fi +$TS_CMD_CAL -ysj $MYTIME >> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/col/multibyte b/tests/ts/col/multibyte new file mode 100755 index 00000000..357d7f15 --- /dev/null +++ b/tests/ts/col/multibyte @@ -0,0 +1,29 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="col" +TS_DESC="multibyte" + +ts_init "$*" + +cat $TS_INPUT | $TS_CMD_COL > /dev/null 2> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs new file mode 100755 index 00000000..651f4e34 --- /dev/null +++ b/tests/ts/cramfs/mkfs @@ -0,0 +1,91 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="mkfs.cramfs" +TS_DESC="mkfs" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +IMAGE="$TS_OUTDIR/cramfs-loop.img" +IMAGE_DATA="$TS_OUTDIR/cramfs-data" +LABEL="testCramfs" +TS_MOUNTPOINT="$TS_OUTDIR/cramfs-mnt" + +ts_log "create mountpoint dir" + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_log "generate data" +if [ ! -d "$IMAGE_DATA" ]; then + mkdir -p $IMAGE_DATA + for d in `seq 0 110`; do + DIRNAME="$IMAGE_DATA/$(printf "dir-%03d" $d)" + mkdir -p $DIRNAME + for f in `seq 0 10`; do + FILENAME="$DIRNAME/$(printf "data.%03d" $f)" + printf "data in %03d-%03d" $d $f >> $FILENAME + done + done +fi + +ts_log "list checksums from original data" +find $IMAGE_DATA -type f -exec md5sum {} \; | sort >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "create cramfs image" +$TS_CMD_MKCRAMFS -n $LABEL $IMAGE_DATA $IMAGE 2>&1 >> $TS_OUTPUT +[ -s "$IMAGE" ] || ts_die "Cannot create $IMAGE" + +ts_log "count MD5 from the image" +md5sum $IMAGE 2>&1 | sort >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "create loop device from image" +DEVICE=$( $TS_CMD_LOSETUP -s -f $IMAGE) + +ts_log "check the image" +ts_device_has "TYPE" "cramfs" $DEVICE +[ "$?" == "0" ] || ts_die "Cannot found cramfs on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL +[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE + +ts_log "mount the image" +$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT + +# check it +ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE + +ts_log "list the image" +ls -laR --time-style=long-iso $TS_MOUNTPOINT >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "list checksums from new data" +find $TS_MOUNTPOINT -type f -exec md5sum {} \; | sort >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "umount the image" +$TS_CMD_UMOUNT $DEVICE +$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT +ts_finalize + diff --git a/tests/ts/hwclock/systohc b/tests/ts/hwclock/systohc new file mode 100755 index 00000000..3ae4fe1b --- /dev/null +++ b/tests/ts/hwclock/systohc @@ -0,0 +1,59 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="hwclock" +TS_DESC="systohc" + +NTP_SERVER="0.fedora.pool.ntp.org" + +ts_init "$*" +ts_skip_nonroot + +[ -x "/usr/sbin/ntpdate" ] || ts_skip "cannot found ntpdate command" + +set -o pipefail + +# sync with server +(ntpdate $NTP_SERVER | sed "s/^.*offset \([0-9.]*\) sec/\1/g") &> /dev/null +[ "$?" == "1" ] && ts_skip "cannot sync with $NTP_SERVER" + +# sync again and check difference +OFFSET=$( ntpdate $NTP_SERVER 2> /dev/null | sed "s/^.*offset [\-]*\([0-9.]*\) sec/\1/g" ) +[ "$?" == "1" ] && ts_skip "cannot sync with $NTP_SERVER (2nd attempt)" + +DIFF=$( echo "$OFFSET > 1" | bc ) +[ "$DIFF" == "1" ] && ts_skip "diff between systime and NTP is greated than 1 second" + +# call hwclock +for i in `seq 0 10`; do + #echo "sync #$i" + $TS_CMD_HWCLOCK --systohc + $TS_CMD_HWCLOCK --hctosys +done + +# sync with NTP and check new difference +OFFSET=$( ntpdate $NTP_SERVER 2> /dev/null | sed "s/^.*offset [\-]*\([0-9.]*\) sec/\1/g" ) +[ "$?" == "1" ] && ts_skip "cannot sync with $NTP_SERVER (3rd attempt)" + +DIFF=$( echo "$OFFSET > 1" | bc ) +[ "$DIFF" == "1" ] && ts_failed "offset is $OFFSET" + +ts_ok "offset is $OFFSET" + diff --git a/tests/ts/ipcs/function.sh b/tests/ts/ipcs/function.sh new file mode 100644 index 00000000..ff35e75e --- /dev/null +++ b/tests/ts/ipcs/function.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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. +# + +PAGE_SIZE=$($TS_HELPER_SYSINFO pagesize) + +# kernel files +IPCS_PROCFILES=( + /proc/sys/kernel/shmmni + /proc/sys/kernel/shmall + /proc/sys/kernel/shmmax +) + +# raw data converted to ipcs-like format +# shmmni = same +# shmall = from pages to KBytes +# shmmax = from bytes to KBytes +# +IPCS_KERNEL_CMD=( + "cat /proc/sys/kernel/shmmni" + "echo \$(cat /proc/sys/kernel/shmall) / 1024 \* $PAGE_SIZE | bc -l | sed 's/\..*//'" + "echo \$(cat /proc/sys/kernel/shmmax) / 1024 | bc -l | sed 's/\..*//'" +) + +# data from the ipcs command +IPCS_CMD=( + "$TS_CMD_IPCS -m -l | $AWK '/max number of segments/ { print \$6 }'" + "$TS_CMD_IPCS -m -l | $AWK '/max total shared memory/ { print \$7 }'" + "$TS_CMD_IPCS -m -l | $AWK '/max seg size/ { print \$6 }'" +) + + +# The linux kernel accepts ULONG_MAX, but this value is same like ULLONG_MAX on +# 64-bit archs. So the ipcs command has to always overflow on 64-bit archs when +# shmall (=num of pages!) is same or almost same like ULONG_MAX. This is reason +# why we for the test uses 32-bit limits on all archs. +# +# (Don't worry that 64-bit ULONG_MAX makes ipcs useless ... +# ... it's a problem for admins who want to use 75557863725TB of RAM for shm) +# +IPCS_LIMITS=( + $($TS_HELPER_SYSINFO INT_MAX) + $($TS_HELPER_SYSINFO ULONG_MAX32) + $($TS_HELPER_SYSINFO ULONG_MAX32) +) + +# list of indexes = 0..(sizeof Array - 1) +IPCS_IDX=$(seq 0 $(( ${#IPCS_PROCFILES[*]} - 1 ))) + +# checker +function ipcs_limits_check { + for i in $IPCS_IDX; do + echo -n ${IPCS_PROCFILES[$i]} + + a=$(eval ${IPCS_KERNEL_CMD[$i]}) + b=$(eval ${IPCS_CMD[$i]}) + + #echo -n " RAW: " + #cat ${IPCS_PROCFILES[$i]} + #echo "CMD: ${ICPS_KERNEL_CMD[$i]}" + + if [ x"$a" == x"$b" ]; then + echo " OK" + else + echo " kernel=$a, ipcs=$b" + fi + done +} + diff --git a/tests/ts/ipcs/headers b/tests/ts/ipcs/headers new file mode 100755 index 00000000..8a391d0c --- /dev/null +++ b/tests/ts/ipcs/headers @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="ipcs" +TS_DESC="headers" + +ts_init "$*" + +ts_log "test: shm headers" +$TS_CMD_IPCS -m -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -m -u | grep "^---" >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "test: mesg headers" +$TS_CMD_IPCS -q -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -q -u | grep "^---" >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "test: sem headers" +$TS_CMD_IPCS -s -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -s -u | grep "^---" >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "test: all headers" +$TS_CMD_IPCS -a | grep --after-context=1 "^---" >> $TS_OUTPUT + +$TS_CMD_IPCS -a -t | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -p | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -c | grep --after-context=1 "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -l | grep "^---" >> $TS_OUTPUT +$TS_CMD_IPCS -a -u | grep "^---" >> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/ipcs/limits b/tests/ts/ipcs/limits new file mode 100755 index 00000000..6224ac44 --- /dev/null +++ b/tests/ts/ipcs/limits @@ -0,0 +1,51 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="ipcs" +TS_DESC="limits overflow" + +. ./ts-ipcs.sh + +ts_init "$*" +ts_skip_nonroot + +ts_log "load original values" +for i in $IPCS_IDX; do + SHM_ORG[$i]=$(cat ${IPCS_PROCFILES[$i]}) +done >> $TS_OUTPUT + +ts_log "check for difference between kernel and IPC" +ipcs_limits_check >> $TS_OUTPUT + +ts_log "maximalize kernel setting" +for i in $IPCS_IDX; do + echo ${IPCS_LIMITS[$i]} >> ${IPCS_PROCFILES[$i]} +done >> $TS_OUTPUT + +ts_log "re-check for difference between kernel and IPC" +ipcs_limits_check >> $TS_OUTPUT + +ts_log "write original values to kernel" +for i in $IPCS_IDX; do + echo ${SHM_ORG[$i]} >> ${IPCS_PROCFILES[$i]} +done >> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2 new file mode 100755 index 00000000..f539e8a6 --- /dev/null +++ b/tests/ts/ipcs/limits2 @@ -0,0 +1,32 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="ipcs" +TS_DESC="basic limits" + +. ./ts-ipcs.sh + +ts_init "$*" + +ts_log "check for difference between kernel and IPC" +ipcs_limits_check >> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/login/checktty b/tests/ts/login/checktty new file mode 100755 index 00000000..a5a13279 --- /dev/null +++ b/tests/ts/login/checktty @@ -0,0 +1,27 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="login" +TS_DESC="checktty" + +ts_init "$*" +$TS_CMD_CHECKTTY >> $TS_OUTPUT +ts_finalize + diff --git a/tests/ts/login/islocal b/tests/ts/login/islocal new file mode 100755 index 00000000..0c8d7798 --- /dev/null +++ b/tests/ts/login/islocal @@ -0,0 +1,28 @@ +#!/bin/bash + +# +# Copyright (C) 2008 James Youngman +# +# 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="login" +TS_DESC="islocal" + +ts_init "$*" +$TS_CMD_ISLOCAL "$TS_INPUT" root nobody "" youngman youngman2 \ + abcdefghx nobo long rot al malformed \ + nonl znobody >> $TS_OUTPUT +ts_finalize diff --git a/tests/ts/look/separator b/tests/ts/look/separator new file mode 100755 index 00000000..81e66ea2 --- /dev/null +++ b/tests/ts/look/separator @@ -0,0 +1,43 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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. +# + +# +# WARNING: the look command expects that the /usr/share/dict/words uses +# directory order! +# +# for example: +# +# cat words.raw | egrep --invert-match "'s$" | \ +# egrep "^[[:alnum:]'&!,./-]+$" | \ +# sort --ignore-case --dictionary-order | \ +# uniq > words +# + +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="look" +TS_DESC="separator" + +ts_init "$*" + +[ -f "/usr/share/dict/words" ] || ts_skip "/usr/share/dict/words not such file" + +$TS_CMD_LOOK apple-pie >> $TS_OUTPUT +ts_finalize + 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 +# +# 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 + diff --git a/tests/ts/namei/logic b/tests/ts/namei/logic new file mode 100755 index 00000000..5ef8369c --- /dev/null +++ b/tests/ts/namei/logic @@ -0,0 +1,36 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="namei" +TS_DESC="logic" + +ts_init "$*" + +SANDBOX="$TS_OUTDIR/namei" + +mkdir -p $SANDBOX/namei1/namei2 +touch $SANDBOX/namei1/namei2/a $SANDBOX/namei1/namei2/b + +$TS_CMD_NAMEI $SANDBOX/namei1/namei2/a >> $TS_OUTPUT 2>&1 +$TS_CMD_NAMEI $SANDBOX/namei1/namei2/b >> $TS_OUTPUT 2>&1 +$TS_CMD_NAMEI $SANDBOX/namei1/namei2/a/b >> $TS_OUTPUT 2>&1 + +ts_finalize + diff --git a/tests/ts/paths/built-in b/tests/ts/paths/built-in new file mode 100755 index 00000000..fbf1fdaa --- /dev/null +++ b/tests/ts/paths/built-in @@ -0,0 +1,29 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="include" +TS_DESC="basic paths" + +ts_init "$*" + +$TS_HELPER_PATHS &> $TS_OUTPUT + +ts_finalize + diff --git a/tests/ts/script/race b/tests/ts/script/race new file mode 100755 index 00000000..818d0c5e --- /dev/null +++ b/tests/ts/script/race @@ -0,0 +1,37 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="script" +TS_DESC="race conditions" + +ts_init "$*" + +bingofile="$TS_OUTDIR/$TS_NAME-bingo" + +set -o pipefail + +for i in `seq 1 1000`; do + $TS_CMD_SCRIPT -q -c "printf 'Bingo\n'" $bingofile +done | grep -c Bingo >> $TS_OUTPUT + +rm -f $bingofile + +ts_finalize + diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname new file mode 100755 index 00000000..954af861 --- /dev/null +++ b/tests/ts/swapon/devname @@ -0,0 +1,46 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="swapon" +TS_DESC="devname" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \ + || ts_die "Cannot make swap $DEVICE" $DEVICE + +ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot found swap on $DEVICE" $DEVICE + +$TS_CMD_SWAPON $DEVICE 2>&1 >> $TS_OUTPUT + +grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE + +ts_swapoff $DEVICE +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label new file mode 100755 index 00000000..3ea30a96 --- /dev/null +++ b/tests/ts/swapon/label @@ -0,0 +1,51 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="swapon" +TS_DESC="label" + +LABEL="testSwapLabel" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +$TS_CMD_MKSWAP -L $LABEL $DEVICE > /dev/null 2>> $TS_OUTPUT \ + || ts_die "Cannot make swap 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_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT + +grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE + +ts_swapoff $DEVICE +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid new file mode 100755 index 00000000..3b181fa0 --- /dev/null +++ b/tests/ts/swapon/uuid @@ -0,0 +1,50 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak +# +# 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="swapon" +TS_DESC="uuid" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +DEVICE=$(ts_device_init) +[ "$?" == 0 ] || ts_die "Cannot init device" + +$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \ + || ts_die "Cannot make swap $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 + +$TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT + +grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE + +ts_swapoff $DEVICE +ts_device_deinit $DEVICE + +ts_log "Success" +ts_finalize + -- cgit v1.2.3