tools/testing/selftests/drivers/usb/usbip/usbip_test.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/usb/usbip/usbip_test.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
Extension
.sh
Size
5972 bytes
Lines
201
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

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

usage() { echo "usbip_test.sh -b <busid> -p <usbip tools path>"; exit 1; }

while getopts "h:b:p:" arg; do
    case "${arg}" in
	h)
	    usage
	    ;;
	b)
	    busid=${OPTARG}
	    ;;
	p)
	    tools_path=${OPTARG}
	    ;;
	*)
	    usage
	    ;;
    esac
done
shift $((OPTIND-1))

if [ -z "${busid}" ]; then
	usage
fi

echo "Running USB over IP Testing on $busid";

test_end_msg="End of USB over IP Testing on $busid"

if [ $UID != 0 ]; then
	echo "Please run usbip_test as root [SKIP]"
	echo $test_end_msg
	exit $ksft_skip
fi

echo "Load usbip_host module"
if ! /sbin/modprobe -q -n usbip_host; then
	echo "usbip_test: module usbip_host is not found [SKIP]"
	echo $test_end_msg
	exit $ksft_skip
fi

if /sbin/modprobe -q usbip_host; then
	echo "usbip_test: module usbip_host is loaded [OK]"
else
	echo "usbip_test: module usbip_host failed to load [FAIL]"
	echo $test_end_msg
	exit 1
fi

echo "Load vhci_hcd module"
if /sbin/modprobe -q vhci_hcd; then
	echo "usbip_test: module vhci_hcd is loaded [OK]"
else
	echo "usbip_test: module vhci_hcd failed to load [FAIL]"
	echo $test_end_msg
	exit 1
fi
echo "=============================================================="

cd $tools_path;

if [ ! -f src/usbip ]; then
	echo "Please build usbip tools"
	echo $test_end_msg

Annotation

Implementation Notes