mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
Run GTK unit tests in CI, fix broken tests (#7878)
This commit is contained in:
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@ -561,7 +561,16 @@ jobs:
|
|||||||
name: ghostty
|
name: ghostty
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
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: |
|
run: |
|
||||||
nix develop -c \
|
nix develop -c \
|
||||||
zig build \
|
zig build \
|
||||||
|
@ -103,7 +103,7 @@ pub inline fn runtimeUntil(
|
|||||||
test "atLeast" {
|
test "atLeast" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
const funs = &.{ atLeast, runtimeAtLeast, runtimeUntil };
|
const funs = &.{ atLeast, runtimeAtLeast };
|
||||||
inline for (funs) |fun| {
|
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));
|
||||||
|
|
||||||
@ -118,3 +118,23 @@ test "atLeast" {
|
|||||||
try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION - 1, c.GTK_MICRO_VERSION + 1));
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,7 +17,7 @@ test "read /proc/sys/kernel/osrelease" {
|
|||||||
if (comptime builtin.os.tag != .linux) return null;
|
if (comptime builtin.os.tag != .linux) return null;
|
||||||
const allocator = std.testing.allocator;
|
const allocator = std.testing.allocator;
|
||||||
|
|
||||||
const kernel_info = try getKernelInfo(allocator);
|
const kernel_info = getKernelInfo(allocator).?;
|
||||||
defer allocator.free(kernel_info);
|
defer allocator.free(kernel_info);
|
||||||
|
|
||||||
// Since we can't hardcode the info in tests, just check
|
// Since we can't hardcode the info in tests, just check
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
//! system. These aren't restricted to syscalls or low-level operations, but
|
//! system. These aren't restricted to syscalls or low-level operations, but
|
||||||
//! also OS-specific features and conventions.
|
//! also OS-specific features and conventions.
|
||||||
|
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
const dbus = @import("dbus.zig");
|
const dbus = @import("dbus.zig");
|
||||||
const desktop = @import("desktop.zig");
|
const desktop = @import("desktop.zig");
|
||||||
const env = @import("env.zig");
|
const env = @import("env.zig");
|
||||||
@ -14,7 +16,7 @@ const openpkg = @import("open.zig");
|
|||||||
const pipepkg = @import("pipe.zig");
|
const pipepkg = @import("pipe.zig");
|
||||||
const resourcesdir = @import("resourcesdir.zig");
|
const resourcesdir = @import("resourcesdir.zig");
|
||||||
const systemd = @import("systemd.zig");
|
const systemd = @import("systemd.zig");
|
||||||
const kernelInfo = @import("kernel_info.zig");
|
const kernel_info = @import("kernel_info.zig");
|
||||||
|
|
||||||
// Namespaces
|
// Namespaces
|
||||||
pub const args = @import("args.zig");
|
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 ResourcesDir = resourcesdir.ResourcesDir;
|
pub const ResourcesDir = resourcesdir.ResourcesDir;
|
||||||
pub const ShellEscapeWriter = shell.ShellEscapeWriter;
|
pub const ShellEscapeWriter = shell.ShellEscapeWriter;
|
||||||
pub const getKernelInfo = kernelInfo.getKernelInfo;
|
pub const getKernelInfo = kernel_info.getKernelInfo;
|
||||||
|
|
||||||
test {
|
test {
|
||||||
_ = i18n;
|
_ = i18n;
|
||||||
|
|
||||||
|
if (comptime builtin.os.tag == .linux) {
|
||||||
|
_ = kernel_info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user