svn commit: r223335 - projects/stress2/misc
Peter Holm
pho at FreeBSD.org
Mon Jun 20 12:40:22 UTC 2011
Author: pho
Date: Mon Jun 20 12:40:21 2011
New Revision: 223335
URL: http://svn.freebsd.org/changeset/base/223335
Log:
Added more SUJ test cases (suj18 will be added later on).
Added:
projects/stress2/misc/suj12.sh (contents, props changed)
projects/stress2/misc/suj13.sh (contents, props changed)
projects/stress2/misc/suj14.sh (contents, props changed)
projects/stress2/misc/suj15.sh (contents, props changed)
projects/stress2/misc/suj16.sh (contents, props changed)
projects/stress2/misc/suj17.sh (contents, props changed)
projects/stress2/misc/suj19.sh (contents, props changed)
projects/stress2/misc/suj20.sh (contents, props changed)
projects/stress2/misc/suj21.sh (contents, props changed)
projects/stress2/misc/suj22.sh (contents, props changed)
Added: projects/stress2/misc/suj12.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj12.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# Test with different sector size using gnop(8).
+
+. ../default.cfg
+
+mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
+mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
+
+mdconfig -a -t swap -s 1g -u $mdstart || exit 1
+gnop load
+gnop create -S 4k /dev/md$mdstart
+newfs -U /dev/md${mdstart}.nop
+tunefs -j enable /dev/md${mdstart}.nop
+mount /dev/md${mdstart}.nop $mntpoint
+chmod 777 $mntpoint
+
+export runRUNTIME=20m
+export RUNDIR=$mntpoint/stressX
+
+su $testuser -c 'cd ..; ./run.sh marcus.cfg'
+
+while mount | grep $mntpoint | grep -q /dev/md; do
+ umount $mntpoint || sleep 1
+done
+checkfs /dev/md${mdstart}.nop
+gnop destroy /dev/md${mdstart}.nop
+gnop unload
+mdconfig -d -u $mdstart
Added: projects/stress2/misc/suj13.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj13.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# Run with marcus.cfg on a malloc backed MD with non standard sector size.
+
+. ../default.cfg
+
+mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
+mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
+
+size="128m"
+[ `uname -m` = "amd64" ] && size="1g"
+mdconfig -a -t malloc -o reserve -s $size -S 4096 -u $mdstart || exit 1
+bsdlabel -w md$mdstart auto
+
+newfs -U md${mdstart}$part > /dev/null
+tunefs -j enable /dev/md${mdstart}$part
+
+mount /dev/md${mdstart}$part $mntpoint
+chmod 777 $mntpoint
+
+export runRUNTIME=20m
+export RUNDIR=$mntpoint/stressX
+
+su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1
+
+while mount | grep $mntpoint | grep -q /dev/md; do
+ umount $mntpoint || sleep 1
+done
+checkfs /dev/md${mdstart}$part
+mdconfig -d -u $mdstart
Added: projects/stress2/misc/suj14.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj14.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# "filesystem is full" scenario.
+
+# "panic: softdep_revert_mkdir: dot addref parent mismatch" seen.
+
+. ../default.cfg
+
+mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
+mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
+
+mdconfig -a -t swap -s 2g -u $mdstart || exit 1
+bsdlabel -w md$mdstart auto
+
+newfs -U -j md${mdstart}$part > /dev/null
+
+mount /dev/md${mdstart}$part $mntpoint
+
+# Populate the FS with some random files
+for i in `jot 102`; do
+ mkdir $mntpoint/d$i
+ cp -a /usr/include $mntpoint/d$i
+done
+
+while mount | grep $mntpoint | grep -q /dev/md; do
+ umount $mntpoint || sleep 1
+done
+mdconfig -d -u $mdstart
Added: projects/stress2/misc/suj15.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj15.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# mksnap_ffs(8) test scenario inspired by Christian Gusenbauer, c47g gmx at.
+
+# Three problems seen with this scenario:
+#
+# 1) mksnap_ffs looping in ffs_sync()
+# 2) mksnap_ffs stuck in wsuspfs
+# 3) softdep_waitidle: Failed to flush worklist for ...
+
+. ../default.cfg
+
+mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
+mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
+
+mdconfig -a -t swap -s 2g -u $mdstart || exit 1
+bsdlabel -w md$mdstart auto
+
+newfs -U -j md${mdstart}$part > /dev/null
+
+mount /dev/md${mdstart}$part $mntpoint
+chmod 777 $mntpoint
+
+export runRUNTIME=30m
+export RUNDIR=$mntpoint/stressX
+
+su $testuser -c 'cd ..; ./run.sh jeff.cfg > /dev/null' &
+rpid=$!
+while kill -0 $rpid 2> /dev/null; do
+ sleep 10
+ dump -0aLf /dev/null /dev/md${mdstart}$part
+done
+wait
+
+while mount | grep $mntpoint | grep -q /dev/md; do
+ umount $mntpoint || sleep 1
+done
+mdconfig -d -u $mdstart
Added: projects/stress2/misc/suj16.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj16.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# mksnap_ffs(8) test scenario
+
+# Livelock seen in ffs_sync().
+# "panic: initiate_write_bmsafemap: block 846816 marked free" seen.
+# Zero size snapshot file seen.
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
+mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
+
+mdconfig -a -t swap -s 2g -u $mdstart || exit 1
+bsdlabel -w md$mdstart auto
+
+newfs -U -j md${mdstart}$part > /dev/null 2>&1
+
+mount /dev/md${mdstart}$part $mntpoint
+chmod 777 $mntpoint
+
+export runRUNTIME=30m
+export RUNDIR=$mntpoint/stressX
+export creatINCARNATIONS=2
+
+export TESTPROGS="
+testcases/creat/creat
+"
+su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 &
+rpid=$!
+mdstart2=$((mdstart + 1))
+mntpoint2=${mntpoint}2
+[ -d $mntpoint2 ] || mkdir $mntpoint2
+mount | grep $mntpoint2 | grep -q /dev/md && umount -f $mntpoint2
+mdconfig -l | grep -q md$mdstart2 && mdconfig -d -u $mdstart2
+while kill -0 $rpid 2> /dev/null; do
+ rm -f /mnt/.snap/suj16
+ { mksnap_ffs /mnt /mnt/.snap/suj16 || continue; } 2>&1 | \
+ grep -v "Resource temporarily unavailable"
+ [ ! -s /mnt/.snap/suj16 ] && continue
+ mdconfig -a -t vnode -f /mnt/.snap/suj16 -u $mdstart2 -o readonly
+ mount -r /dev/md$mdstart2 $mntpoint2
+
+ ls -l $mntpoint2 > /dev/null
+
+ umount $mntpoint2
+ mdconfig -d -u $mdstart2
+done
+wait
+
+while mount | grep $mntpoint | grep -q /dev/md; do
+ umount $mntpoint || sleep 1
+done
+mdconfig -d -u $mdstart
Added: projects/stress2/misc/suj17.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj17.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,137 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# Truncate scenario for suj.
+# "panic: worklist_insert: 0xc8bc5b00 freework(0x8009) already on list"
+# seen.
+
+. ../default.cfg
+
+here=`pwd`
+cd /tmp
+sed '1,/^EOF/d' < $here/$0 > suj17.c
+cc -o suj17 -Wall -Wextra -O2 suj17.c
+rm -f suj17.c
+cd $here
+
+mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
+mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
+
+mdconfig -a -t swap -s 2g -u $mdstart || exit 1
+bsdlabel -w md$mdstart auto
+[ $# -eq 1 ] && opt="$1"
+[ $# -eq 0 ] && opt="-j"
+echo "newfs $opt md${mdstart}$part"
+newfs $opt md${mdstart}$part > /dev/null
+mount /dev/md${mdstart}$part $mntpoint
+chmod 777 $mntpoint
+
+su $testuser -c "cd $mntpoint; /tmp/suj17"
+
+while mount | grep $mntpoint | grep -q /dev/md; do
+ umount $mntpoint || sleep 1
+done
+checkfs /dev/md${mdstart}$part
+mdconfig -d -u $mdstart
+rm -f /tmp/suj17
+exit
+EOF
+#include <fcntl.h>
+#include <err.h>
+#include <sched.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define SIZ (1024 * 1024 - 1)
+char buf[SIZ];
+
+void
+test()
+{
+ int fd, i;
+ char name[128];
+ off_t len = 104857600LL; /* 100 Mb */
+ off_t pos;
+
+ sprintf(name, "%06d", getpid());
+ if ((fd = open(name, O_WRONLY | O_CREAT, 0666)) == -1)
+ err(1, "open(%s)", name);
+ for (i = 0; i < 100; i++) {
+ if (write(fd, buf, sizeof(buf)) != sizeof(buf))
+ err(1, "write");
+ }
+
+ for (;;) {
+ if (access("rendezvous", R_OK) == 0)
+ break;
+ sched_yield();
+ }
+
+ srand48(getpid());
+ for (i = 0; i < 50000; i++) {
+ pos = lrand48() % (len - sizeof(buf));
+ if (ftruncate(fd, pos) == -1)
+ err(1, "ftruncate");
+ pos = lrand48() % (len - sizeof(buf));
+ if (lseek(fd, pos, SEEK_SET) == -1)
+ err(1, "lseek");
+ if (write(fd, buf, sizeof(buf)) != sizeof(buf))
+ err(1, "write");
+ }
+ close(fd);
+ unlink(name);
+ _exit(0);
+}
+
+int
+main()
+{
+ int fd, i, j, status;
+
+ for (i = 0; i < 1; i++) {
+ for (j = 0; j < 6; j++) {
+ if (fork() == 0)
+ test();
+ }
+ if ((fd = open("rendezvous", O_CREAT, 0644)) == -1)
+ err(1, "open()");
+ close(fd);
+
+ for (j = 0; j < 6; j++)
+ wait(&status);
+ unlink("rendezvous");
+ }
+
+ return (0);
+}
Added: projects/stress2/misc/suj19.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj19.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# SUJ, quota and snapshots test scenario
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+snap () {
+ while [ ! -s $2 ]; do
+ mksnap_ffs $1 $2 2>&1 | grep -v "Resource temporarily unavailable"
+ [ ! -s $2 ] && rm -f $2 # Get rid of zero size snapshots
+ done
+}
+
+mount | grep "${mntpoint}" | grep -q md${mdstart} && umount ${mntpoint}
+mdconfig -l | grep -q md${mdstart} && mdconfig -d -u ${mdstart}
+
+mdconfig -a -t swap -s 1g -u ${mdstart}
+bsdlabel -w md${mdstart} auto
+newfs -j md${mdstart}${part} > /dev/null
+export PATH_FSTAB=/tmp/fstab
+echo "/dev/md${mdstart}${part} ${mntpoint} ufs rw,userquota 2 2" > $PATH_FSTAB
+mount ${mntpoint}
+set `df -ik ${mntpoint} | tail -1 | awk '{print $4,$7}'`
+export QK=$(($1 / 4))
+export QI=$(($2 / 4))
+edquota -u -f ${mntpoint} -e ${mntpoint}:$((QK - 50)):$QK:$((QI - 50 )):$QI ${testuser}
+quotaon ${mntpoint}
+export RUNDIR=${mntpoint}/stressX
+chmod 777 ${mntpoint}
+su ${testuser} -c 'sh -c "(cd ..;runRUNTIME=20m ./run.sh disk.cfg > /dev/null 2>&1)"' &
+
+for i in `jot 20`; do
+ echo "`date '+%T'` mksnap_ffs ${mntpoint} ${mntpoint}/.snap/snap$i"
+ snap ${mntpoint} ${mntpoint}/.snap/snap$i
+ sleep 1
+done
+i=$(($(date '+%S') % 20 + 1))
+echo "rm -f ${mntpoint}/.snap/snap$i"
+rm -f ${mntpoint}/.snap/snap$i
+wait
+
+while mount | grep -q ${mntpoint}; do
+ umount ${mntpoint} || sleep 1
+done
+mdconfig -d -u ${mdstart}
+rm -f $PATH_FSTAB
Added: projects/stress2/misc/suj20.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj20.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,177 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Looping mksnap_ffs seen.
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+# Scenario by mckusick@
+#
+# create a bunch of files/directories
+# create a snapshot
+# remove many (but not all) of those files/directories
+# create some new files/directories in what remains of those
+# original files/directories.
+# create another snapshot
+# repeat {
+# remove many (somewhat different) of those files/directories
+# create some new files/directories in what remains of those
+# remaining files/directories.
+# create a new snapshot
+# remove oldest snapshot
+# }
+
+snap () {
+ while [ ! -s $2 ]; do
+ mksnap_ffs $1 $2 2>&1 | grep -v "Resource temporarily unavailable"
+ [ ! -s $2 ] && rm -f $2 # Get rid of zero size snapshots
+ done
+}
+
+here=`pwd`
+cd /tmp
+sed '1,/^EOF/d' < $here/$0 > suj20.c
+cc -o suj20 -Wall -Wextra -g -O2 suj20.c
+rm -f suj20.c
+
+mount | grep "${mntpoint}" | grep -q md${mdstart} && umount ${mntpoint}
+mdconfig -l | grep -q md${mdstart} && mdconfig -d -u ${mdstart}
+
+mdconfig -a -t swap -s 1g -u ${mdstart}
+bsdlabel -w md${mdstart} auto
+newfs -j md${mdstart}${part} > /dev/null
+mount /dev/md${mdstart}$part $mntpoint
+
+cd $mntpoint
+chmod 777 $mntpoint
+/tmp/suj20
+snap $mntpoint ${mntpoint}/.snap/snap1
+/tmp/suj20 prune
+snap $mntpoint ${mntpoint}/.snap/snap2
+/tmp/suj20
+for i in `jot 10`; do
+ /tmp/suj20 prune
+ /tmp/suj20
+ snap $mntpoint ${mntpoint}/.snap/snap$((i + 2))
+ sn=`ls -tU ${mntpoint}/.snap | tail -1`
+ rm -f ${mntpoint}/.snap/$sn
+done
+cd $here
+
+while mount | grep -q ${mntpoint}; do
+ umount ${mntpoint} || sleep 1
+done
+mdconfig -d -u ${mdstart}
+rm -f /tmp/suj20
+exit 0
+EOF
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static char buf[4096];
+#define ND 100
+#define NF 500
+
+void
+setup(void)
+{
+ int d, f, fd, i, n;
+ char name[128];
+
+ for (d = 0; d < ND; d++) {
+ snprintf(name, sizeof(name), "d%03d", d);
+ if (mkdir(name, 00700) == -1 && errno != EEXIST)
+ err(1, "mkdir(%s)", name);
+ if (chdir(name) == -1)
+ err(1, "chdir(%s)", name);
+ for (f = 0; f < NF; f++) {
+ if (arc4random() % 100 < 33)
+ continue;
+ snprintf(name, sizeof(name), "f%03d", f);
+ if ((fd = open(name, O_RDWR | O_CREAT | O_TRUNC, 0640)) == -1)
+ err(1, "open(%s)", name);
+ n = arc4random() % 10;
+ for (i = 0; i < n; i++) {
+ if (write(fd, buf, sizeof(buf)) != sizeof(buf))
+ err(1, "write()");
+ }
+ close(fd);
+ }
+ if (chdir("..") == -1)
+ err(1, "chdir(%s)", "..");
+ }
+}
+void
+
+prune(void)
+{
+ int d, f;
+ char name[128];
+
+ for (d = 0; d < ND; d++) {
+ snprintf(name, sizeof(name), "d%03d", d);
+ if (chdir(name) == -1)
+ err(1, "chdir(%s)", name);
+ for (f = 0; f < NF; f++) {
+ if (arc4random() % 100 < 33)
+ continue;
+ snprintf(name, sizeof(name), "f%03d", f);
+ if (unlink(name) == -1 && errno != ENOENT)
+ err(1, "unlink(%s)", name);
+ }
+ if (chdir("..") == -1)
+ err(1, "chdir(%s)", "..");
+ }
+ for (d = 0; d < ND; d++) {
+ if (arc4random() % 100 > 10)
+ continue;
+ snprintf(name, sizeof(name), "rm -rf d%03d", d);
+ system(name);
+ }
+}
+
+int
+main(int argc, char **argv __unused)
+{
+ if (argc == 1)
+ setup();
+ if (argc == 2)
+ prune();
+
+ return (0);
+}
Added: projects/stress2/misc/suj21.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj21.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,178 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Copy of suj20.sh, but with test user as non root.
+# "panic: handle_disk_write_complete: Unknown type freedep" seen.
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+# Scenario by mckusick@
+#
+# create a bunch of files/directories
+# create a snapshot
+# remove many (but not all) of those files/directories
+# create some new files/directories in what remains of those
+# original files/directories.
+# create another snapshot
+# repeat {
+# remove many (somewhat different) of those files/directories
+# create some new files/directories in what remains of those
+# remaining files/directories.
+# create a new snapshot
+# remove oldest snapshot
+# }
+
+snap () {
+ while [ ! -s $2 ]; do
+ mksnap_ffs $1 $2 2>&1 | grep -v "Resource temporarily unavailable"
+ [ ! -s $2 ] && rm -f $2 # Get rid of zero size snapshots
+ done
+}
+
+here=`pwd`
+cd /tmp
+sed '1,/^EOF/d' < $here/$0 > suj21.c
+cc -o suj21 -Wall -Wextra -g -O2 suj21.c
+rm -f suj21.c
+
+mount | grep "${mntpoint}" | grep -q md${mdstart} && umount ${mntpoint}
+mdconfig -l | grep -q md${mdstart} && mdconfig -d -u ${mdstart}
+
+mdconfig -a -t swap -s 1g -u ${mdstart}
+bsdlabel -w md${mdstart} auto
+newfs -j md${mdstart}${part} > /dev/null
+mount /dev/md${mdstart}$part $mntpoint
+
+cd $mntpoint
+chmod 777 $mntpoint
+su $testuser -c '/tmp/suj21'
+snap $mntpoint ${mntpoint}/.snap/snap1
+su $testuser -c '/tmp/suj21 prune'
+snap $mntpoint ${mntpoint}/.snap/snap2
+su $testuser -c '/tmp/suj21'
+for i in `jot 10`; do
+ su $testuser -c '/tmp/suj21 prune'
+ su $testuser -c '/tmp/suj21'
+ snap $mntpoint ${mntpoint}/.snap/snap$((i + 2))
+ sn=`ls -tU ${mntpoint}/.snap | tail -1`
+ rm -f ${mntpoint}/.snap/$sn
+done
+cd $here
+
+while mount | grep -q ${mntpoint}; do
+ umount ${mntpoint} || sleep 1
+done
+mdconfig -d -u ${mdstart}
+rm -f /tmp/suj21
+exit 0
+EOF
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static char buf[4096];
+#define ND 100
+#define NF 500
+
+void
+setup(void)
+{
+ int d, f, fd, i, n;
+ char name[128];
+
+ for (d = 0; d < ND; d++) {
+ snprintf(name, sizeof(name), "d%03d", d);
+ if (mkdir(name, 00700) == -1 && errno != EEXIST)
+ err(1, "mkdir(%s)", name);
+ if (chdir(name) == -1)
+ err(1, "chdir(%s)", name);
+ for (f = 0; f < NF; f++) {
+ if (arc4random() % 100 < 33)
+ continue;
+ snprintf(name, sizeof(name), "f%03d", f);
+ if ((fd = open(name, O_RDWR | O_CREAT | O_TRUNC, 0640)) == -1)
+ err(1, "open(%s)", name);
+ n = arc4random() % 10;
+ for (i = 0; i < n; i++) {
+ if (write(fd, buf, sizeof(buf)) != sizeof(buf))
+ err(1, "write()");
+ }
+ close(fd);
+ }
+ if (chdir("..") == -1)
+ err(1, "chdir(%s)", "..");
+ }
+}
+void
+
+prune(void)
+{
+ int d, f;
+ char name[128];
+
+ for (d = 0; d < ND; d++) {
+ snprintf(name, sizeof(name), "d%03d", d);
+ if (chdir(name) == -1)
+ err(1, "chdir(%s)", name);
+ for (f = 0; f < NF; f++) {
+ if (arc4random() % 100 < 33)
+ continue;
+ snprintf(name, sizeof(name), "f%03d", f);
+ if (unlink(name) == -1 && errno != ENOENT)
+ err(1, "unlink(%s)", name);
+ }
+ if (chdir("..") == -1)
+ err(1, "chdir(%s)", "..");
+ }
+ for (d = 0; d < ND; d++) {
+ if (arc4random() % 100 > 10)
+ continue;
+ snprintf(name, sizeof(name), "rm -rf d%03d", d);
+ system(name);
+ }
+}
+
+int
+main(int argc, char **argv __unused)
+{
+ if (argc == 1)
+ setup();
+ if (argc == 2)
+ prune();
+
+ return (0);
+}
Added: projects/stress2/misc/suj22.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/stress2/misc/suj22.sh Mon Jun 20 12:40:21 2011 (r223335)
@@ -0,0 +1,193 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2011 Peter Holm <pho at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Variation of suj20.sh, with focus on the FS state after a panic / power
+# cycle.
+
+# Demonstrate "multiple references to blocks" in FS after reboot from a
+# looping mksnap_ffs(8).
+
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+. ../default.cfg
+
+# Scenario by mckusick@
+#
+# create a bunch of files/directories
+# create a snapshot
+# remove many (but not all) of those files/directories
+# create some new files/directories in what remains of those
+# original files/directories.
+# create another snapshot
+# repeat {
+# remove many (somewhat different) of those files/directories
+# create some new files/directories in what remains of those
+# remaining files/directories.
+# create a new snapshot
+# remove oldest snapshot
+# }
+
+snap () {
+ while [ ! -s $2 ]; do
+ mksnap_ffs $1 $2 2>&1 | grep -v "Resource temporarily unavailable"
+ [ ! -s $2 ] && rm -f $2 # Get rid of zero size snapshots
+ done
+}
+
+D=$diskimage
+
+if [ -n "`find $D -mtime -1h 2>/dev/null`" ]; then
+ # FS left by previous crash
+ mdconfig -a -t vnode -f $D -u ${mdstart}
+ fsck -t ufs -y md${mdstart}${part}
+ fsck -t ufs -y md${mdstart}${part}
+ rm -f $D
+ exit 0
+fi
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list