summaryrefslogtreecommitdiff
path: root/t/zbd/run-tests-against-zoned-nullb
blob: 0952011c576e04af1d5ffedaf4db5a58b40b36f7 (plain)
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
#!/bin/bash
#
# Copyright (C) 2018 Western Digital Corporation or its affiliates.
#
# This file is released under the GPL.

scriptdir="$(cd "$(dirname "$0")" && pwd)"

for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done
modprobe -r null_blk
modprobe null_blk nr_devices=0 || return $?
for d in /sys/kernel/config/nullb/*; do
    [ -d "$d" ] && rmdir "$d"
done
modprobe -r null_blk
[ -e /sys/module/null_blk ] && exit $?
modprobe null_blk nr_devices=0 &&
    cd /sys/kernel/config/nullb &&
    mkdir nullb0 &&
    cd nullb0 &&
    echo 1 > zoned &&
    echo 1 > zone_size &&
    echo 0 > completion_nsec &&
    echo 4096 > blocksize &&
    echo 1024 > size &&
    echo 1 > memory_backed &&
    echo 1 > power || exit $?

"${scriptdir}"/test-zbd-support "$@" /dev/nullb0