zig: bumps to latest (#1080)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
2
.github/workflows/examples.yaml
vendored
2
.github/workflows/examples.yaml
vendored
@@ -18,7 +18,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
EMSDK_VERSION: "3.1.24"
|
EMSDK_VERSION: "3.1.24"
|
||||||
TINYGO_VERSION: "0.26.0"
|
TINYGO_VERSION: "0.26.0"
|
||||||
ZIG_VERSION: "0.11.0-dev.725+9bcfe55b5"
|
ZIG_VERSION: "0.11.0-dev.1499+23b7d2889"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||||
|
|||||||
14
.github/workflows/integration.yaml
vendored
14
.github/workflows/integration.yaml
vendored
@@ -19,7 +19,7 @@ defaults:
|
|||||||
|
|
||||||
env: # Update this prior to requiring a higher minor version in go.mod
|
env: # Update this prior to requiring a higher minor version in go.mod
|
||||||
GO_VERSION: "1.19" # 1.xx == latest patch of 1.xx
|
GO_VERSION: "1.19" # 1.xx == latest patch of 1.xx
|
||||||
ZIG_BUILD_VERSION: "0.11.0-dev.725+9bcfe55b5"
|
ZIG_VERSION: "0.11.0-dev.1499+23b7d2889"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||||
@@ -35,12 +35,12 @@ jobs:
|
|||||||
- name: Install Zig build
|
- name: Install Zig build
|
||||||
run: |
|
run: |
|
||||||
sudo apt install xz-utils
|
sudo apt install xz-utils
|
||||||
sudo sh -c 'wget -c -q https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_BUILD_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
|
sudo sh -c 'wget -c -q https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
|
||||||
|
|
||||||
- name: Download Zig source code
|
- name: Download Zig source code
|
||||||
run: |
|
run: |
|
||||||
sudo apt install xz-utils
|
sudo apt install xz-utils
|
||||||
wget -c -q https://ziglang.org/builds/zig-${{ env.ZIG_BUILD_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C .
|
wget -c -q https://ziglang.org/builds/zig-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C .
|
||||||
|
|
||||||
- name: Cache Zig test build artifacts
|
- name: Cache Zig test build artifacts
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
zig-cache
|
zig-cache
|
||||||
zig-out
|
zig-out
|
||||||
key: integration-test-zig-${{ env.ZIG_BUILD_VERSION }}
|
key: integration-test-zig-${{ env.ZIG_VERSION }}
|
||||||
|
|
||||||
- name: Build Stdlib test binary
|
- name: Build Stdlib test binary
|
||||||
# TODO: maybe uploading the built binary to GHA artifact would be helpful to reproduce the failure locally.
|
# TODO: maybe uploading the built binary to GHA artifact would be helpful to reproduce the failure locally.
|
||||||
@@ -77,7 +77,9 @@ jobs:
|
|||||||
|
|
||||||
tinygo:
|
tinygo:
|
||||||
name: TinyGo
|
name: TinyGo
|
||||||
|
# TODO: make it matrix over OSes once the next release is published.
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Until https://github.com/tinygo-org/tinygo/pull/3399 is released in 0.27.0,
|
# Until https://github.com/tinygo-org/tinygo/pull/3399 is released in 0.27.0,
|
||||||
# use the artifact from the GitHub Actions on the TinyGo repository.
|
# use the artifact from the GitHub Actions on the TinyGo repository.
|
||||||
@@ -92,7 +94,7 @@ jobs:
|
|||||||
path:
|
path:
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/.cache/tinygo
|
~/.cache/tinygo
|
||||||
key: integration-test-tinygo-${{ env.TINYGO_RUN_ID }}-${{ env.GO_VERSION }}
|
key: integration-test-tinygo-${{ env.TINYGO_RUN_ID }}-${{ env.GO_VERSION }}-${{ matrix.os }}
|
||||||
|
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
@@ -125,7 +127,7 @@ jobs:
|
|||||||
- name: Run all standard library tests
|
- name: Run all standard library tests
|
||||||
# Running all tests is pretty slow (~8min), so only do it on the main branch.
|
# Running all tests is pretty slow (~8min), so only do it on the main branch.
|
||||||
if: ${{ github.event_name == 'push' }}
|
if: ${{ github.event_name == 'push' }}
|
||||||
# The list of packages are derived from:
|
# The following list of packages is derived from:
|
||||||
# https://github.com/tinygo-org/tinygo/blob/v0.26.0/Makefile#L271-L319
|
# https://github.com/tinygo-org/tinygo/blob/v0.26.0/Makefile#L271-L319
|
||||||
# Note: index/suffixarray is extremely slow, so skip it.
|
# Note: index/suffixarray is extremely slow, so skip it.
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -71,17 +71,15 @@ wasm stack trace:
|
|||||||
bin: dwarftestdata.ZigWasm,
|
bin: dwarftestdata.ZigWasm,
|
||||||
exp: `module[] function[_start] failed: wasm error: unreachable
|
exp: `module[] function[_start] failed: wasm error: unreachable
|
||||||
wasm stack trace:
|
wasm stack trace:
|
||||||
.os.abort()
|
|
||||||
0x1b3: /os.zig:552:9
|
|
||||||
.builtin.default_panic(i32,i32,i32,i32)
|
.builtin.default_panic(i32,i32,i32,i32)
|
||||||
0x86: /builtin.zig:787:25
|
0x37: /builtin.zig:858:17
|
||||||
.main.main() i32
|
.main.main() i32
|
||||||
0x25: main.zig:10:5 (inlined)
|
0x60: /main.zig:10:5 (inlined)
|
||||||
main.zig:6:5 (inlined)
|
/main.zig:6:5 (inlined)
|
||||||
main.zig:2:5
|
/main.zig:2:5
|
||||||
._start()
|
._start()
|
||||||
0x1c6: /start.zig:614:37 (inlined)
|
0x6a: /start.zig:616:37 (inlined)
|
||||||
/start.zig:240:42`,
|
/start.zig:232:5`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "rust",
|
name: "rust",
|
||||||
@@ -189,7 +187,7 @@ wasm stack trace:
|
|||||||
}
|
}
|
||||||
|
|
||||||
sanitizedTraces := strings.Join(sanitizedLines, "\n")
|
sanitizedTraces := strings.Join(sanitizedLines, "\n")
|
||||||
require.Equal(t, sanitizedTraces, lang.exp)
|
require.Equal(t, lang.exp, sanitizedTraces)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
3
examples/allocation/zig/testdata/build.zig
vendored
3
examples/allocation/zig/testdata/build.zig
vendored
@@ -7,7 +7,8 @@ pub fn build(b: *std.build.Builder) void {
|
|||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
const lib = b.addSharedLibrary("greet", "greet.zig", .unversioned);
|
const lib = b.addSharedLibrary("greet", "greet.zig", .unversioned);
|
||||||
lib.setTarget(CrossTarget{ .cpu_arch = .wasm32, .os_tag = .freestanding });
|
lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
|
||||||
|
lib.rdynamic = true;
|
||||||
lib.setBuildMode(mode);
|
lib.setBuildMode(mode);
|
||||||
lib.install();
|
lib.install();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -17,10 +17,10 @@ fn main() {
|
|||||||
},
|
},
|
||||||
"stat" => {
|
"stat" => {
|
||||||
main_stat();
|
main_stat();
|
||||||
},
|
}
|
||||||
_ => {
|
_ => {
|
||||||
writeln!(io::stderr(), "unknown command: {}", args[1]).unwrap();
|
writeln!(io::stderr(), "unknown command: {}", args[1]).unwrap();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,10 +28,10 @@ fn main() {
|
|||||||
fn main_ls(dir_name: &String) {
|
fn main_ls(dir_name: &String) {
|
||||||
match fs::read_dir(dir_name) {
|
match fs::read_dir(dir_name) {
|
||||||
Ok(paths) => {
|
Ok(paths) => {
|
||||||
for path in paths {
|
for ent in paths.into_iter() {
|
||||||
println!("{}", path.unwrap().path().display());
|
println!("{}", ent.unwrap().path().display());
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if let Some(error_code) = e.raw_os_error() {
|
if let Some(error_code) = e.raw_os_error() {
|
||||||
if error_code == ENOTDIR {
|
if error_code == ENOTDIR {
|
||||||
@@ -49,7 +49,7 @@ fn main_ls(dir_name: &String) {
|
|||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
fn main_stat() {
|
fn main_stat() {
|
||||||
unsafe{
|
unsafe {
|
||||||
println!("stdin isatty: {}", libc::isatty(0) != 0);
|
println!("stdin isatty: {}", libc::isatty(0) != 0);
|
||||||
println!("stdout isatty: {}", libc::isatty(1) != 0);
|
println!("stdout isatty: {}", libc::isatty(1) != 0);
|
||||||
println!("stderr isatty: {}", libc::isatty(2) != 0);
|
println!("stderr isatty: {}", libc::isatty(2) != 0);
|
||||||
|
|||||||
Binary file not shown.
@@ -11,7 +11,8 @@ pub fn main() !void {
|
|||||||
defer std.process.argsFree(allocator, args);
|
defer std.process.argsFree(allocator, args);
|
||||||
|
|
||||||
if (std.mem.eql(u8, args[1], "ls")) {
|
if (std.mem.eql(u8, args[1], "ls")) {
|
||||||
var dir = std.fs.openIterableDir(args[2], .{}) catch |err| switch (err) {
|
// TODO: This only looks at fd 3. See #1077
|
||||||
|
var dir = std.fs.cwd().openIterableDir(args[2], .{}) catch |err| switch (err) {
|
||||||
error.NotDir => {
|
error.NotDir => {
|
||||||
try stdout.print("ENOTDIR\n", .{});
|
try stdout.print("ENOTDIR\n", .{});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ pub fn build(b: *std.build.Builder) void {
|
|||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
const exe = b.addExecutable("main", "main.zig");
|
const exe = b.addExecutable("main", "main.zig");
|
||||||
exe.setTarget(CrossTarget{ .cpu_arch = .wasm32, .os_tag = .wasi });
|
// Don't use wasi because this calls os_exit on panic. An ExitError isn't
|
||||||
|
// wrapped due to logic in FromRecovered.
|
||||||
|
// TODO: Find another way to avoid re-wrapping!
|
||||||
|
exe.setTarget(CrossTarget{ .cpu_arch = .wasm32, .os_tag = .freestanding });
|
||||||
exe.setBuildMode(mode);
|
exe.setBuildMode(mode);
|
||||||
exe.install();
|
exe.install();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
|||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
@call(.{ .modifier = .always_inline }, inlined_a, .{});
|
@call(.always_inline, inlined_a, .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inlined_a() void {
|
fn inlined_a() void {
|
||||||
@call(.{ .modifier = .always_inline }, inlined_b, .{});
|
@call(.always_inline, inlined_b, .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inlined_b() void {
|
fn inlined_b() void {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ func TestDWARFLines_Line_Zig(t *testing.T) {
|
|||||||
|
|
||||||
// codeSecStart is the beginning of the code section in the Wasm binary.
|
// codeSecStart is the beginning of the code section in the Wasm binary.
|
||||||
// If dwarftestdata.ZigWasm has been changed, we need to inspect by `wasm-tools objdump`.
|
// If dwarftestdata.ZigWasm has been changed, we need to inspect by `wasm-tools objdump`.
|
||||||
const codeSecStart = 0x108
|
const codeSecStart = 0x46
|
||||||
|
|
||||||
// These cases are crafted by matching the stack trace result from wasmtime. To verify, run:
|
// These cases are crafted by matching the stack trace result from wasmtime. To verify, run:
|
||||||
//
|
//
|
||||||
@@ -85,32 +85,29 @@ func TestDWARFLines_Line_Zig(t *testing.T) {
|
|||||||
// Caused by:
|
// Caused by:
|
||||||
// 0: failed to invoke command default
|
// 0: failed to invoke command default
|
||||||
// 1: error while executing at wasm backtrace:
|
// 1: error while executing at wasm backtrace:
|
||||||
// 0: 0x2bb - os.abort
|
// 0: 0x7d - builtin.default_panic
|
||||||
// at /Users/mathetake/zig-macos-aarch64-0.11.0-dev.618+096d3efae/lib/std/os.zig:552:9
|
// at /Users/adrian/Downloads/zig-macos-x86_64-0.11.0-dev.1499+23b7d2889/lib/std/builtin.zig:858:17
|
||||||
// 1: 0x18e - builtin.default_panic
|
// 1: 0xa6 - main.inlined_b
|
||||||
// at /Users/mathetake/zig-macos-aarch64-0.11.0-dev.618+096d3efae/lib/std/builtin.zig:787:25
|
// at /Users/adrian/oss/wazero/internal/testing/dwarftestdata/testdata/zig/main.zig:10:5 - main.inlined_a
|
||||||
// 2: 0x12d - main.inlined_b
|
// at /Users/adrian/oss/wazero/internal/testing/dwarftestdata/testdata/zig/main.zig:6:5 - main.main
|
||||||
// at ././main.zig:10:5 - main.inlined_a
|
// at /Users/adrian/oss/wazero/internal/testing/dwarftestdata/testdata/zig/main.zig:2:5
|
||||||
// at ././main.zig:6:5 - main.main
|
// 2: 0xb0 - start.callMain
|
||||||
// at ././main.zig:2:5
|
// at /Users/adrian/Downloads/zig-macos-x86_64-0.11.0-dev.1499+23b7d2889/lib/std/start.zig:616:37 - _start
|
||||||
// 3: 0x2ce - start.callMain
|
// at /Users/adrian/Downloads/zig-macos-x86_64-0.11.0-dev.1499+23b7d2889/lib/std/start.zig:232:5
|
||||||
// at /Users/mathetake/zig-macos-aarch64-0.11.0-dev.618+096d3efae/lib/std/start.zig:614:37 - _start
|
|
||||||
// at /Users/mathetake/zig-macos-aarch64-0.11.0-dev.618+096d3efae/lib/std/start.zig:240:42
|
|
||||||
// 2: wasm trap: wasm `unreachable` instruction executed
|
// 2: wasm trap: wasm `unreachable` instruction executed
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
offset uint64
|
offset uint64
|
||||||
exp []string
|
exp []string
|
||||||
}{
|
}{
|
||||||
{offset: 0x2bb - codeSecStart, exp: []string{"lib/std/os.zig:552:9"}},
|
{offset: 0x7d - codeSecStart, exp: []string{"lib/std/builtin.zig:858:17"}},
|
||||||
{offset: 0x18e - codeSecStart, exp: []string{"lib/std/builtin.zig:787:25"}},
|
{offset: 0xa6 - codeSecStart, exp: []string{
|
||||||
{offset: 0x12d - codeSecStart, exp: []string{
|
|
||||||
"main.zig:10:5 (inlined)",
|
"main.zig:10:5 (inlined)",
|
||||||
"main.zig:6:5 (inlined)",
|
"main.zig:6:5 (inlined)",
|
||||||
"main.zig:2:5",
|
"main.zig:2:5",
|
||||||
}},
|
}},
|
||||||
{offset: 0x2ce - codeSecStart, exp: []string{
|
{offset: 0xb0 - codeSecStart, exp: []string{
|
||||||
"lib/std/start.zig:614:37 (inlined)",
|
"lib/std/start.zig:616:37 (inlined)",
|
||||||
"lib/std/start.zig:240:42",
|
"lib/std/start.zig:232:5",
|
||||||
}},
|
}},
|
||||||
} {
|
} {
|
||||||
tc := tc
|
tc := tc
|
||||||
|
|||||||
Reference in New Issue
Block a user