Re: [PATCH] nvme: add nvme pci timeout testcase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 10, 2024 at 11:58 AM Chaitanya Kulkarni <kch@xxxxxxxxxx> wrote:
>
> Trigger and test nvme-pci timeout with concurrent fio jobs.
>
> Signed-off-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
> ---
>  tests/nvme/050     | 43 +++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/050.out |  2 ++
>  2 files changed, 45 insertions(+)
>  create mode 100755 tests/nvme/050
>  create mode 100644 tests/nvme/050.out
>
> diff --git a/tests/nvme/050 b/tests/nvme/050
> new file mode 100755
> index 0000000..ba54bcd
> --- /dev/null
> +++ b/tests/nvme/050
> @@ -0,0 +1,43 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2024 Chaitanya Kulkarni.
> +#
> +# Test NVMe-PCI timeout with FIO jobs by triggering the nvme_timeout function.
> +#
> +
> +. tests/nvme/rc

How about restricting this test to pci only? just like nvme/032 did.
nvme_trtype=pci

> +
> +DESCRIPTION="test nvme-pci timeout with fio jobs."
> +
> +requires() {
> +       _require_nvme_trtype pci
> +       _have_fio
> +       _nvme_requires
> +}

Check the test dev is nvme:
device_requires() {
        _require_test_dev_is_nvme
}

> +
> +test() {

Use test_device() here.

> +       local dev="/dev/nvme0n1"
> +
> +       echo "Running ${TEST_NAME}"
> +
> +       echo 1 > /sys/block/nvme0n1/io-timeout-fail
> +
> +       echo 99 > /sys/kernel/debug/fail_io_timeout/probability
> +       echo 10 > /sys/kernel/debug/fail_io_timeout/interval
> +       echo -1 > /sys/kernel/debug/fail_io_timeout/times
> +       echo  0 > /sys/kernel/debug/fail_io_timeout/space
> +       echo  1 > /sys/kernel/debug/fail_io_timeout/verbose
> +
> +       # shellcheck disable=SC2046
> +       fio --bs=4k --rw=randread --norandommap --numjobs=$(nproc) \
> +           --name=reads --direct=1 --filename=${dev} --group_reporting \
> +           --time_based --runtime=1m 2>&1 | grep -q "Input/output error"
> +
> +       # shellcheck disable=SC2181
> +       if [ $? -eq 0 ]; then
> +               echo "Test complete"
> +       else
> +               echo "Test failed"
> +       fi
> +       modprobe -r nvme
> +}
> diff --git a/tests/nvme/050.out b/tests/nvme/050.out
> new file mode 100644
> index 0000000..b78b05f
> --- /dev/null
> +++ b/tests/nvme/050.out
> @@ -0,0 +1,2 @@
> +Running nvme/050
> +Test complete
> --
> 2.40.0
>
>


-- 
Best Regards,
  Yi Zhang






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux