upgrade new cli test to zig 13

This commit is contained in:
Luke Boswell 2024-08-15 08:10:36 +10:00
parent 57b277da5c
commit 0a813be3ee
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
2 changed files with 8 additions and 7 deletions

View file

@ -1,6 +1,6 @@
const std = @import("std");
const builtin = @import("builtin");
const str = @import("glue").str;
const str = @import("glue/str.zig");
const RocStr = str.RocStr;
const testing = std.testing;
const expectEqual = testing.expectEqual;
@ -17,7 +17,7 @@ const DEBUG: bool = false;
export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque {
if (DEBUG) {
var ptr = malloc(size);
const ptr = malloc(size);
const stdout = std.io.getStdOut().writer();
stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable;
return ptr;
@ -87,14 +87,14 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong });
@export(roc_send_signal, .{ .name = "roc_send_signal", .linkage = .Strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong });
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_send_signal, .{ .name = "roc_send_signal", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
}
if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong });
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
}
}

View file

@ -16,6 +16,7 @@ pub fn copy_zig_glue() {
let zig_builtins_source_dir = workspace_dir.join("crates/compiler/builtins/bitcode/src");
let zig_test_platforms_dirs: Vec<PathBuf> = vec![
workspace_dir.join("crates/cli/tests/platform_requires_pkg/platform/glue"),
workspace_dir.join("crates/cli/tests/algorithms/fibonacci-platform/glue"),
workspace_dir.join("crates/cli/tests/algorithms/quicksort-platform/glue"),
workspace_dir.join("crates/cli/tests/benchmarks/platform/glue"),