Re: [PATCH 2/6] tests/nvme: add new test for rand-read on the nvme character device

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

 



On Wed, Dec 21, 2022 at 02:34:37AM -0800, Luis Chamberlain wrote:
> This does basic rand-read testing of the character device of a
> conventional NVMe drive.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
> ---
>  tests/nvme/046     | 42 ++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/046.out |  2 ++
>  2 files changed, 44 insertions(+)
>  create mode 100755 tests/nvme/046
>  create mode 100644 tests/nvme/046.out
> 
> diff --git a/tests/nvme/046 b/tests/nvme/046
> new file mode 100755
> index 000000000000..3526ab9eedab
> --- /dev/null
> +++ b/tests/nvme/046
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2022 Luis Chamberlain <mcgrof@xxxxxxxxxx>
> +#
> +# This does basic sanity test for the nvme character device. This is a basic
> +# test and if it fails it is probably very likely other nvme character device
> +# tests would fail.
> +#
> +. tests/nvme/rc
> +
> +DESCRIPTION="basic rand-read io_uring_cmd engine for nvme-ns character device"
> +QUICK=1
> +
> +requires() {
> +	_nvme_requires
> +	_have_fio
> +}
> +
> +device_requires() {
> +	_require_test_dev_is_nvme
> +}
> +
> +test_device() {
> +	echo "Running ${TEST_NAME}"
> +	local ngdev=${TEST_DEV/nvme/ng}
> +	local fio_args=(
> +		--size=1M
> +		--cmd_type=nvme
> +		--filename="$ngdev"
> +		--time_based
> +		--runtime=10
> +	) &&
> +	_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" 2>&1 ||
> +	fail=true
> +
> +	if [ -z "$fail" ]; then
> +		echo "Test complete"
> +	else
> +		echo "Test failed"
> +		return 1
> +	fi
I see that several test have this structure, but would it not be better
to do:

"""
if [ -n "$fail" ]; then
  echo "Test failed"
  return 1
fi

return "Test complete"
"""

I point this out because I noticed that most nvme tests just set the
"test complete" string at the end of the test function.

> +}
> diff --git a/tests/nvme/046.out b/tests/nvme/046.out
> new file mode 100644
> index 000000000000..2b5fa6af63b1
> --- /dev/null
> +++ b/tests/nvme/046.out
> @@ -0,0 +1,2 @@
> +Running nvme/046
> +Test complete
> -- 
> 2.35.1
> 

Attachment: signature.asc
Description: PGP signature


[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