diff mbox series

[2/5] selftests: firmware: Use smaller dictionary for XZ compression

Message ID 20220421152908.4718-3-tiwai@suse.de (mailing list archive)
State Accepted
Commit b3625b1324a56ff1194734c9b84a51b05e14a419
Headers show
Series Firmware loader support for ZSTD-compressed files | expand

Commit Message

Takashi Iwai April 21, 2022, 3:29 p.m. UTC
The xz -9 option leads to an unnecessarily too large dictionary that
isn't really suitable for the kernel firmware loader.  Pass the
dictionary size explicitly, instead.

While we're at it, make the xz command call defined in $RUN_XZ for
simplicity.

Fixes: 108ae07c5036 ("selftests: firmware: Add compressed firmware tests")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 tools/testing/selftests/firmware/fw_filesystem.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Shuah Khan April 25, 2022, 7:43 p.m. UTC | #1
On 4/21/22 9:29 AM, Takashi Iwai wrote:
> The xz -9 option leads to an unnecessarily too large dictionary that
> isn't really suitable for the kernel firmware loader.  Pass the
> dictionary size explicitly, instead.
> 
> While we're at it, make the xz command call defined in $RUN_XZ for
> simplicity.
> 
> Fixes: 108ae07c5036 ("selftests: firmware: Add compressed firmware tests")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>   tools/testing/selftests/firmware/fw_filesystem.sh | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
> index c2a2a100114b..731f011def78 100755
> --- a/tools/testing/selftests/firmware/fw_filesystem.sh
> +++ b/tools/testing/selftests/firmware/fw_filesystem.sh
> @@ -11,6 +11,8 @@ TEST_REQS_FW_SET_CUSTOM_PATH="yes"
>   TEST_DIR=$(dirname $0)
>   source $TEST_DIR/fw_lib.sh
>   
> +RUN_XZ="xz -C crc32 --lzma2=dict=2MiB"
> +
>   check_mods
>   check_setup
>   verify_reqs
> @@ -410,9 +412,9 @@ test_request_firmware_nowait_custom()
>   	RANDOM_FILE_PATH=$(setup_random_file)
>   	RANDOM_FILE="$(basename $RANDOM_FILE_PATH)"
>   	if [ "$2" = "both" ]; then
> -		xz -9 -C crc32 -k $RANDOM_FILE_PATH
> +		$RUN_XZ -k $RANDOM_FILE_PATH
>   	elif [ "$2" = "xzonly" ]; then
> -		xz -9 -C crc32 $RANDOM_FILE_PATH
> +		$RUN_XZ $RANDOM_FILE_PATH
>   	fi
>   	config_set_name $RANDOM_FILE
>   	config_trigger_async
> @@ -501,7 +503,7 @@ test_request_partial_firmware_into_buf_nofile 2 10
>   test "$HAS_FW_LOADER_COMPRESS" != "yes" && exit 0
>   
>   # test with both files present
> -xz -9 -C crc32 -k $FW
> +$RUN_XZ -k $FW
>   config_set_name $NAME
>   echo
>   echo "Testing with both plain and xz files present..."
> 

Thank you. Looks good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index c2a2a100114b..731f011def78 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -11,6 +11,8 @@  TEST_REQS_FW_SET_CUSTOM_PATH="yes"
 TEST_DIR=$(dirname $0)
 source $TEST_DIR/fw_lib.sh
 
+RUN_XZ="xz -C crc32 --lzma2=dict=2MiB"
+
 check_mods
 check_setup
 verify_reqs
@@ -410,9 +412,9 @@  test_request_firmware_nowait_custom()
 	RANDOM_FILE_PATH=$(setup_random_file)
 	RANDOM_FILE="$(basename $RANDOM_FILE_PATH)"
 	if [ "$2" = "both" ]; then
-		xz -9 -C crc32 -k $RANDOM_FILE_PATH
+		$RUN_XZ -k $RANDOM_FILE_PATH
 	elif [ "$2" = "xzonly" ]; then
-		xz -9 -C crc32 $RANDOM_FILE_PATH
+		$RUN_XZ $RANDOM_FILE_PATH
 	fi
 	config_set_name $RANDOM_FILE
 	config_trigger_async
@@ -501,7 +503,7 @@  test_request_partial_firmware_into_buf_nofile 2 10
 test "$HAS_FW_LOADER_COMPRESS" != "yes" && exit 0
 
 # test with both files present
-xz -9 -C crc32 -k $FW
+$RUN_XZ -k $FW
 config_set_name $NAME
 echo
 echo "Testing with both plain and xz files present..."