test/link/macho: remove converted standalone tests

This commit is contained in:
Jakub Konka 2024-01-15 11:32:00 +01:00
parent 7bb323c0eb
commit 7dc6900018
7 changed files with 0 additions and 129 deletions

View File

@ -111,18 +111,10 @@ pub const cases = [_]Case{
.build_root = "test/link/macho/linksection",
.import = @import("link/macho/linksection/build.zig"),
},
.{
.build_root = "test/link/macho/objc",
.import = @import("link/macho/objc/build.zig"),
},
.{
.build_root = "test/link/macho/objcpp",
.import = @import("link/macho/objcpp/build.zig"),
},
.{
.build_root = "test/link/macho/pagezero",
.import = @import("link/macho/pagezero/build.zig"),
},
.{
.build_root = "test/link/macho/reexports",
.import = @import("link/macho/reexports/build.zig"),

View File

@ -1,7 +0,0 @@
#import <Foundation/Foundation.h>
@interface Foo : NSObject
- (NSString *)name;
@end

View File

@ -1,11 +0,0 @@
#import "Foo.h"
@implementation Foo
- (NSString *)name
{
NSString *str = [[NSString alloc] initWithFormat:@"Zig"];
return str;
}
@end

View File

@ -1,34 +0,0 @@
const std = @import("std");
pub const requires_symlinks = true;
pub const requires_macos_sdk = true;
pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Test it");
b.default_step = test_step;
add(b, test_step, .Debug);
add(b, test_step, .ReleaseFast);
add(b, test_step, .ReleaseSmall);
add(b, test_step, .ReleaseSafe);
}
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
const exe = b.addExecutable(.{
.name = "test",
.optimize = optimize,
.target = b.host,
});
exe.addIncludePath(.{ .path = "." });
exe.addCSourceFile(.{ .file = .{ .path = "Foo.m" }, .flags = &[0][]const u8{} });
exe.addCSourceFile(.{ .file = .{ .path = "test.m" }, .flags = &[0][]const u8{} });
exe.linkLibC();
// TODO when we figure out how to ship framework stubs for cross-compilation,
// populate paths to the sysroot here.
exe.linkFramework("Foundation");
const run_cmd = b.addRunArtifact(exe);
run_cmd.skip_foreign_checks = true;
run_cmd.expectStdOutEqual("");
test_step.dependOn(&run_cmd.step);
}

View File

@ -1,12 +0,0 @@
#import "Foo.h"
#import <assert.h>
int main(int argc, char *argv[])
{
@autoreleasepool {
Foo *foo = [[Foo alloc] init];
NSString *result = [foo name];
assert([result isEqualToString:@"Zig"]);
return 0;
}
}

View File

@ -1,54 +0,0 @@
const std = @import("std");
pub const requires_symlinks = true;
pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Test it");
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.resolveTargetQuery(.{ .os_tag = .macos });
{
const exe = b.addExecutable(.{
.name = "pagezero",
.optimize = optimize,
.target = target,
});
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} });
exe.linkLibC();
exe.pagezero_size = 0x4000;
const check = exe.checkObject();
check.checkInHeaders();
check.checkExact("LC 0");
check.checkExact("segname __PAGEZERO");
check.checkExact("vmaddr 0");
check.checkExact("vmsize 4000");
check.checkInHeaders();
check.checkExact("segname __TEXT");
check.checkExact("vmaddr 4000");
test_step.dependOn(&check.step);
}
{
const exe = b.addExecutable(.{
.name = "no_pagezero",
.optimize = optimize,
.target = target,
});
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} });
exe.linkLibC();
exe.pagezero_size = 0;
const check = exe.checkObject();
check.checkInHeaders();
check.checkExact("LC 0");
check.checkExact("segname __TEXT");
check.checkExact("vmaddr 0");
test_step.dependOn(&check.step);
}
}

View File

@ -1,3 +0,0 @@
int main(int argc, char* argv[]) {
return 0;
}