Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve yc-libvhost-server tests #5

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ envdata.append(

test(
'unit-tests',
import('python').find_installation('python3'),
import('python').find_installation('python3', modules: ['pytest']),
args: ['-m', 'pytest', '-rsv'],
depends: vhost_user_blk_test_server,
env: envdata,
Expand Down
19 changes: 11 additions & 8 deletions tests/test_libvhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def base_dir_abs_path() -> str:
return os.path.dirname(os.path.abspath(__file__))


def build_dir() -> str:
return os.path.join(base_dir_abs_path(), os.pardir, "build")


@pytest.fixture(scope="session")
def blkio_bench() -> str:
repo_path = os.path.join(base_dir_abs_path(), "libblkio")
Expand All @@ -37,19 +41,18 @@ def blkio_bench() -> str:

@pytest.fixture(scope="session")
def vhost_user_test_server() -> str:
env_path = os.environ.get(TEST_SERVER_BINARY_ENV_PATH)
if env_path and os.path.exists(env_path):
return env_path

server_path = os.path.join(
base_dir_abs_path(), os.pardir, "build", "tests",
"vhost-user-blk-test-server"
build_dir(), "tests", "vhost-user-blk-test-server"
)
if os.path.exists(server_path):
return server_path

env_path = os.environ.get(TEST_SERVER_BINARY_ENV_PATH)
if env_path is None or not os.path.exists(env_path):
raise RuntimeError("A valid path to the test server must be specified "
f"in the {TEST_SERVER_BINARY_ENV_PATH} variable")

return env_path
raise RuntimeError("A valid path to the test server must be specified "
f"in the {TEST_SERVER_BINARY_ENV_PATH} variable")
vsinitsyn marked this conversation as resolved.
Show resolved Hide resolved


@pytest.fixture(scope="session")
Expand Down
Loading