]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test/py: Improve check for mksquashfs version
authorMarek Behún <marek.behun@nic.cz>
Thu, 22 Jul 2021 20:52:05 +0000 (22:52 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 29 Jul 2021 00:46:34 +0000 (20:46 -0400)
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 <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
test/py/tests/test_fs/test_squashfs/sqfs_common.py

index 267c4b57d1b6e5b11a9dc44531d2bc362fd80e32..8b84c2cdca855533ec1f8c9f4fb081c6e5b7c279 100644 (file)
@@ -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. """