Skip to content
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
4 changes: 2 additions & 2 deletions linux/vibeshine-drm/generate_hdr_edid.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def build_edid() -> bytes:
)
cta[2] = 4 + len(data_blocks)
cta[3] = 0
cta[4 : 4 + len(data_blocks)] = data_blocks
cta[4:4 + len(data_blocks)] = data_blocks
checksum(cta)
return bytes(base + cta)


def header(edid: bytes) -> str:
rows = []
for offset in range(0, len(edid), 12):
values = ", ".join(f"0x{value:02x}" for value in edid[offset : offset + 12])
values = ", ".join(f"0x{value:02x}" for value in edid[offset:offset + 12])
rows.append(f" {values},")
return (
"/* Generated by generate_hdr_edid.py; do not edit manually. */\n"
Expand Down
20 changes: 13 additions & 7 deletions tests/linux/test-frame-fd-transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@
}
'''
with tempfile.TemporaryDirectory(prefix='vibeshine-frame-fds-') as name:
path=Path(name); (path/'linux').mkdir()
for header in ['fdtable.h','file.h']:
(path/'linux'/header).write_text('')
(path/'linux/fcntl.h').write_text('#define O_CLOEXEC 1\n')
(path/'test.c').write_text(SOURCE)
subprocess.run([os.environ.get('CC','cc'),'-std=c11','-Wall','-Wextra','-Werror','-I',str(path),'-I',str(DRIVER.resolve()),str(path/'test.c'),'-o',str(path/'test')],check=True)
subprocess.run([str(path/'test')],check=True)
path = Path(name)
(path / 'linux').mkdir()
for header in ['fdtable.h', 'file.h']:
(path / 'linux' / header).write_text('')
(path / 'linux/fcntl.h').write_text('#define O_CLOEXEC 1\n')
(path / 'test.c').write_text(SOURCE)
command = [
os.environ.get('CC', 'cc'), '-std=c11', '-Wall', '-Wextra', '-Werror',
'-I', str(path), '-I', str(DRIVER.resolve()), str(path / 'test.c'),
'-o', str(path / 'test'),
]
subprocess.run(command, check=True)
subprocess.run([str(path / 'test')], check=True)
print('Frame FD transaction: rollback, exhaustion, bounds and publication passed')
10 changes: 8 additions & 2 deletions tests/linux/test-native-dumb-regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ def main() -> int:
red = subprocess.run(runner + ["--baseline-object", str(userspace), "--output-dir", str(output / "red")],
capture_output=True, text=True)
(output / "red.log").write_text(red.stdout + red.stderr, encoding="utf-8")
if red.returncode != 1 or "3440x1440 returned pitch=13760" not in red.stdout or "expected pitch=13824" not in red.stdout:
raise RuntimeError("baseline did not fail on the expected observable pitch mismatch: " + red.stdout + red.stderr)
if (
red.returncode != 1
or "3440x1440 returned pitch=13760" not in red.stdout
or "expected pitch=13824" not in red.stdout
):
raise RuntimeError(
"baseline did not fail on the expected observable pitch mismatch: " + red.stdout + red.stderr
)
green = subprocess.run(runner + ["--output-dir", str(output / "green")], capture_output=True, text=True)
(output / "green.log").write_text(green.stdout + green.stderr, encoding="utf-8")
green.check_returncode()
Expand Down
16 changes: 11 additions & 5 deletions tests/linux/test-vibeshine-drm-contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def cta_data_blocks(cta: bytes) -> list[tuple[int, bytes]]:
length = header & 0x1F
end = offset + 1 + length
require(end <= cta[2], "CTA data block extends beyond the data-block collection")
blocks.append((header >> 5, cta[offset + 1 : end]))
blocks.append((header >> 5, cta[offset + 1:end]))
offset = end
require(offset == cta[2], "CTA data-block collection was not parsed exactly")
return blocks
Expand All @@ -49,7 +49,7 @@ def cta_data_blocks(cta: bytes) -> list[tuple[int, bytes]]:
def validate_edid(edid: bytes) -> None:
require(len(edid) == 256, f"expected a 256-byte EDID, got {len(edid)} bytes")
for index in range(2):
block = edid[index * 128 : (index + 1) * 128]
block = edid[index * 128:(index + 1) * 128]
require(sum(block) & 0xFF == 0, f"EDID block {index} checksum is invalid")

require(decode_manufacturer(edid) == "VBS", "EDID manufacturer is not VBS")
Expand Down Expand Up @@ -1014,11 +1014,16 @@ def main() -> int:
enabled = enabled[:enabled.index("CONFIGFS_ATTR(device_, enabled)")]
require("configfs_depend_item_unlocked(&vkms_subsys, item)" in enabled,
"enabled device lacks configfs removal dependency")
require(re.search(r"ret = vkms_destroy\(dev->config\);\s*if \(ret\)\s*return ret;\s*configfs_undepend_item_unlocked\(item\);", enabled) is not None,
destroy_dependency_pattern = (
r"ret = vkms_destroy\(dev->config\);\s*if \(ret\)\s*return ret;\s*"
r"configfs_undepend_item_unlocked\(item\);"
)
require(re.search(destroy_dependency_pattern, enabled) is not None,
"failed device destruction releases configfs dependency")
destroy = driver[driver.index("int vkms_destroy("):]
destroy = destroy[:destroy.index("static void __exit")]
require(re.search(r"if \(vkms_shutdown_release\(vkmsdev\)\)\s*return -EBUSY;.*?devres_release_group", destroy, re.DOTALL) is not None,
shutdown_release_pattern = r"if \(vkms_shutdown_release\(vkmsdev\)\)\s*return -EBUSY;.*?devres_release_group"
require(re.search(shutdown_release_pattern, destroy, re.DOTALL) is not None,
"failed shutdown must preserve device resources")
require("DRM_IOCTL_DEF_DRV(VIBESHINE_GET_FRAME_LEASED" in driver,
"leased frame export is not registered")
Expand All @@ -1038,7 +1043,8 @@ def main() -> int:
"shutdown waits without first closing capture admission")
require("capture_stopping, false" not in driver,
"shutdown reopens capture admission while draining old guards")
subprocess.run([sys.executable, str(Path(__file__).with_name("test-frame-fd-transaction.py")), str(driver_root)], check=True)
frame_fd_test = Path(__file__).with_name("test-frame-fd-transaction.py")
subprocess.run([sys.executable, str(frame_fd_test), str(driver_root)], check=True)
validate_source_contract(driver_root)
validate_reboot_notifier(driver_root)
validate_uapi_layout(driver_root)
Expand Down
Loading