From 89795ef3b6b2d12cffb840a98ee374d2e806aa64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Thu, 22 Jul 2021 22:52:05 +0200 Subject: [PATCH] test/py: Improve check for mksquashfs version MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some builds of squashfs-tools append version string with "-git" or similar. The float() conversion will fail in this case. Improve the code to only convert to float() the string before the '-' character. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Reviewed-by: Joao Marcos Costa --- test/py/tests/test_fs/test_squashfs/sqfs_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/py/tests/test_fs/test_squashfs/sqfs_common.py b/test/py/tests/test_fs/test_squashfs/sqfs_common.py index 267c4b5..8b84c2c 100644 --- a/test/py/tests/test_fs/test_squashfs/sqfs_common.py +++ b/test/py/tests/test_fs/test_squashfs/sqfs_common.py @@ -146,7 +146,7 @@ def get_mksquashfs_version(): out = subprocess.run(['mksquashfs -version'], shell=True, check=True, capture_output=True, text=True) # 'out' is: mksquashfs version X (yyyy/mm/dd) ... - return float(out.stdout.split()[2]) + return float(out.stdout.split()[2].split('-')[0]) def check_mksquashfs_version(): """ Checks if mksquashfs meets the required version. """ -- 2.7.4