diff options
author | Michael Auchter <michael.auchter@ni.com> | 2021-04-20 10:06:23 -0500 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2021-06-02 22:28:43 -0700 |
commit | 70abcdc17b1a91582708133dcf0491e9549dce9c (patch) | |
tree | aac073e45bfd0eb762deb12c152982fdce04c6e3 | |
parent | 4ac80a4312221825787095dfc58c19b15f7d8d60 (diff) | |
download | uhd-70abcdc17b1a91582708133dcf0491e9549dce9c.tar.gz uhd-70abcdc17b1a91582708133dcf0491e9549dce9c.tar.bz2 uhd-70abcdc17b1a91582708133dcf0491e9549dce9c.zip |
mpm: check-filesystem: liberalize version check
check-filesystem assumed that UHD's version string always had the format
of <version>-<git_count>-<git_hash>. However, this is not always the
case; see ./host/cmake/Modules/UHDVersion.cmake for more details.
Instead of trying to parse the version string into components, just
check to make sure the version and git hash are present in the version
string.
-rw-r--r-- | mpm/python/usrp_mpm/sys_utils/filesystem_status.py | 11 | ||||
-rwxr-xr-x | mpm/tools/check-filesystem | 4 |
2 files changed, 3 insertions, 12 deletions
diff --git a/mpm/python/usrp_mpm/sys_utils/filesystem_status.py b/mpm/python/usrp_mpm/sys_utils/filesystem_status.py index b9617cf0a..3b7655a66 100644 --- a/mpm/python/usrp_mpm/sys_utils/filesystem_status.py +++ b/mpm/python/usrp_mpm/sys_utils/filesystem_status.py @@ -13,18 +13,9 @@ import subprocess import time def get_uhd_version(filesystem_root='/'): - def parse_uhd_version(versionstring): - assert(versionstring[0:4] == 'UHD ') - array = versionstring[4:].split('-') - assert(len(array) == 3) - return { - 'version': array[0], - 'appendix': array[1], - 'githash': array[2], - } file = pathlib.Path(filesystem_root, 'usr/bin/uhd_config_info') versionstring = subprocess.check_output([file, '--version']).decode('utf-8').splitlines()[0] - return parse_uhd_version(versionstring) + return versionstring def get_mender_artifact(filesystem_root='/', parse_manually=False): def parse_artifact(output): diff --git a/mpm/tools/check-filesystem b/mpm/tools/check-filesystem index f824e88b2..1ceb7b993 100755 --- a/mpm/tools/check-filesystem +++ b/mpm/tools/check-filesystem @@ -50,11 +50,11 @@ class CheckFilesystem(unittest.TestCase): def test_uhd_version(self): uhd_version = get_uhd_version(filesystem_root=self.args.filesystem_root) - self.assertEqual(uhd_version['version'], self.args.uhd_version) + self.assertIn(self.args.uhd_version, uhd_version) def test_uhd_githash(self): uhd_version = get_uhd_version(filesystem_root=self.args.filesystem_root) - self.assertEqual(uhd_version['githash'], self.args.uhd_githash) + self.assertIn(self.args.uhd_githash, uhd_version) def test_mender_artifact(self): mender_artifact = get_mender_artifact(filesystem_root=self.args.filesystem_root) |