diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 07cff21a1d9a..f8936d9efee8 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -60,6 +60,7 @@ suj36.sh https://people.freebsd.org/~pho/stress/log/log0392.txt 20221114 swapoff2.sh swap_pager_force_pagein: read from swap failed 20171223 swapoff3.sh Excessive OOM killing 20220403 swapoff5.sh log0005.txt, known issue 20210111 +swapoff6.sh https://people.freebsd.org/~pho/stress/log/log0540.txt 20240716 systrace.sh WiP 20200227 systrace2.sh WiP 20200227 syzkaller16.sh zonelimit issue 20210722 @@ -70,8 +71,8 @@ syzkaller59.sh Page fault 20220625 syzkaller65.sh panic: in_pcblookup_hash_locked: invalid local address 20230318 syzkaller66.sh panic: in_pcbconnect: inp is already connected 20230621 syzkaller67.sh panic: ASan: Invalid access, 8-byte read at ... 20230621 +quota6.sh https://people.freebsd.org/~pho/stress/log/log0456.txt 20240707 truss3.sh WiP 20200915 -unionfs19.sh https://people.freebsd.org/~pho/stress/log/log0519.txt 20240702 # Test not to run for other reasons: diff --git a/tools/test/stress2/misc/swapoff6.sh b/tools/test/stress2/misc/swapoff6.sh new file mode 100755 index 000000000000..b6ab08784f87 --- /dev/null +++ b/tools/test/stress2/misc/swapoff6.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# +# Copyright (c) 2024 Peter Holm +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# A swap test scenario, using swapoff(8) and sort(1) for VM pressure + +# Out of free pages seen:://people.freebsd.org/~pho/stress/log/log0540.txt + +. ../default.cfg +[ `id -u` -ne 0 ] && echo "Must be root!" && exit 1 + +[ `swapinfo | wc -l` -eq 1 ] && exit 0 +set -u +nmax=`sysctl -n hw.ncpu` +[ $nmax -gt 4 ] && nmax=4 + +for i in `jot $nmax`; do + timeout -k 2m 1m sort /dev/zero & + sleep .`jot -r 1 1 9` +done +while [ `swapinfo | tail -1 | awk '{sub("%","");print $NF}'` -lt 2 ]; do sleep 1; done + +start=`date +%s` +while [ $((`date +%s` - start)) -lt 300 ]; do + while ! swapoff -a > /dev/null 2>&1; do sleep .1; done + swapon -a > /dev/null + ncur=`pgrep sort | wc -l` + if [ $ncur -lt $nmax ]; then + echo "Starting $((nmax - ncur)) sort" + for i in `jot $((nmax - ncur))`; do + timeout -k 2m 1m sort /dev/zero & + sleep .`jot -r 1 1 9` + done + fi +done +pkill -9 sort +wait +exit 0