File: zfs-test-suite

package info (click to toggle)
zfs-linux 2.3.4~git20250812.3b64a96-1
  • links: PTS, VCS
  • area: contrib
  • in suites: experimental
  • size: 70,688 kB
  • sloc: ansic: 393,668; sh: 68,068; asm: 47,734; python: 8,160; makefile: 5,125; perl: 859; sed: 41
file content (40 lines) | stat: -rwxr-xr-x 1,192 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
set -e
testuser="testrunner"

TEST_LIST="$1"
if [ -z "$TEST_LIST" ]; then
    TEST_LIST_PARAM=""
    echo "No list given, will run all tests."
else
    TEST_LIST_PARAM="-T $TEST_LIST"
    echo "Running tests: $TEST_LIST"
fi

grep -q "^KillUserProcesses=yes$" /etc/systemd/logind.conf || echo "KillUserProcesses=yes" >>/etc/systemd/logind.conf
systemctl restart systemd-logind.service

if testuid=$(id -u $testuser 2>/dev/null) ; then
    systemctl stop user-$testuid.slice
else
    useradd -m ${testuser}
fi

echo "${testuser} ALL=(root:root) NOPASSWD:ALL" >/etc/sudoers.d/zfs-${testuser}

modprobe zfs
zfs unmount -a -f
sleep 1
zpool export -a

losetup -D
systemctl stop zfs-zed.service nfs-blkmap.service nfs-server.service nfs-client.target nfs-idmapd.service nfs-mountd.service || true
rm -f /etc/hostid

# We delibrately use a persistent temporary directory here
# to prevent the tests from using too much memory.
testdir="$(mktemp -d --tmpdir=/var/tmp --suffix=-zfs-tests)"
chown ${testuser}:${testuser} $testdir
chmod 0775 $testdir

setpriv --reset-env --init-groups --reuid ${testuser} --regid ${testuser} /usr/share/zfs/zfs-tests.sh -vKR -s 3G $TEST_LIST_PARAM -d $testdir