tests
Directory actions
More options
Directory actions
More options
tests
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
# SPDX-License-Identifier: GPL-2.0-or-later
nvmetests
=========
This contains a NVMe tests framework. The purpose of this framework
to use nvme cli and test various supported commands and scenarios for
NVMe device.
In current implementation this framework uses nvme-cli to
interact with underlying controller/namespace.
Note these tests expect to run against real hardware and will
read and write data to /dev/nvme0!
DO NOT RUN THEM IF YOU DO NOT KNOW WHAT YOU ARE DOING!
You have been warned.
.
Walk-Through Example for writing a new testcase
-----------------------------------------------
1. Copy simple test template file from current directory
with appropriate name, replace "simple_template" with testcase name
in new file name. Update config.json if necessary.
2. Write a testcase main function, make sure its name is starting with
test_*.
3. Based on the requirement one can inherit TestNVMe or TestNVMeIO
class.
4. Write test precondition code into setUp. Make sure you are calling
super class setUp.
5. Write test post condition code into tearDown. Make sure you are calling
super class tearDown.
6. Before writing a new function have a look into TestNVMe to see if it
can be reused.
7. Once testcase is ready make sure :-
a. Run flake8, mypy, autopep8 and isort on the testcase and fix
errors/warnings.
- Example "$ ninja -C .build lint-python" will run flake8 and
mypy on all the python files in current directory.
- Example "$ ninja -C .build format-python" will run autopep8 and
isort on all the python files in the current directory.
Running testcases with framework
--------------------------------
1. Running single testcase :-
$ python3 tests/tap_runner.py --start-dir tests nvme_id_ctrl_test
$ meson test -C .build 'nvme-cli - nvme_id_ctrl_test'
2. Running all the testcases (in the build root directory) :-
$ meson test -C .build