Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using "New USB device found" for all usbs (BugFix) #1480

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

fernando79513
Copy link
Collaborator

Description

Currently, we only are reading the "uas" string to detect the insertion of an USB 3.0 device. This may cause some wrong detections if we have some other journalctl messages.
This PR changes that string for detection to "New USB device found", which can be used for all USB types.

Resolved issues

N/A

Documentation

N/A

Tests

Tested with usb2 usb3 and usb-c in a 22.04 laptop

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.10%. Comparing base (3ba7e2c) to head (3de2c38).
Report is 126 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1480   +/-   ##
=======================================
  Coverage   47.10%   47.10%           
=======================================
  Files         368      368           
  Lines       39435    39435           
  Branches     6667     6667           
=======================================
  Hits        18574    18574           
  Misses      20156    20156           
  Partials      705      705           
Flag Coverage Δ
checkbox-support 60.37% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fernando79513 fernando79513 changed the title Using "New USB device found" for all usbs Using "New USB device found" for all usbs (BugFix) Sep 17, 2024
@eugene-yujinwu
Copy link
Contributor

Test with our USB3.2 disk, replaced with:
# Look for insertion action
#if "USB Mass Storage device detected" in line_str or "uas" in line_str:
if "New USB device found" in line_str:
self.action = "insertion"
print("line_str:",line_str)

The test report:
==============[ Running job 3 / 3. Estimated time left: 0:02:00 ]===============
-[ USB 3.0 storage device insertion + read/write + removal on USB Type-C port ]-
ID: com.canonical.certification::usb-c/storage-manual
Category: com.canonical.plainbox::usb
Purpose:

This test will check that the system correctly detects the insertion of
a USB 3.0 storage device in a USB Type-C connector.
Then it performs a read and write test on the device. Finally, it
checks that the system correctly detects the removal of the USB 3 storage.
NOTE: Make sure the USB 3 storage device has a partition before starting
the test.

Steps:

  1. Commence the test and then insert a USB 3.0 storage device to a USB Type-C port.
    (Note: this test will time-out after 30 seconds.)
  2. Do not remove the device after this test.
  3. Wait for the read/write operations to complete.
  4. Press Enter to start the removal test.
  5. Remove the USB 3 storage from the reader.
    (Note: this test will time-out after 30 seconds.)

Pick an action
=> press ENTER to continue
c => add a comment
s => skip this job
q => save the session and quit
[csq]:
... 8< -------------------------------------------------------------------------

--------- Testing insertion ---------

INSERT NOW

Timeout: 30 seconds
line_str: usb 4-3: New USB device found, idVendor=2109, idProduct=0715, bcdDevice= 0.00
INFO:super_speed_plus_gen2x1_usb was inserted. Controller: xhci_hcd, Number: 40
INFO:usable partition: sda1
INFO:USB3 insertion test passed.

------- Insertion test passed -------

