fix regressed stage2 test harness
parent
ead50ea665
commit
afac5d2895
|
@ -772,7 +772,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
|
|||
if (build_options.is_stage1 and comp.bin_file.options.use_llvm) {
|
||||
try comp.work_queue.writeItem(.{ .stage1_module = {} });
|
||||
}
|
||||
if (is_exe_or_dyn_lib) {
|
||||
if (is_exe_or_dyn_lib and comp.bin_file.options.use_llvm) {
|
||||
try comp.work_queue.writeItem(.{ .libcompiler_rt = {} });
|
||||
if (!comp.bin_file.options.link_libc) {
|
||||
try comp.work_queue.writeItem(.{ .zig_libc = {} });
|
||||
|
@ -1128,6 +1128,9 @@ pub fn performAllTheWork(self: *Compilation) error{OutOfMemory}!void {
|
|||
};
|
||||
},
|
||||
.stage1_module => {
|
||||
if (!build_options.is_stage1)
|
||||
unreachable;
|
||||
|
||||
self.updateStage1Module() catch |err| {
|
||||
fatal("unable to build stage1 zig object: {}", .{@errorName(err)});
|
||||
};
|
||||
|
@ -1685,11 +1688,13 @@ pub fn classifyFileExt(filename: []const u8) FileExt {
|
|||
test "classifyFileExt" {
|
||||
std.testing.expectEqual(FileExt.cpp, classifyFileExt("foo.cc"));
|
||||
std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.nim"));
|
||||
std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so"));
|
||||
std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so.1"));
|
||||
std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so.1.2"));
|
||||
std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so.1.2.3"));
|
||||
std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so"));
|
||||
std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1"));
|
||||
std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2"));
|
||||
std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3"));
|
||||
std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.so.1.2.3~"));
|
||||
std.testing.expectEqual(FileExt.zig, classifyFileExt("foo.zig"));
|
||||
std.testing.expectEqual(FileExt.zir, classifyFileExt("foo.zir"));
|
||||
}
|
||||
|
||||
fn haveFramePointer(comp: *Compilation) bool {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
|
||||
// ABI warning: the types and declarations in this file must match both those in
|
||||
// stage2.cpp and src-self-hosted/stage1.zig.
|
||||
// stage2.cpp and src/stage1.zig.
|
||||
|
||||
// ABI warning
|
||||
enum Error {
|
||||
|
|
14
src/test.zig
14
src/test.zig
|
@ -458,9 +458,15 @@ pub const TestContext = struct {
|
|||
.path = try std.fs.path.join(arena, &[_][]const u8{ bogus_path, "zig-cache" }),
|
||||
};
|
||||
|
||||
const tmp_src_path = if (case.extension == .Zig) "test_case.zig" else if (case.extension == .ZIR) "test_case.zir" else unreachable;
|
||||
const root_pkg = try Package.create(allocator, tmp.dir, ".", tmp_src_path);
|
||||
defer root_pkg.destroy(allocator);
|
||||
const tmp_src_path = switch (case.extension) {
|
||||
.Zig => "test_case.zig",
|
||||
.ZIR => "test_case.zir",
|
||||
};
|
||||
|
||||
var root_pkg: Package = .{
|
||||
.root_src_directory = .{ .path = bogus_path, .handle = tmp.dir },
|
||||
.root_src_path = tmp_src_path,
|
||||
};
|
||||
|
||||
const ofmt: ?std.builtin.ObjectFormat = if (case.cbe) .c else null;
|
||||
const bin_name = try std.zig.binNameAlloc(arena, "test_case", target, case.output_mode, null, ofmt);
|
||||
|
@ -486,7 +492,7 @@ pub const TestContext = struct {
|
|||
// TODO: support testing optimizations
|
||||
.optimize_mode = .Debug,
|
||||
.emit_bin = emit_bin,
|
||||
.root_pkg = root_pkg,
|
||||
.root_pkg = &root_pkg,
|
||||
.keep_source_files_loaded = true,
|
||||
.object_format = ofmt,
|
||||
.is_native_os = case.target.isNativeOs(),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
// ABI warning - src-self-hosted/windows_sdk.zig
|
||||
// ABI warning - src/windows_sdk.zig
|
||||
struct ZigWindowsSDK {
|
||||
const char *path10_ptr;
|
||||
size_t path10_len;
|
||||
|
@ -34,7 +34,7 @@ struct ZigWindowsSDK {
|
|||
size_t msvc_lib_dir_len;
|
||||
};
|
||||
|
||||
// ABI warning - src-self-hosted/windows_sdk.zig
|
||||
// ABI warning - src/windows_sdk.zig
|
||||
enum ZigFindWindowsSdkError {
|
||||
ZigFindWindowsSdkErrorNone,
|
||||
ZigFindWindowsSdkErrorOutOfMemory,
|
||||
|
@ -42,10 +42,10 @@ enum ZigFindWindowsSdkError {
|
|||
ZigFindWindowsSdkErrorPathTooLong,
|
||||
};
|
||||
|
||||
// ABI warning - src-self-hosted/windows_sdk.zig
|
||||
// ABI warning - src/windows_sdk.zig
|
||||
ZIG_EXTERN_C enum ZigFindWindowsSdkError zig_find_windows_sdk(struct ZigWindowsSDK **out_sdk);
|
||||
|
||||
// ABI warning - src-self-hosted/windows_sdk.zig
|
||||
// ABI warning - src/windows_sdk.zig
|
||||
ZIG_EXTERN_C void zig_free_windows_sdk(struct ZigWindowsSDK *sdk);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
// ATTENTION: If you modify this file, be sure to update the corresponding
|
||||
// extern function declarations in the self-hosted compiler file
|
||||
// src-self-hosted/clang.zig.
|
||||
// src/clang.zig.
|
||||
|
||||
struct ZigClangSourceLocation {
|
||||
unsigned ID;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const std = @import("std");
|
||||
const TestContext = @import("../../src-self-hosted/test.zig").TestContext;
|
||||
const TestContext = @import("../../src/test.zig").TestContext;
|
||||
|
||||
// These tests should work with all platforms, but we're using linux_x64 for
|
||||
// now for consistency. Will be expanded eventually.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const std = @import("std");
|
||||
const TestContext = @import("../../src-self-hosted/test.zig").TestContext;
|
||||
const TestContext = @import("../../src/test.zig").TestContext;
|
||||
|
||||
const spu = std.zig.CrossTarget{
|
||||
.cpu_arch = .spu_2,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const std = @import("std");
|
||||
const TestContext = @import("../../src-self-hosted/test.zig").TestContext;
|
||||
const TestContext = @import("../../src/test.zig").TestContext;
|
||||
|
||||
// Self-hosted has differing levels of support for various architectures. For now we pass explicit
|
||||
// target parameters to each test case. At some point we will take this to the next level and have
|
||||
|
@ -76,7 +76,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"Hello, World!\n",
|
||||
);
|
||||
// Now change the message only
|
||||
|
@ -108,7 +108,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"What is up? This is a longer message that will force the data to be relocated in virtual address space.\n",
|
||||
);
|
||||
// Now we print it twice.
|
||||
|
@ -184,7 +184,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"Hello, World!\n",
|
||||
);
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"Hello, World!\n",
|
||||
);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"Hello, World!\n",
|
||||
);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -362,7 +362,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -398,7 +398,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -435,7 +435,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -465,7 +465,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -499,7 +499,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -523,7 +523,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -562,7 +562,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"hello\nhello\nhello\nhello\n",
|
||||
);
|
||||
|
||||
|
@ -599,7 +599,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -641,7 +641,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -693,7 +693,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -755,7 +755,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -788,7 +788,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -820,7 +820,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -845,7 +845,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -871,7 +871,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"",
|
||||
);
|
||||
|
||||
|
@ -904,7 +904,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ );
|
||||
\\ unreachable;
|
||||
\\}
|
||||
,
|
||||
,
|
||||
"hello\nhello\nhello\nhello\nhello\n",
|
||||
);
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ bar();
|
||||
\\}
|
||||
\\fn bar() void {}
|
||||
,
|
||||
,
|
||||
"42\n",
|
||||
);
|
||||
|
||||
|
@ -941,7 +941,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ bar();
|
||||
\\}
|
||||
\\fn bar() void {}
|
||||
,
|
||||
,
|
||||
"42\n",
|
||||
);
|
||||
|
||||
|
@ -957,7 +957,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ bar();
|
||||
\\}
|
||||
\\fn bar() void {}
|
||||
,
|
||||
,
|
||||
// This is what you get when you take the bits of the IEE-754
|
||||
// representation of 42.0 and reinterpret them as an unsigned
|
||||
// integer. Guess that's a bug in wasmtime.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const std = @import("std");
|
||||
const TestContext = @import("../../src-self-hosted/test.zig").TestContext;
|
||||
const TestContext = @import("../../src/test.zig").TestContext;
|
||||
// self-hosted does not yet support PE executable files / COFF object files
|
||||
// or mach-o files. So we do the ZIR transform test cases cross compiling for
|
||||
// x86_64-linux.
|
||||
|
@ -156,7 +156,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
|||
\\ %0 = call(@a, [])
|
||||
\\ %1 = returnvoid()
|
||||
\\})
|
||||
,
|
||||
,
|
||||
&[_][]const u8{
|
||||
":18:21: error: message",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue