~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/usb/hcd-tests.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/usb/hcd-tests.sh (Version linux-6.12-rc7) and /tools/usb/hcd-tests.sh (Version linux-3.10.108)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0             << 
  3 #                                                   2 #
  4 # test types can be passed on the command line      3 # test types can be passed on the command line:
  5 #                                                   4 #
  6 # - control: any device can do this                 5 # - control: any device can do this
  7 # - out, in:  out needs 'bulk sink' firmware,       6 # - out, in:  out needs 'bulk sink' firmware, in needs 'bulk src'
  8 # - iso-out, iso-in:  out needs 'iso sink' fir      7 # - iso-out, iso-in:  out needs 'iso sink' firmware, in needs 'iso src'
  9 # - halt: needs bulk sink+src, tests halt set/      8 # - halt: needs bulk sink+src, tests halt set/clear from host
 10 # - unlink: needs bulk sink and/or src, test H      9 # - unlink: needs bulk sink and/or src, test HCD unlink processing
 11 # - loop: needs firmware that will buffer N tr     10 # - loop: needs firmware that will buffer N transfers
 12 #                                                  11 #
 13 # run it for hours, days, weeks.                   12 # run it for hours, days, weeks.
 14 #                                                  13 #
 15                                                    14 
 16 #                                                  15 #
 17 # this default provides a steady test load for     16 # this default provides a steady test load for a bulk device
 18 #                                                  17 #
 19 TYPES='control out in'                             18 TYPES='control out in'
 20 #TYPES='control out in halt'                       19 #TYPES='control out in halt'
 21                                                    20 
 22 #                                                  21 #
 23 # to test HCD code                                 22 # to test HCD code
 24 #                                                  23 #
 25 #  - include unlink tests                          24 #  - include unlink tests
 26 #  - add some ${RANDOM}ness                        25 #  - add some ${RANDOM}ness
 27 #  - connect several devices concurrently (sam     26 #  - connect several devices concurrently (same HC)
 28 #  - keep HC's IRQ lines busy with unrelated t     27 #  - keep HC's IRQ lines busy with unrelated traffic (IDE, net, ...)
 29 #  - add other concurrent system loads             28 #  - add other concurrent system loads
 30 #                                                  29 #
 31                                                    30 
 32 declare -i COUNT BUFLEN                            31 declare -i COUNT BUFLEN
 33                                                    32 
 34 COUNT=50000                                        33 COUNT=50000
 35 BUFLEN=2048                                        34 BUFLEN=2048
 36                                                    35 
 37 # NOTE:  the 'in' and 'out' cases are usually      36 # NOTE:  the 'in' and 'out' cases are usually bulk, but can be
 38 # set up to use interrupt transfers by 'usbtes     37 # set up to use interrupt transfers by 'usbtest' module options
 39                                                    38 
 40                                                    39 
 41 if [ "$DEVICE" = "" ]; then                        40 if [ "$DEVICE" = "" ]; then
 42         echo "testing ALL recognized usbtest d     41         echo "testing ALL recognized usbtest devices"
 43         echo ""                                    42         echo ""
 44         TEST_ARGS="-a"                             43         TEST_ARGS="-a"
 45 else                                               44 else
 46         TEST_ARGS=""                               45         TEST_ARGS=""
 47 fi                                                 46 fi
 48                                                    47 
 49 do_test ()                                         48 do_test ()
 50 {                                                  49 {
 51     if ! ./testusb $TEST_ARGS -s $BUFLEN -c $C     50     if ! ./testusb $TEST_ARGS -s $BUFLEN -c $COUNT $* 2>/dev/null
 52     then                                           51     then
 53         echo "FAIL"                                52         echo "FAIL"
 54         exit 1                                     53         exit 1
 55     fi                                             54     fi
 56 }                                                  55 }
 57                                                    56 
 58 ARGS="$*"                                          57 ARGS="$*"
 59                                                    58 
 60 if [ "$ARGS" = "" ];                               59 if [ "$ARGS" = "" ];
 61 then                                               60 then
 62     ARGS="$TYPES"                                  61     ARGS="$TYPES"
 63 fi                                                 62 fi
 64                                                    63 
 65 # FIXME use /sys/bus/usb/device/$THIS/bConfigu     64 # FIXME use /sys/bus/usb/device/$THIS/bConfigurationValue to
 66 # check and change configs                         65 # check and change configs
 67                                                    66 
 68 CONFIG=''                                          67 CONFIG=''
 69                                                    68 
 70 check_config ()                                    69 check_config ()
 71 {                                                  70 {
 72     if [ "$CONFIG" = "" ]; then                    71     if [ "$CONFIG" = "" ]; then
 73         CONFIG=$1                                  72         CONFIG=$1
 74         echo "assuming $CONFIG configuration"      73         echo "assuming $CONFIG configuration"
 75         return                                     74         return
 76     fi                                             75     fi
 77     if [ "$CONFIG" = $1 ]; then                    76     if [ "$CONFIG" = $1 ]; then
 78         return                                     77         return
 79     fi                                             78     fi
 80                                                    79 
 81     echo "** device must be in $1 config, but      80     echo "** device must be in $1 config, but it's $CONFIG instead"
 82     exit 1                                         81     exit 1
 83 }                                                  82 }
 84                                                    83 
 85                                                    84 
 86 echo "TESTING:  $ARGS"                             85 echo "TESTING:  $ARGS"
 87                                                    86 
 88 while : true                                       87 while : true
 89 do                                                 88 do
 90     echo $(date)                                   89     echo $(date)
 91                                                    90 
 92     for TYPE in $ARGS                              91     for TYPE in $ARGS
 93     do                                             92     do
 94         # restore defaults                         93         # restore defaults
 95         COUNT=5000                                 94         COUNT=5000
 96         BUFLEN=2048                                95         BUFLEN=2048
 97                                                    96 
 98         # FIXME automatically multiply COUNT b     97         # FIXME automatically multiply COUNT by 10 when
 99         # /sys/bus/usb/device/$THIS/speed == "     98         # /sys/bus/usb/device/$THIS/speed == "480"
