1 #!/bin/bash 1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 2 # SPDX-License-Identifier: GPL-2.0 3 # This validates that the kernel will load fir 3 # This validates that the kernel will load firmware out of its list of 4 # firmware locations on disk. Since the user h 4 # firmware locations on disk. Since the user helper does similar work, 5 # we reset the custom load directory to a loca 5 # we reset the custom load directory to a location the user helper doesn't 6 # know so we can be sure we're not accidentall 6 # know so we can be sure we're not accidentally testing the user helper. 7 set -e 7 set -e 8 8 9 TEST_REQS_FW_SYSFS_FALLBACK="no" 9 TEST_REQS_FW_SYSFS_FALLBACK="no" 10 TEST_REQS_FW_SET_CUSTOM_PATH="yes" 10 TEST_REQS_FW_SET_CUSTOM_PATH="yes" 11 TEST_DIR=$(dirname $0) 11 TEST_DIR=$(dirname $0) 12 source $TEST_DIR/fw_lib.sh 12 source $TEST_DIR/fw_lib.sh 13 13 14 RUN_XZ="xz -C crc32 --lzma2=dict=2MiB" << 15 RUN_ZSTD="zstd -q" << 16 << 17 check_mods 14 check_mods 18 check_setup 15 check_setup 19 verify_reqs 16 verify_reqs 20 setup_tmp_file 17 setup_tmp_file 21 18 22 trap "test_finish" EXIT 19 trap "test_finish" EXIT 23 20 24 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; t 21 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then 25 # Turn down the timeout so failures do 22 # Turn down the timeout so failures don't take so long. 26 echo 1 >/sys/class/firmware/timeout 23 echo 1 >/sys/class/firmware/timeout 27 fi 24 fi 28 25 29 if printf '\000' >"$DIR"/trigger_request 2> /d 26 if printf '\000' >"$DIR"/trigger_request 2> /dev/null; then 30 echo "$0: empty filename should not su 27 echo "$0: empty filename should not succeed" >&2 31 exit 1 28 exit 1 32 fi 29 fi 33 30 34 if [ ! -e "$DIR"/trigger_async_request ]; then 31 if [ ! -e "$DIR"/trigger_async_request ]; then 35 echo "$0: empty filename: async trigge 32 echo "$0: empty filename: async trigger not present, ignoring test" >&2 36 exit $ksft_skip 33 exit $ksft_skip 37 else 34 else 38 if printf '\000' >"$DIR"/trigger_async 35 if printf '\000' >"$DIR"/trigger_async_request 2> /dev/null; then 39 echo "$0: empty filename shoul 36 echo "$0: empty filename should not succeed (async)" >&2 40 exit 1 37 exit 1 41 fi 38 fi 42 fi 39 fi 43 40 44 # Request a firmware that doesn't exist, it sh 41 # Request a firmware that doesn't exist, it should fail. 45 if echo -n "nope-$NAME" >"$DIR"/trigger_reques 42 if echo -n "nope-$NAME" >"$DIR"/trigger_request 2> /dev/null; then 46 echo "$0: firmware shouldn't have load 43 echo "$0: firmware shouldn't have loaded" >&2 47 exit 1 44 exit 1 48 fi 45 fi 49 if diff -q "$FW" /dev/test_firmware >/dev/null 46 if diff -q "$FW" /dev/test_firmware >/dev/null ; then 50 echo "$0: firmware was not expected to 47 echo "$0: firmware was not expected to match" >&2 51 exit 1 48 exit 1 52 else 49 else 53 if [ "$HAS_FW_LOADER_USER_HELPER" = "y 50 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then 54 echo "$0: timeout works" 51 echo "$0: timeout works" 55 fi 52 fi 56 fi 53 fi 57 54 58 # This should succeed via kernel load or will 55 # This should succeed via kernel load or will fail after 1 second after 59 # being handed over to the user helper, which 56 # being handed over to the user helper, which won't find the fw either. 60 if ! echo -n "$NAME" >"$DIR"/trigger_request ; 57 if ! echo -n "$NAME" >"$DIR"/trigger_request ; then 61 echo "$0: could not trigger request" > 58 echo "$0: could not trigger request" >&2 62 exit 1 59 exit 1 63 fi 60 fi 64 61 65 # Verify the contents are what we expect. 62 # Verify the contents are what we expect. 66 if ! diff -q "$FW" /dev/test_firmware >/dev/nu 63 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then 67 echo "$0: firmware was not loaded" >&2 64 echo "$0: firmware was not loaded" >&2 68 exit 1 65 exit 1 69 else 66 else 70 echo "$0: filesystem loading works" 67 echo "$0: filesystem loading works" 71 fi 68 fi 72 69 73 # Try the asynchronous version too 70 # Try the asynchronous version too 74 if [ ! -e "$DIR"/trigger_async_request ]; then 71 if [ ! -e "$DIR"/trigger_async_request ]; then 75 echo "$0: firmware loading: async trig 72 echo "$0: firmware loading: async trigger not present, ignoring test" >&2 76 exit $ksft_skip 73 exit $ksft_skip 77 else 74 else 78 if ! echo -n "$NAME" >"$DIR"/trigger_a 75 if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then 79 echo "$0: could not trigger as 76 echo "$0: could not trigger async request" >&2 80 exit 1 77 exit 1 81 fi 78 fi 82 79 83 # Verify the contents are what we expe 80 # Verify the contents are what we expect. 84 if ! diff -q "$FW" /dev/test_firmware 81 if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then 85 echo "$0: firmware was not loa 82 echo "$0: firmware was not loaded (async)" >&2 86 exit 1 83 exit 1 87 else 84 else 88 echo "$0: async filesystem loa 85 echo "$0: async filesystem loading works" 89 fi 86 fi 90 fi 87 fi 91 88 92 # Try platform (EFI embedded fw) loading too << 93 if [ ! -e "$DIR"/trigger_request_platform ]; t << 94 echo "$0: firmware loading: platform t << 95 else << 96 if printf '\000' >"$DIR"/trigger_reque << 97 echo "$0: empty filename shoul << 98 exit 1 << 99 fi << 100 << 101 # Note we echo a non-existing name, si << 102 # are preferred over firmware embedded << 103 # The test adds a fake entry with the << 104 # fw list, so the name does not matter << 105 if ! echo -n "nope-$NAME" >"$DIR"/trig << 106 echo "$0: could not trigger re << 107 exit 1 << 108 fi << 109 << 110 # The test verifies itself that the lo << 111 # the contents for the fake platform f << 112 echo "$0: platform loading works" << 113 fi << 114 << 115 ### Batched requests tests 89 ### Batched requests tests 116 test_config_present() 90 test_config_present() 117 { 91 { 118 if [ ! -f $DIR/reset ]; then 92 if [ ! -f $DIR/reset ]; then 119 echo "Configuration triggers n 93 echo "Configuration triggers not present, ignoring test" 120 exit $ksft_skip 94 exit $ksft_skip 121 fi 95 fi 122 } 96 } 123 97 124 # Defaults : 98 # Defaults : 125 # 99 # 126 # send_uevent: 1 100 # send_uevent: 1 127 # sync_direct: 0 101 # sync_direct: 0 128 # name: test-firmware.bin 102 # name: test-firmware.bin 129 # num_requests: 4 103 # num_requests: 4 130 config_reset() 104 config_reset() 131 { 105 { 132 echo 1 > $DIR/reset 106 echo 1 > $DIR/reset 133 } 107 } 134 108 135 release_all_firmware() 109 release_all_firmware() 136 { 110 { 137 echo 1 > $DIR/release_all_firmware 111 echo 1 > $DIR/release_all_firmware 138 } 112 } 139 113 140 config_set_name() 114 config_set_name() 141 { 115 { 142 echo -n $1 > $DIR/config_name 116 echo -n $1 > $DIR/config_name 143 } 117 } 144 118 145 config_set_into_buf() 119 config_set_into_buf() 146 { 120 { 147 echo 1 > $DIR/config_into_buf 121 echo 1 > $DIR/config_into_buf 148 } 122 } 149 123 150 config_unset_into_buf() 124 config_unset_into_buf() 151 { 125 { 152 echo 0 > $DIR/config_into_buf 126 echo 0 > $DIR/config_into_buf 153 } 127 } 154 128 155 config_set_buf_size() << 156 { << 157 echo $1 > $DIR/config_buf_size << 158 } << 159 << 160 config_set_file_offset() << 161 { << 162 echo $1 > $DIR/config_file_offset << 163 } << 164 << 165 config_set_partial() << 166 { << 167 echo 1 > $DIR/config_partial << 168 } << 169 << 170 config_unset_partial() << 171 { << 172 echo 0 > $DIR/config_partial << 173 } << 174 << 175 config_set_sync_direct() 129 config_set_sync_direct() 176 { 130 { 177 echo 1 > $DIR/config_sync_direct 131 echo 1 > $DIR/config_sync_direct 178 } 132 } 179 133 180 config_unset_sync_direct() 134 config_unset_sync_direct() 181 { 135 { 182 echo 0 > $DIR/config_sync_direct 136 echo 0 > $DIR/config_sync_direct 183 } 137 } 184 138 185 config_set_uevent() 139 config_set_uevent() 186 { 140 { 187 echo 1 > $DIR/config_send_uevent 141 echo 1 > $DIR/config_send_uevent 188 } 142 } 189 143 190 config_unset_uevent() 144 config_unset_uevent() 191 { 145 { 192 echo 0 > $DIR/config_send_uevent 146 echo 0 > $DIR/config_send_uevent 193 } 147 } 194 148 195 config_trigger_sync() 149 config_trigger_sync() 196 { 150 { 197 echo -n 1 > $DIR/trigger_batched_reque 151 echo -n 1 > $DIR/trigger_batched_requests 2>/dev/null 198 } 152 } 199 153 200 config_trigger_async() 154 config_trigger_async() 201 { 155 { 202 echo -n 1 > $DIR/trigger_batched_reque 156 echo -n 1 > $DIR/trigger_batched_requests_async 2> /dev/null 203 } 157 } 204 158 205 config_set_read_fw_idx() 159 config_set_read_fw_idx() 206 { 160 { 207 echo -n $1 > $DIR/config_read_fw_idx 2 161 echo -n $1 > $DIR/config_read_fw_idx 2> /dev/null 208 } 162 } 209 163 210 read_firmwares() 164 read_firmwares() 211 { 165 { 212 if [ "$(cat $DIR/config_into_buf)" == 166 if [ "$(cat $DIR/config_into_buf)" == "1" ]; then 213 fwfile="$FW_INTO_BUF" 167 fwfile="$FW_INTO_BUF" 214 else 168 else 215 fwfile="$FW" 169 fwfile="$FW" 216 fi 170 fi 217 if [ "$1" = "componly" ]; then !! 171 if [ "$1" = "xzonly" ]; then 218 fwfile="${fwfile}-orig" 172 fwfile="${fwfile}-orig" 219 fi 173 fi 220 for i in $(seq 0 3); do 174 for i in $(seq 0 3); do 221 config_set_read_fw_idx $i 175 config_set_read_fw_idx $i 222 # Verify the contents are what 176 # Verify the contents are what we expect. 223 # -Z required for now -- check 177 # -Z required for now -- check for yourself, md5sum 224 # on $FW and DIR/read_firmware 178 # on $FW and DIR/read_firmware will yield the same. Even 225 # cmp agrees, so something is 179 # cmp agrees, so something is off. 226 if ! diff -q -Z "$fwfile" $DIR 180 if ! diff -q -Z "$fwfile" $DIR/read_firmware 2>/dev/null ; then 227 echo "request #$i: fir 181 echo "request #$i: firmware was not loaded" >&2 228 exit 1 182 exit 1 229 fi 183 fi 230 done 184 done 231 } 185 } 232 186 233 read_partial_firmwares() << 234 { << 235 if [ "$(cat $DIR/config_into_buf)" == << 236 fwfile="${FW_INTO_BUF}" << 237 else << 238 fwfile="${FW}" << 239 fi << 240 << 241 if [ "$1" = "componly" ]; then << 242 fwfile="${fwfile}-orig" << 243 fi << 244 << 245 # Strip fwfile down to match partial o << 246 partial_data="$(cat $fwfile)" << 247 partial_data="${partial_data:$2:$3}" << 248 << 249 for i in $(seq 0 3); do << 250 config_set_read_fw_idx $i << 251 << 252 read_firmware="$(cat $DIR/read << 253 << 254 # Verify the contents are what << 255 if [ $read_firmware != $partia << 256 echo "request #$i: par << 257 exit 1 << 258 fi << 259 done << 260 } << 261 << 262 read_firmwares_expect_nofile() 187 read_firmwares_expect_nofile() 263 { 188 { 264 for i in $(seq 0 3); do 189 for i in $(seq 0 3); do 265 config_set_read_fw_idx $i 190 config_set_read_fw_idx $i 266 # Ensures contents differ 191 # Ensures contents differ 267 if diff -q -Z "$FW" $DIR/read_ 192 if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then 268 echo "request $i: file 193 echo "request $i: file was not expected to match" >&2 269 exit 1 194 exit 1 270 fi 195 fi 271 done 196 done 272 } 197 } 273 198 274 test_batched_request_firmware_nofile() 199 test_batched_request_firmware_nofile() 275 { 200 { 276 echo -n "Batched request_firmware() no 201 echo -n "Batched request_firmware() nofile try #$1: " 277 config_reset 202 config_reset 278 config_set_name nope-test-firmware.bin 203 config_set_name nope-test-firmware.bin 279 config_trigger_sync 204 config_trigger_sync 280 read_firmwares_expect_nofile 205 read_firmwares_expect_nofile 281 release_all_firmware 206 release_all_firmware 282 echo "OK" 207 echo "OK" 283 } 208 } 284 209 285 test_batched_request_firmware_into_buf_nofile( 210 test_batched_request_firmware_into_buf_nofile() 286 { 211 { 287 echo -n "Batched request_firmware_into 212 echo -n "Batched request_firmware_into_buf() nofile try #$1: " 288 config_reset 213 config_reset 289 config_set_name nope-test-firmware.bin 214 config_set_name nope-test-firmware.bin 290 config_set_into_buf 215 config_set_into_buf 291 config_trigger_sync 216 config_trigger_sync 292 read_firmwares_expect_nofile 217 read_firmwares_expect_nofile 293 release_all_firmware 218 release_all_firmware 294 echo "OK" 219 echo "OK" 295 } 220 } 296 221 297 test_request_partial_firmware_into_buf_nofile( << 298 { << 299 echo -n "Test request_partial_firmware << 300 config_reset << 301 config_set_name nope-test-firmware.bin << 302 config_set_into_buf << 303 config_set_partial << 304 config_set_buf_size $2 << 305 config_set_file_offset $1 << 306 config_trigger_sync << 307 read_firmwares_expect_nofile << 308 release_all_firmware << 309 echo "OK" << 310 } << 311 << 312 test_batched_request_firmware_direct_nofile() 222 test_batched_request_firmware_direct_nofile() 313 { 223 { 314 echo -n "Batched request_firmware_dire 224 echo -n "Batched request_firmware_direct() nofile try #$1: " 315 config_reset 225 config_reset 316 config_set_name nope-test-firmware.bin 226 config_set_name nope-test-firmware.bin 317 config_set_sync_direct 227 config_set_sync_direct 318 config_trigger_sync 228 config_trigger_sync 319 release_all_firmware 229 release_all_firmware 320 echo "OK" 230 echo "OK" 321 } 231 } 322 232 323 test_request_firmware_nowait_uevent_nofile() 233 test_request_firmware_nowait_uevent_nofile() 324 { 234 { 325 echo -n "Batched request_firmware_nowa 235 echo -n "Batched request_firmware_nowait(uevent=true) nofile try #$1: " 326 config_reset 236 config_reset 327 config_set_name nope-test-firmware.bin 237 config_set_name nope-test-firmware.bin 328 config_trigger_async 238 config_trigger_async 329 release_all_firmware 239 release_all_firmware 330 echo "OK" 240 echo "OK" 331 } 241 } 332 242 333 test_wait_and_cancel_custom_load() 243 test_wait_and_cancel_custom_load() 334 { 244 { 335 if [ "$HAS_FW_LOADER_USER_HELPER" != " 245 if [ "$HAS_FW_LOADER_USER_HELPER" != "yes" ]; then 336 return 246 return 337 fi 247 fi 338 local timeout=10 248 local timeout=10 339 name=$1 249 name=$1 340 while [ ! -e "$DIR"/"$name"/loading ]; 250 while [ ! -e "$DIR"/"$name"/loading ]; do 341 sleep 0.1 251 sleep 0.1 342 timeout=$(( $timeout - 1 )) 252 timeout=$(( $timeout - 1 )) 343 if [ "$timeout" -eq 0 ]; then 253 if [ "$timeout" -eq 0 ]; then 344 echo "firmware interfa 254 echo "firmware interface never appeared:" >&2 345 echo "$DIR/$name/loadi 255 echo "$DIR/$name/loading" >&2 346 exit 1 256 exit 1 347 fi 257 fi 348 done 258 done 349 echo -1 >"$DIR"/"$name"/loading 259 echo -1 >"$DIR"/"$name"/loading 350 } 260 } 351 261 352 test_request_firmware_nowait_custom_nofile() 262 test_request_firmware_nowait_custom_nofile() 353 { 263 { 354 echo -n "Batched request_firmware_nowa 264 echo -n "Batched request_firmware_nowait(uevent=false) nofile try #$1: " 355 config_reset 265 config_reset 356 config_unset_uevent 266 config_unset_uevent 357 RANDOM_FILE_PATH=$(setup_random_file_f 267 RANDOM_FILE_PATH=$(setup_random_file_fake) 358 RANDOM_FILE="$(basename $RANDOM_FILE_P 268 RANDOM_FILE="$(basename $RANDOM_FILE_PATH)" 359 config_set_name $RANDOM_FILE 269 config_set_name $RANDOM_FILE 360 config_trigger_async & 270 config_trigger_async & 361 test_wait_and_cancel_custom_load $RAND 271 test_wait_and_cancel_custom_load $RANDOM_FILE 362 wait 272 wait 363 release_all_firmware 273 release_all_firmware 364 echo "OK" 274 echo "OK" 365 } 275 } 366 276 367 test_batched_request_firmware() 277 test_batched_request_firmware() 368 { 278 { 369 echo -n "Batched request_firmware() $2 279 echo -n "Batched request_firmware() $2 try #$1: " 370 config_reset 280 config_reset 371 config_trigger_sync 281 config_trigger_sync 372 read_firmwares $2 282 read_firmwares $2 373 release_all_firmware 283 release_all_firmware 374 echo "OK" 284 echo "OK" 375 } 285 } 376 286 377 test_batched_request_firmware_into_buf() 287 test_batched_request_firmware_into_buf() 378 { 288 { 379 echo -n "Batched request_firmware_into 289 echo -n "Batched request_firmware_into_buf() $2 try #$1: " 380 config_reset 290 config_reset 381 config_set_name $TEST_FIRMWARE_INTO_BU 291 config_set_name $TEST_FIRMWARE_INTO_BUF_FILENAME 382 config_set_into_buf 292 config_set_into_buf 383 config_trigger_sync 293 config_trigger_sync 384 read_firmwares $2 294 read_firmwares $2 385 release_all_firmware 295 release_all_firmware 386 echo "OK" 296 echo "OK" 387 } 297 } 388 298 389 test_batched_request_firmware_direct() 299 test_batched_request_firmware_direct() 390 { 300 { 391 echo -n "Batched request_firmware_dire 301 echo -n "Batched request_firmware_direct() $2 try #$1: " 392 config_reset 302 config_reset 393 config_set_sync_direct 303 config_set_sync_direct 394 config_trigger_sync 304 config_trigger_sync 395 release_all_firmware 305 release_all_firmware 396 echo "OK" 306 echo "OK" 397 } 307 } 398 308 399 test_request_firmware_nowait_uevent() 309 test_request_firmware_nowait_uevent() 400 { 310 { 401 echo -n "Batched request_firmware_nowa 311 echo -n "Batched request_firmware_nowait(uevent=true) $2 try #$1: " 402 config_reset 312 config_reset 403 config_trigger_async 313 config_trigger_async 404 release_all_firmware 314 release_all_firmware 405 echo "OK" 315 echo "OK" 406 } 316 } 407 317 408 test_request_firmware_nowait_custom() 318 test_request_firmware_nowait_custom() 409 { 319 { 410 echo -n "Batched request_firmware_nowa 320 echo -n "Batched request_firmware_nowait(uevent=false) $2 try #$1: " 411 config_reset 321 config_reset 412 config_unset_uevent 322 config_unset_uevent 413 RANDOM_FILE_PATH=$(setup_random_file) 323 RANDOM_FILE_PATH=$(setup_random_file) 414 RANDOM_FILE="$(basename $RANDOM_FILE_P 324 RANDOM_FILE="$(basename $RANDOM_FILE_PATH)" 415 if [ -n "$2" -a "$2" != "normal" ]; th !! 325 if [ "$2" = "both" ]; then 416 compress_"$2"_"$COMPRESS_FORMA !! 326 xz -9 -C crc32 -k $RANDOM_FILE_PATH >> 327 elif [ "$2" = "xzonly" ]; then >> 328 xz -9 -C crc32 $RANDOM_FILE_PATH 417 fi 329 fi 418 config_set_name $RANDOM_FILE 330 config_set_name $RANDOM_FILE 419 config_trigger_async 331 config_trigger_async 420 release_all_firmware 332 release_all_firmware 421 echo "OK" 333 echo "OK" 422 } 334 } 423 335 424 test_request_partial_firmware_into_buf() << 425 { << 426 echo -n "Test request_partial_firmware << 427 config_reset << 428 config_set_name $TEST_FIRMWARE_INTO_BU << 429 config_set_into_buf << 430 config_set_partial << 431 config_set_buf_size $2 << 432 config_set_file_offset $1 << 433 config_trigger_sync << 434 read_partial_firmwares normal $1 $2 << 435 release_all_firmware << 436 echo "OK" << 437 } << 438 << 439 do_tests () << 440 { << 441 mode="$1" << 442 suffix="$2" << 443 << 444 for i in $(seq 1 5); do << 445 test_batched_request_firmware$ << 446 done << 447 << 448 for i in $(seq 1 5); do << 449 test_batched_request_firmware_ << 450 done << 451 << 452 for i in $(seq 1 5); do << 453 test_batched_request_firmware_ << 454 done << 455 << 456 for i in $(seq 1 5); do << 457 test_request_firmware_nowait_u << 458 done << 459 << 460 for i in $(seq 1 5); do << 461 test_request_firmware_nowait_c << 462 done << 463 } << 464 << 465 # Only continue if batched request triggers ar 336 # Only continue if batched request triggers are present on the 466 # test-firmware driver 337 # test-firmware driver 467 test_config_present 338 test_config_present 468 339 469 # test with the file present 340 # test with the file present 470 echo 341 echo 471 echo "Testing with the file present..." 342 echo "Testing with the file present..." 472 do_tests normal !! 343 for i in $(seq 1 5); do 473 !! 344 test_batched_request_firmware $i normal 474 # Partial loads cannot use fallback, so do not !! 345 done 475 test_request_partial_firmware_into_buf 0 10 !! 346 476 test_request_partial_firmware_into_buf 0 5 !! 347 for i in $(seq 1 5); do 477 test_request_partial_firmware_into_buf 1 6 !! 348 test_batched_request_firmware_into_buf $i normal 478 test_request_partial_firmware_into_buf 2 10 !! 349 done >> 350 >> 351 for i in $(seq 1 5); do >> 352 test_batched_request_firmware_direct $i normal >> 353 done >> 354 >> 355 for i in $(seq 1 5); do >> 356 test_request_firmware_nowait_uevent $i normal >> 357 done >> 358 >> 359 for i in $(seq 1 5); do >> 360 test_request_firmware_nowait_custom $i normal >> 361 done 479 362 480 # Test for file not found, errors are expected 363 # Test for file not found, errors are expected, the failure would be 481 # a hung task, which would require a hard rese 364 # a hung task, which would require a hard reset. 482 echo 365 echo 483 echo "Testing with the file missing..." 366 echo "Testing with the file missing..." 484 do_tests nofile _nofile !! 367 for i in $(seq 1 5); do 485 !! 368 test_batched_request_firmware_nofile $i 486 # Partial loads cannot use fallback, so do not !! 369 done 487 test_request_partial_firmware_into_buf_nofile !! 370 488 test_request_partial_firmware_into_buf_nofile !! 371 for i in $(seq 1 5); do 489 test_request_partial_firmware_into_buf_nofile !! 372 test_batched_request_firmware_into_buf_nofile $i 490 test_request_partial_firmware_into_buf_nofile !! 373 done 491 !! 374 492 test_request_firmware_compressed () !! 375 for i in $(seq 1 5); do 493 { !! 376 test_batched_request_firmware_direct_nofile $i 494 export COMPRESS_FORMAT="$1" !! 377 done 495 !! 378 496 # test with both files present !! 379 for i in $(seq 1 5); do 497 compress_both_"$COMPRESS_FORMAT" $FW !! 380 test_request_firmware_nowait_uevent_nofile $i 498 compress_both_"$COMPRESS_FORMAT" $FW_I !! 381 done 499 !! 382 500 config_set_name $NAME !! 383 for i in $(seq 1 5); do 501 echo !! 384 test_request_firmware_nowait_custom_nofile $i 502 echo "Testing with both plain and $COM !! 385 done 503 do_tests both !! 386 504 !! 387 test "$HAS_FW_LOADER_COMPRESS" != "yes" && exit 0 505 # test with only compressed file prese !! 388 506 mv "$FW" "${FW}-orig" !! 389 # test with both files present 507 mv "$FW_INTO_BUF" "${FW_INTO_BUF}-orig !! 390 xz -9 -C crc32 -k $FW 508 !! 391 config_set_name $NAME 509 config_set_name $NAME !! 392 echo 510 echo !! 393 echo "Testing with both plain and xz files present..." 511 echo "Testing with only $COMPRESS_FORM !! 394 for i in $(seq 1 5); do 512 do_tests componly !! 395 test_batched_request_firmware $i both 513 !! 396 done 514 mv "${FW}-orig" "$FW" !! 397 515 mv "${FW_INTO_BUF}-orig" "$FW_INTO_BUF !! 398 for i in $(seq 1 5); do 516 } !! 399 test_batched_request_firmware_into_buf $i both 517 !! 400 done 518 compress_both_XZ () !! 401 519 { !! 402 for i in $(seq 1 5); do 520 $RUN_XZ -k "$@" !! 403 test_batched_request_firmware_direct $i both 521 } !! 404 done 522 !! 405 523 compress_componly_XZ () !! 406 for i in $(seq 1 5); do 524 { !! 407 test_request_firmware_nowait_uevent $i both 525 $RUN_XZ "$@" !! 408 done 526 } !! 409 527 !! 410 for i in $(seq 1 5); do 528 compress_both_ZSTD () !! 411 test_request_firmware_nowait_custom $i both 529 { !! 412 done 530 $RUN_ZSTD -k "$@" << 531 } << 532 << 533 compress_componly_ZSTD () << 534 { << 535 $RUN_ZSTD --rm "$@" << 536 } << 537 << 538 if test "$HAS_FW_LOADER_COMPRESS_XZ" = "yes"; << 539 test_request_firmware_compressed XZ << 540 fi << 541 413 542 if test "$HAS_FW_LOADER_COMPRESS_ZSTD" = "yes" !! 414 # test with only xz file present 543 test_request_firmware_compressed ZSTD !! 415 mv "$FW" "${FW}-orig" 544 fi !! 416 echo >> 417 echo "Testing with only xz file present..." >> 418 for i in $(seq 1 5); do >> 419 test_batched_request_firmware $i xzonly >> 420 done >> 421 >> 422 for i in $(seq 1 5); do >> 423 test_batched_request_firmware_into_buf $i xzonly >> 424 done >> 425 >> 426 for i in $(seq 1 5); do >> 427 test_batched_request_firmware_direct $i xzonly >> 428 done >> 429 >> 430 for i in $(seq 1 5); do >> 431 test_request_firmware_nowait_uevent $i xzonly >> 432 done >> 433 >> 434 for i in $(seq 1 5); do >> 435 test_request_firmware_nowait_custom $i xzonly >> 436 done 545 437 546 exit 0 438 exit 0
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.