3 # test types can be passed on the command line:
5 # - control: any device can do this
6 # - out, in: out needs 'bulk sink' firmware, in needs 'bulk src'
7 # - iso-out, iso-in: out needs 'iso sink' firmware, in needs 'iso src'
8 # - halt: needs bulk sink+src, tests halt set/clear from host
9 # - unlink: needs bulk sink and/or src, test HCD unlink processing
10 # - loop: needs firmware that will buffer N transfers
12 # run it for hours, days, weeks.
16 # this default provides a steady test load for a bulk device
18 TYPES
='control out in'
19 #TYPES='control out in halt'
24 # - include unlink tests
25 # - add some ${RANDOM}ness
26 # - connect several devices concurrently (same HC)
27 # - keep HC's IRQ lines busy with unrelated traffic (IDE, net, ...)
28 # - add other concurrent system loads
31 declare -i COUNT BUFLEN
36 # NOTE: the 'in' and 'out' cases are usually bulk, but can be
37 # set up to use interrupt transfers by 'usbtest' module options
40 if [ "$DEVICE" = "" ]; then
41 echo "testing ALL recognized usbtest devices"
50 if ! .
/testusb
$TEST_ARGS -s $BUFLEN -c $COUNT $
* 2>/dev
/null
64 # FIXME use /sys/bus/usb/device/$THIS/bConfigurationValue to
65 # check and change configs
71 if [ "$CONFIG" = "" ]; then
73 echo "assuming $CONFIG configuration"
76 if [ "$CONFIG" = $1 ]; then
80 echo "** device must be in $1 config, but it's $CONFIG instead"
97 # FIXME automatically multiply COUNT by 10 when
98 # /sys/bus/usb/device/$THIS/speed == "480"
104 # any device, in any configuration, can use this.
105 echo '** Control test cases:'
107 echo "test 9: ch9 postconfig"
109 echo "test 10: control queueing"
110 do_test
-t 10 -c 5000
112 # this relies on some vendor-specific commands
113 echo "test 14: control writes"
114 do_test
-t 14 -c 15000 -s 256 -v 1
116 echo "test 21: control writes, unaligned"
117 do_test
-t 21 -c 100 -s 256 -v 1
122 check_config sink-src
123 echo '** Host Write (OUT) test cases:'
125 echo "test 1: $COUNT transfers, same size"
127 echo "test 3: $COUNT transfers, variable/short size"
131 echo "test 17: $COUNT transfers, unaligned DMA map by core"
134 echo "test 19: $COUNT transfers, unaligned DMA map by usb_alloc_coherent"
138 echo "test 5: $COUNT scatterlists, same size entries"
141 # try to trigger short OUT processing bugs
142 echo "test 7a: $COUNT scatterlists, variable size/short entries"
145 echo "test 7b: $COUNT scatterlists, variable size/bigger entries"
148 echo "test 7c: $COUNT scatterlists, variable size/micro entries"
153 check_config sink-src
154 echo '** Host ISOCHRONOUS Write (OUT) test cases:'
156 # at peak iso transfer rates:
157 # - usb 2.0 high bandwidth, this is one frame.
158 # - usb 1.1, it's twenty-four frames.
165 echo "test 15: $COUNT transfers, same size"
166 # do_test -t 15 -g 3 -v 0
168 do_test
-t 15 -g 8 -v 0
170 # FIXME it'd make sense to have an iso OUT test issuing
171 # short writes on more packets than the last one
174 echo "test 22: $COUNT transfers, non aligned"
175 do_test
-t 22 -g 8 -v 0
180 check_config sink-src
181 echo '** Host Read (IN) test cases:'
183 # NOTE: these "variable size" reads are just multiples
184 # of 512 bytes, no EOVERFLOW testing is done yet
186 echo "test 2: $COUNT transfers, same size"
188 echo "test 4: $COUNT transfers, variable size"
192 echo "test 18: $COUNT transfers, unaligned DMA map by core"
195 echo "test 20: $COUNT transfers, unaligned DMA map by usb_alloc_coherent"
199 echo "test 6: $COUNT scatterlists, same size entries"
201 echo "test 8: $COUNT scatterlists, variable size entries"
206 check_config sink-src
207 echo '** Host ISOCHRONOUS Read (IN) test cases:'
209 # at peak iso transfer rates:
210 # - usb 2.0 high bandwidth, this is one frame.
211 # - usb 1.1, it's twenty-four frames.
218 echo "test 16: $COUNT transfers, same size"
219 # do_test -t 16 -g 3 -v 0
221 do_test
-t 16 -g 8 -v 0
223 # FIXME since iso expects faults, it'd make sense
224 # to have an iso IN test issuing short reads ...
227 echo "test 23: $COUNT transfers, unaligned"
228 do_test
-t 23 -g 8 -v 0
233 # NOTE: sometimes hardware doesn't cooperate well with halting
234 # endpoints from the host side. so long as mass-storage class
235 # firmware can halt them from the device, don't worry much if
236 # you can't make this test work on your device.
238 echo "test 13: $COUNT halt set/clear"
244 echo "test 11: $COUNT read unlinks"
247 echo "test 12: $COUNT write unlinks"
252 # defaults need too much buffering for ez-usb devices
256 # modprobe g_zero qlen=$COUNT buflen=$BUFLEN loopdefault
257 check_config loopback
259 # FIXME someone needs to write and merge a version of this
261 echo "write $COUNT buffers of $BUFLEN bytes, read them back"
263 echo "write $COUNT variable size buffers, read them back"
268 echo "Don't understand test type $TYPE"