test-framework: Add nullblock to test-framework

Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
Kamil Gierszewski
2023-11-14 16:23:45 +01:00
parent d62106e850
commit 83e8064bfb
3 changed files with 21 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2023 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -9,6 +10,7 @@ from test_tools.fs_utils import (
create_directory,
check_if_symlink_exists,
check_if_directory_exists,
check_if_special_block_exist
)
from test_utils.filesystem.file import File
@@ -76,6 +78,11 @@ class Symlink(File):
elif not create:
raise FileNotFoundError("Requested symlink does not exist.")
is_special_block = check_if_special_block_exist(link_path)
if is_special_block:
if not target or readlink(link_path) == readlink(target):
return cls(link_path)
is_dir = check_if_directory_exists(link_path)
if is_dir:
raise IsADirectoryError(