diff --git a/test_tools/fs_utils.py b/test_tools/fs_utils.py index 3b2adff..cd5daa1 100644 --- a/test_tools/fs_utils.py +++ b/test_tools/fs_utils.py @@ -190,6 +190,13 @@ def diff(file, other_file): return output.stderr +def md5sum(file, binary=True): + output = TestRun.executor.run(f"md5sum {'-b' if binary else ''} {file}") + if output.exit_code != 0: + raise Exception(f"Md5sum command execution failed! {output.stdout}\n{output.stderr}") + return output.stdout.split()[0] + + # For some reason separators other than '/' don't work when using sed on system paths # This requires escaping '/' in pattern and target string def escape_sed_string(string: str, sed_replace: bool = False): diff --git a/test_utils/filesystem/file.py b/test_utils/filesystem/file.py index e6071e1..7edaa42 100644 --- a/test_utils/filesystem/file.py +++ b/test_utils/filesystem/file.py @@ -21,11 +21,7 @@ class File(FsItem): return fs_utils.diff(str(self), str(other_file)) def md5sum(self, binary=True): - output = TestRun.executor.run( - f"md5sum {'-b' if binary else ''} {self.full_path}") - if output.exit_code != 0: - raise Exception(f"Md5sum command execution failed! {output.stdout}\n{output.stderr}") - return output.stdout.split()[0] + return fs_utils.md5sum(str(self), binary) def read(self): return fs_utils.read_file(str(self))