test: cover exact package tool invocation paths

This commit is contained in:
2026-08-12 14:29:17 +09:00
parent d78020baf7
commit bb71b31f81
6 changed files with 321 additions and 31 deletions

View File

@@ -76,6 +76,17 @@ export fn writefile(path: str, content: str) void = {
assert(os.close(fd) == 0);
};
export fn writeexecutable(path: str, content: str) void = {
let fd: i32 = os.open(path,
os.flag.WRONLY | os.flag.CREATE | os.flag.EXCL, 448i32);
assert(fd >= 0);
match (os.writeall(fd, content.ptr, content.len: u64)) {
case let n: i64 => assert(n == content.len: i64);
case let e: os.oserror => abort("write failed");
};
assert(os.close(fd) == 0);
};
export fn exists(path: str) bool = {
return os.access(path, 0i32) == 0;
};