From cf6cd7336fd66ce3c0bbeb64f47630d6623eb89b Mon Sep 17 00:00:00 2001 From: Anders Roxell Date: Thu, 12 Sep 2024 15:04:21 +0200 Subject: [PATCH] automated: linux: peripheral: usb-gadget-framework: fix resutls Before the test restults was only: modprobe: pass dd: pass echo: pass Now the names is more descriptive after the 'slugify'. modprobe_dummy_hcd: pass dd_bs_1M_count_16_if__dev_zero_of__tmp_lun0.img: pass echo__tmp_lun0.img___functions_mass_storage.0_lun.0_file: pass echo_dummy_udc.0___UDC: pass Signed-off-by: Anders Roxell --- .../linux/peripherals/usb-gadget-framework.sh | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/automated/linux/peripherals/usb-gadget-framework.sh b/automated/linux/peripherals/usb-gadget-framework.sh index 1a2031806..4517dc124 100755 --- a/automated/linux/peripherals/usb-gadget-framework.sh +++ b/automated/linux/peripherals/usb-gadget-framework.sh @@ -17,9 +17,21 @@ info_msg "Output directory: ${OUTPUT}" # CONFIG_USB_DUMMY_HCD=m # CONFIG_USB_F_MASS_STORAGE=m -eval "modprobe dummy_hcd" -check_return "modprobe dummy_hcd" - +run_test() { + local input="${1}" + eval "${input}" + local ret=$? + # slugify + local output + output="$(echo "${input}" | sed 's|[-/> =]|_|g')" + if [ ${ret} -eq 0 ]; then + report_pass "${output}" + else + report_fail "${output}" + fi +} + +run_test "modprobe dummy_hcd" #Setup USB Gadget in ConfigFS mkdir /sys/kernel/config/usb_gadget/g1 cd /sys/kernel/config/usb_gadget/g1 || exit @@ -30,18 +42,15 @@ echo "0123456789" > strings/0x409/serialnumber echo "My Gadget" > strings/0x409/manufacturer echo "Test Device" > strings/0x409/product -eval "dd bs=1M count=16 if=/dev/zero of=/tmp/lun0.img" -check_return "dd bs=1M count=16 if=/dev/zero of=/tmp/lun0.img" +run_test "dd bs=1M count=16 if=/dev/zero of=/tmp/lun0.img" # Create function and configure endpoint (e.g., mass storage, serial) mkdir -p functions/mass_storage.0 -eval "echo /tmp/lun0.img > functions/mass_storage.0/lun.0/file" -check_return "echo /tmp/lun0.img > functions/mass_storage.0/lun.0/file" +run_test "echo /tmp/lun0.img > functions/mass_storage.0/lun.0/file" # Bind the gadget to the virtual controller mkdir configs/c.1 ln -s functions/mass_storage.0 configs/c.1/ -eval "echo dummy_udc.0 > UDC" -check_return "echo dummy_udc.0 > UDC" +run_test "echo dummy_udc.0 > UDC" cd - || exit