tools/hv/vmbus_testing

Source file repositories/reference/linux-study-clean/tools/hv/vmbus_testing

File Facts

System
Linux kernel
Corpus path
tools/hv/vmbus_testing
Extension
[no extension]
Size
16460 bytes
Lines
377
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
#
# Program to allow users to fuzz test Hyper-V drivers
# by interfacing with Hyper-V debugfs attributes.
# Current test methods available:
#       1. delay testing
#
# Current file/directory structure of hyper-V debugfs:
#       /sys/kernel/debug/hyperv/UUID
#       /sys/kernel/debug/hyperv/UUID/<test-state filename>
#       /sys/kernel/debug/hyperv/UUID/<test-method sub-directory>
#
# author: Branden Bonaby <brandonbonaby94@gmail.com>

import os
import cmd
import argparse
import glob
from argparse import RawDescriptionHelpFormatter
from argparse import RawTextHelpFormatter
from enum import Enum

# Do not change unless, you change the debugfs attributes
# in /drivers/hv/debugfs.c. All fuzz testing
# attributes will start with "fuzz_test".

# debugfs path for hyperv must exist before proceeding
debugfs_hyperv_path = "/sys/kernel/debug/hyperv"
if not os.path.isdir(debugfs_hyperv_path):
        print("{} doesn't exist/check permissions".format(debugfs_hyperv_path))
        exit(-1)

class dev_state(Enum):
        off = 0
        on = 1

# File names, that correspond to the files created in
# /drivers/hv/debugfs.c
class f_names(Enum):
        state_f = "fuzz_test_state"
        buff_f =  "fuzz_test_buffer_interrupt_delay"
        mess_f =  "fuzz_test_message_delay"

# Both single_actions and all_actions are used
# for error checking and to allow for some subparser
# names to be abbreviated. Do not abbreviate the
# test method names, as it will become less intuitive
# as to what the user can do. If you do decide to
# abbreviate the test method name, make sure the main
# function reflects this change.

all_actions = [
        "disable_all",
        "D",
        "enable_all",
        "view_all",
        "V"
]

single_actions = [
        "disable_single",
        "d",
        "enable_single",
        "view_single",
        "v"
]

def main():

Annotation

Implementation Notes