diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8af7140c6..834d49a5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -561,7 +561,16 @@ jobs: name: ghostty authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Test GTK Build + - name: Test + run: | + nix develop -c \ + zig build \ + -Dapp-runtime=gtk \ + -Dgtk-x11=${{ matrix.x11 }} \ + -Dgtk-wayland=${{ matrix.wayland }} \ + test + + - name: Build run: | nix develop -c \ zig build \ diff --git a/src/apprt/gtk/gtk_version.zig b/src/apprt/gtk/gtk_version.zig index 5d75fb4fe..6f3d733a5 100644 --- a/src/apprt/gtk/gtk_version.zig +++ b/src/apprt/gtk/gtk_version.zig @@ -103,7 +103,7 @@ pub inline fn runtimeUntil( test "atLeast" { const testing = std.testing; - const funs = &.{ atLeast, runtimeAtLeast, runtimeUntil }; + const funs = &.{ atLeast, runtimeAtLeast }; inline for (funs) |fun| { try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION)); @@ -118,3 +118,23 @@ test "atLeast" { try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION - 1, c.GTK_MICRO_VERSION + 1)); } } + +test "runtimeUntil" { + const testing = std.testing; + + // This is an array in case we add a comptime variant. + const funs = &.{runtimeUntil}; + inline for (funs) |fun| { + try testing.expect(!fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION)); + + try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION + 1)); + try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION + 1, c.GTK_MICRO_VERSION)); + try testing.expect(fun(c.GTK_MAJOR_VERSION + 1, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION)); + + try testing.expect(!fun(c.GTK_MAJOR_VERSION - 1, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION)); + try testing.expect(!fun(c.GTK_MAJOR_VERSION - 1, c.GTK_MINOR_VERSION + 1, c.GTK_MICRO_VERSION)); + try testing.expect(!fun(c.GTK_MAJOR_VERSION - 1, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION + 1)); + + try testing.expect(!fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION - 1, c.GTK_MICRO_VERSION + 1)); + } +} diff --git a/src/os/kernel_info.zig b/src/os/kernel_info.zig index 9e3933dde..e57cc3047 100644 --- a/src/os/kernel_info.zig +++ b/src/os/kernel_info.zig @@ -17,7 +17,7 @@ test "read /proc/sys/kernel/osrelease" { if (comptime builtin.os.tag != .linux) return null; const allocator = std.testing.allocator; - const kernel_info = try getKernelInfo(allocator); + const kernel_info = getKernelInfo(allocator).?; defer allocator.free(kernel_info); // Since we can't hardcode the info in tests, just check diff --git a/src/os/main.zig b/src/os/main.zig index 7398fc779..41dc6aa29 100644 --- a/src/os/main.zig +++ b/src/os/main.zig @@ -2,6 +2,8 @@ //! system. These aren't restricted to syscalls or low-level operations, but //! also OS-specific features and conventions. +const builtin = @import("builtin"); + const dbus = @import("dbus.zig"); const desktop = @import("desktop.zig"); const env = @import("env.zig"); @@ -14,7 +16,7 @@ const openpkg = @import("open.zig"); const pipepkg = @import("pipe.zig"); const resourcesdir = @import("resourcesdir.zig"); const systemd = @import("systemd.zig"); -const kernelInfo = @import("kernel_info.zig"); +const kernel_info = @import("kernel_info.zig"); // Namespaces pub const args = @import("args.zig"); @@ -59,8 +61,12 @@ pub const pipe = pipepkg.pipe; pub const resourcesDir = resourcesdir.resourcesDir; pub const ResourcesDir = resourcesdir.ResourcesDir; pub const ShellEscapeWriter = shell.ShellEscapeWriter; -pub const getKernelInfo = kernelInfo.getKernelInfo; +pub const getKernelInfo = kernel_info.getKernelInfo; test { _ = i18n; + + if (comptime builtin.os.tag == .linux) { + _ = kernel_info; + } }