VSCode

VSCode is an excellent source code editor and IDE. It supports python and pytest with an offical extension: https://github.com/microsoft/vscode-python. We developed another extension for pynvme to make VSCode more friendly to SSD test.

Layout

vscode screenshot
  1. Activity Bar: you can select the last Test icon for pytest and pynvme extensions.

  2. pytest panel: collects all test files and cases in scripts directory.

  3. pynvme panel: displays all active qpairs in all controllers. Click qpair to open or refresh its cmdlog viewer. Click the icon in the upper right corner to open a performance gauge.

  4. editor: edit test scripts here.

  5. cmdlog viewer: displays the latest 128 commands and completion dwords in one qpair.

  6. log viewer: displays pytest log.

Setup

  1. First of all, install vscode here: https://code.visualstudio.com/

  2. Root user is not recommended in vscode, so just use your ordinary non-root user. It is required to configure the user account to run sudo without a password.

    sudo visudo
    
  3. In order to monitor qpairs status and cmdlog along the progress of testing, user can install vscode extension pynvme-console. The extension provides DUT status and cmdlogs in VSCode UI.

    code --install-extension pynvme-console-2.0.0.vsix
    
  4. Before start vscode, modify .vscode/settings.json with the correct pcie address (bus:device.function listed in lspci command) of your DUT device.

    lspci
    # 01:00.0 Non-Volatile memory controller: Lite-On Technology Corporation Device 2300 (rev 01)
    
  5. Then in pynvme folder, we can start vscode to edit, debug and run scripts:

    make setup; code .  # make sure to enable SPDK nvme driver before starting vscode
    
  6. Users can add their own script files under scripts directory. Import following packages in new test script files.

    import pytest
    import logging
    import nvme as d    # import pynvme's python package
    

Now, we can edit, debug and run test scripts in VSCode! It time to learn more pynvme features and build your own tests.