--------- Testing read/write --------
DEBUG:generating a random file
Mounting the USB storage
sda1
DEBUG:try to mount usb storage for testing
DEBUG:mount /dev/sda1 on /tmp/tmp7di7slka successfully.
DEBUG:===================
DEBUG:writing test begins
DEBUG:===================
DEBUG:Apply command: ['dd', 'if=/tmp/tmp__1q525i', 'of=/tmp/tmp7di7slka/tmp__1q525i0', 'bs=1M', 'oflag=sync']
DEBUG:['100+1 records in', '100+1 records out', '104858730 bytes (105 MB, 100 MiB) copied, 1.67893 s, 62.5 MB/s', '']
DEBUG:No I/O errors found in dmesg
PASS: WRITING TEST: /tmp/tmp7di7slka/tmp__1q525i0
DEBUG:Apply command: ['dd', 'if=/tmp/tmp__1q525i', 'of=/tmp/tmp7di7slka/tmp__1q525i1', 'bs=1M', 'oflag=sync']
DEBUG:['100+1 records in', '100+1 records out', '104858730 bytes (105 MB, 100 MiB) copied, 0.8055 s, 130 MB/s', '']
DEBUG:No I/O errors found in dmesg
PASS: WRITING TEST: /tmp/tmp7di7slka/tmp__1q525i1
DEBUG:Apply command: ['dd', 'if=/tmp/tmp__1q525i', 'of=/tmp/tmp7di7slka/tmp__1q525i2', 'bs=1M', 'oflag=sync']
DEBUG:['100+1 records in', '100+1 records out', '104858730 bytes (105 MB, 100 MiB) copied, 0.772011 s, 136 MB/s', '']
DEBUG:No I/O errors found in dmesg
PASS: WRITING TEST: /tmp/tmp7di7slka/tmp__1q525i2
DEBUG:Apply command: ['dd', 'if=/tmp/tmp__1q525i', 'of=/tmp/tmp7di7slka/tmp__1q525i3', 'bs=1M', 'oflag=sync']
DEBUG:['100+1 records in', '100+1 records out', '104858730 bytes (105 MB, 100 MiB) copied, 0.801401 s, 131 MB/s', '']
DEBUG:No I/O errors found in dmesg
PASS: WRITING TEST: /tmp/tmp7di7slka/tmp__1q525i3
DEBUG:Apply command: ['dd', 'if=/tmp/tmp__1q525i', 'of=/tmp/tmp7di7slka/tmp__1q525i4', 'bs=1M', 'oflag=sync']
DEBUG:['100+1 records in', '100+1 records out', '104858730 bytes (105 MB, 100 MiB) copied, 0.80516 s, 130 MB/s', '']
DEBUG:No I/O errors found in dmesg
PASS: WRITING TEST: /tmp/tmp7di7slka/tmp__1q525i4
Average writing speed is: 117.900 MB/s (5x100.0 MB files were written)
DEBUG:===================
DEBUG:reading test begins
DEBUG:===================
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp7di7slka/tmp__1q525i0 (verified)
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp__1q525i (source)
PASS: READING TEST: /tmp/tmp7di7slka/tmp__1q525i0 passes md5sum comparison.
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp7di7slka/tmp__1q525i1 (verified)
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp__1q525i (source)
PASS: READING TEST: /tmp/tmp7di7slka/tmp__1q525i1 passes md5sum comparison.
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp7di7slka/tmp__1q525i2 (verified)
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp__1q525i (source)
PASS: READING TEST: /tmp/tmp7di7slka/tmp__1q525i2 passes md5sum comparison.
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp7di7slka/tmp__1q525i3 (verified)
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp__1q525i (source)
PASS: READING TEST: /tmp/tmp7di7slka/tmp__1q525i3 passes md5sum comparison.
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp7di7slka/tmp__1q525i4 (verified)
DEBUG:40edf939f34b92b601f74245e6ed55de /tmp/tmp__1q525i (source)
PASS: READING TEST: /tmp/tmp7di7slka/tmp__1q525i4 passes md5sum comparison.
PASS: all reading tests passed.
INFO:context manager exit: unmount USB storage
INFO:umount /tmp/tmp7di7slka successfully.
INFO:Remove temporary folders and files.

------- Read/Write test passed -------
Press Enter to start removal

---------- Testing removal ----------

REMOVE NOW

Timeout: 30 seconds
INFO:Removal test passed.

-------- Removal test passed --------
------------------------------------------------------------------------- >8 ---
Outcome: job passed
Finalizing session that hasn't been submitted anywhere: checkbox-run-2024-09-19T06.02.10
==================================[ Results ]===================================
☑ : Hardware Manifest
☑ : Collect information about supported types of USB
☑ : USB 3.0 storage device insertion + read/write + removal on USB Type-C port

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have a more unified way to test these!

I'm wondering if we should have some kind of integration test using real samples from existing kernels to make sure things don't break if we modify this test in the future, but I guess that's a wish more than something that's required for this to land.

+1

@fernando79513 fernando79513 merged commit 536b5df into main Sep 27, 2024
42 of 43 checks passed
@fernando79513 fernando79513 deleted the remove-uas-string-for-usb32 branch September 27, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants