tests: add docstring to binary sizes test
@@ -43,16 +43,37 @@ BINARY_SIZE_TOLERANCE = 0.05
@pytest.mark.timeout(500)
-def test_binary_sizes():
- """Test if the sizes of the release binaries are within expected ranges."""
- fc_binary, jailer_binary = host.get_firecracker_binaries()
+def test_firecracker_binary_size():
+ """
+ Test if the size of the firecracker binary is within expected ranges.
- check_binary_size("firecracker", fc_binary, FC_BINARY_SIZE_TARGET,
+ @type: build
+ """
+ fc_binary, _ = host.get_firecracker_binaries()
+
+ result = check_binary_size("firecracker", fc_binary, FC_BINARY_SIZE_TARGET,
BINARY_SIZE_TOLERANCE, FC_BINARY_SIZE_LIMIT)
- check_binary_size("jailer", jailer_binary, JAILER_BINARY_SIZE_TARGET,
+ return f"{result} B", \
+ f"{FC_BINARY_SIZE_TARGET} +/- {BINARY_SIZE_TOLERANCE * 100}% B"
+
+
+@pytest.mark.timeout(500)
+def test_jailer_binary_size():
+ """
+ Test if the size of the jailer binary is within expected ranges.
+
+ @type: build
+ """
+ _, jailer_binary = host.get_firecracker_binaries()
+
+ result = check_binary_size("jailer", jailer_binary,
+ JAILER_BINARY_SIZE_TARGET,
BINARY_SIZE_TOLERANCE, JAILER_BINARY_SIZE_LIMIT)
+ return f"{result} B", \
+ f"{JAILER_BINARY_SIZE_TARGET} +/- {BINARY_SIZE_TOLERANCE * 100}% B"
+
def check_binary_size(name, binary_path, size_target, tolerance, limit):
"""Check if the specified binary falls within the expected range."""
@@ -91,3 +112,5 @@ def check_binary_size(name, binary_path, size_target, tolerance, limit):
)
assert binary_size < limit, binary_limit_msg
+
+ return binary_size