100                                                    99 
101 #       COUNT=50000                               100 #       COUNT=50000
102                                                   101 
103         case $TYPE in                             102         case $TYPE in
104         control)                                  103         control)
105             # any device, in any configuration    104             # any device, in any configuration, can use this.
106             echo '** Control test cases:'         105             echo '** Control test cases:'
107                                                   106 
108             echo "test 9: ch9 postconfig"         107             echo "test 9: ch9 postconfig"
109             do_test -t 9 -c 5000                  108             do_test -t 9 -c 5000
110             echo "test 10: control queueing"      109             echo "test 10: control queueing"
111             do_test -t 10 -c 5000                 110             do_test -t 10 -c 5000
112                                                   111 
113             # this relies on some vendor-speci    112             # this relies on some vendor-specific commands
114             echo "test 14: control writes"        113             echo "test 14: control writes"
115             do_test -t 14 -c 15000 -s 256 -v 1    114             do_test -t 14 -c 15000 -s 256 -v 1
116                                                   115 
117             echo "test 21: control writes, una    116             echo "test 21: control writes, unaligned"
118             do_test -t 21 -c 100 -s 256 -v 1      117             do_test -t 21 -c 100 -s 256 -v 1
119                                                   118 
120             ;;                                    119             ;;
121                                                   120 
122         out)                                      121         out)
123             check_config sink-src                 122             check_config sink-src
124             echo '** Host Write (OUT) test cas    123             echo '** Host Write (OUT) test cases:'
125                                                   124 
126             echo "test 1: $COUNT transfers, sa    125             echo "test 1: $COUNT transfers, same size"
127             do_test -t 1                          126             do_test -t 1
128             echo "test 3: $COUNT transfers, va    127             echo "test 3: $COUNT transfers, variable/short size"
129             do_test -t 3 -v 421                   128             do_test -t 3 -v 421
130                                                   129 
131             COUNT=100                             130             COUNT=100
132             echo "test 17: $COUNT transfers, u    131             echo "test 17: $COUNT transfers, unaligned DMA map by core"
133             do_test -t 17                         132             do_test -t 17
134                                                   133 
135             echo "test 19: $COUNT transfers, u    134             echo "test 19: $COUNT transfers, unaligned DMA map by usb_alloc_coherent"
136             do_test -t 19                         135             do_test -t 19
137                                                   136 
138             COUNT=2000                            137             COUNT=2000
139             echo "test 5: $COUNT scatterlists,    138             echo "test 5: $COUNT scatterlists, same size entries"
140             do_test -t 5                          139             do_test -t 5
141                                                   140 
142             # try to trigger short OUT process    141             # try to trigger short OUT processing bugs
143             echo "test 7a: $COUNT scatterlists    142             echo "test 7a: $COUNT scatterlists, variable size/short entries"
144             do_test -t 7 -v 579                   143             do_test -t 7 -v 579
145             BUFLEN=4096                           144             BUFLEN=4096
146             echo "test 7b: $COUNT scatterlists    145             echo "test 7b: $COUNT scatterlists, variable size/bigger entries"
147             do_test -t 7 -v 41                    146             do_test -t 7 -v 41
148             BUFLEN=64                             147             BUFLEN=64
149             echo "test 7c: $COUNT scatterlists    148             echo "test 7c: $COUNT scatterlists, variable size/micro entries"
150             do_test -t 7 -v 63                    149             do_test -t 7 -v 63
151             ;;                                    150             ;;
152                                                   151 
153         iso-out)                                  152         iso-out)
154             check_config sink-src                 153             check_config sink-src
155             echo '** Host ISOCHRONOUS Write (O    154             echo '** Host ISOCHRONOUS Write (OUT) test cases:'
156                                                   155 
157             # at peak iso transfer rates:         156             # at peak iso transfer rates:
158             # - usb 2.0 high bandwidth, this i    157             # - usb 2.0 high bandwidth, this is one frame.
159             # - usb 1.1, it's twenty-four fram    158             # - usb 1.1, it's twenty-four frames.
160             BUFLEN=24500                          159             BUFLEN=24500
161                                                   160 
162             COUNT=1000                            161             COUNT=1000
163                                                   162 
164 # COUNT=10000                                     163 # COUNT=10000
165                                                   164 
166             echo "test 15: $COUNT transfers, s    165             echo "test 15: $COUNT transfers, same size"
167             # do_test -t 15 -g 3 -v 0             166             # do_test -t 15 -g 3 -v 0
168             BUFLEN=32768                          167             BUFLEN=32768
169             do_test -t 15 -g 8 -v 0               168             do_test -t 15 -g 8 -v 0
170                                                   169 
171             # FIXME it'd make sense to have an    170             # FIXME it'd make sense to have an iso OUT test issuing
172             # short writes on more packets tha    171             # short writes on more packets than the last one
173                                                   172 
174             COUNT=100                             173             COUNT=100
175             echo "test 22: $COUNT transfers, n    174             echo "test 22: $COUNT transfers, non aligned"
176             do_test -t 22 -g 8 -v 0               175             do_test -t 22 -g 8 -v 0
177                                                   176 
178             ;;                                    177             ;;
179                                                   178 
180         in)                                       179         in)
181             check_config sink-src                 180             check_config sink-src
182             echo '** Host Read (IN) test cases    181             echo '** Host Read (IN) test cases:'
183                                                   182 
184             # NOTE:  these "variable size" rea    183             # NOTE:  these "variable size" reads are just multiples
185             # of 512 bytes, no EOVERFLOW testi    184             # of 512 bytes, no EOVERFLOW testing is done yet
186                                                   185 
187             echo "test 2: $COUNT transfers, sa    186             echo "test 2: $COUNT transfers, same size"
188             do_test -t 2                          187             do_test -t 2
189             echo "test 4: $COUNT transfers, va    188             echo "test 4: $COUNT transfers, variable size"
190             do_test -t 4                          189             do_test -t 4
191                                                   190 
192             COUNT=100                             191             COUNT=100
193             echo "test 18: $COUNT transfers, u    192             echo "test 18: $COUNT transfers, unaligned DMA map by core"
194             do_test -t 18                         193             do_test -t 18
195                                                   194 
196             echo "test 20: $COUNT transfers, u    195             echo "test 20: $COUNT transfers, unaligned DMA map by usb_alloc_coherent"
197             do_test -t 20                         196             do_test -t 20
198                                                   197 
199             COUNT=2000                            198             COUNT=2000
200             echo "test 6: $COUNT scatterlists,    199             echo "test 6: $COUNT scatterlists, same size entries"
201             do_test -t 6                          200             do_test -t 6
202             echo "test 8: $COUNT scatterlists,    201             echo "test 8: $COUNT scatterlists, variable size entries"
203             do_test -t 8                          202             do_test -t 8
204             ;;                                    203             ;;
205                                                   204 
206         iso-in)                                   205         iso-in)
207             check_config sink-src                 206             check_config sink-src
208             echo '** Host ISOCHRONOUS Read (IN    207             echo '** Host ISOCHRONOUS Read (IN) test cases:'
209                                                   208 
210             # at peak iso transfer rates:         209             # at peak iso transfer rates:
211             # - usb 2.0 high bandwidth, this i    210             # - usb 2.0 high bandwidth, this is one frame.
212             # - usb 1.1, it's twenty-four fram    211             # - usb 1.1, it's twenty-four frames.
213             BUFLEN=24500                          212             BUFLEN=24500
214                                                   213 
215             COUNT=1000                            214             COUNT=1000
216                                                   215 
217 # COUNT=10000                                     216 # COUNT=10000
218                                                   217 
219             echo "test 16: $COUNT transfers, s    218             echo "test 16: $COUNT transfers, same size"
220             # do_test -t 16 -g 3 -v 0             219             # do_test -t 16 -g 3 -v 0
221             BUFLEN=32768                          220             BUFLEN=32768
222             do_test -t 16 -g 8 -v 0               221             do_test -t 16 -g 8 -v 0
223                                                   222 
224             # FIXME since iso expects faults,     223             # FIXME since iso expects faults, it'd make sense
225             # to have an iso IN test issuing s    224             # to have an iso IN test issuing short reads ...
226                                                   225 
227             COUNT=100                             226             COUNT=100
228             echo "test 23: $COUNT transfers, u    227             echo "test 23: $COUNT transfers, unaligned"
229             do_test -t 23 -g 8 -v 0               228             do_test -t 23 -g 8 -v 0
230                                                   229 
231             ;;                                    230             ;;
232                                                   231 
233         halt)                                     232         halt)
234             # NOTE:  sometimes hardware doesn'    233             # NOTE:  sometimes hardware doesn't cooperate well with halting
235             # endpoints from the host side.  s    234             # endpoints from the host side.  so long as mass-storage class
236             # firmware can halt them from the     235             # firmware can halt them from the device, don't worry much if
237             # you can't make this test work on    236             # you can't make this test work on your device.
238             COUNT=2000                            237             COUNT=2000
239             echo "test 13: $COUNT halt set/cle    238             echo "test 13: $COUNT halt set/clear"
240             do_test -t 13                         239             do_test -t 13
241             ;;                                    240             ;;
242                                                   241 
243         unlink)                                   242         unlink)
244             COUNT=2000                            243             COUNT=2000
245             echo "test 11: $COUNT read unlinks    244             echo "test 11: $COUNT read unlinks"
246             do_test -t 11                         245             do_test -t 11
247                                                   246 
248             echo "test 12: $COUNT write unlink    247             echo "test 12: $COUNT write unlinks"
249             do_test -t 12                         248             do_test -t 12
250             ;;                                    249             ;;
251                                                   250 
252         loop)                                     251         loop)
253             # defaults need too much buffering    252             # defaults need too much buffering for ez-usb devices
254             BUFLEN=2048                           253             BUFLEN=2048
255             COUNT=32                              254             COUNT=32
256                                                   255 
257             # modprobe g_zero qlen=$COUNT bufl    256             # modprobe g_zero qlen=$COUNT buflen=$BUFLEN loopdefault
258             check_config loopback                 257             check_config loopback
259                                                   258 
260             # FIXME someone needs to write and    259             # FIXME someone needs to write and merge a version of this
261                                                   260 
262             echo "write $COUNT buffers of $BUF    261             echo "write $COUNT buffers of $BUFLEN bytes, read them back"
263                                                   262 
264             echo "write $COUNT variable size b    263             echo "write $COUNT variable size buffers, read them back"
265                                                   264 
266             ;;                                    265             ;;
267                                                   266 
268         *)                                        267         *)
269             echo "Don't understand test type $    268             echo "Don't understand test type $TYPE"
270             exit 1;                               269             exit 1;
271         esac                                      270         esac
272         echo ''                                   271         echo ''
273     done                                          272     done
274 done                                              273 done
                                                   >> 274 
                                                   >> 275 # vim: sw=4
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php