| ... | @@ -168,6 +168,15 @@ fn printOutput( | ... | @@ -168,6 +168,15 @@ fn printOutput( |
| 168 | try build_args.appendSlice(&[_][]const u8{ "-target", triple }); | 168 | try build_args.appendSlice(&[_][]const u8{ "-target", triple }); |
| 169 | try shell_out.print("-target {s} ", .{triple}); | 169 | try shell_out.print("-target {s} ", .{triple}); |
| 170 | } | 170 | } |
| | 171 | if (code.use_llvm) |use_llvm| { |
| | 172 | if (use_llvm) { |
| | 173 | try build_args.append("-fllvm"); |
| | 174 | try shell_out.print("-fllvm", .{}); |
| | 175 | } else { |
| | 176 | try build_args.append("-fno-llvm"); |
| | 177 | try shell_out.print("-fno-llvm", .{}); |
| | 178 | } |
| | 179 | } |
| 171 | if (code.verbose_cimport) { | 180 | if (code.verbose_cimport) { |
| 172 | try build_args.append("--verbose-cimport"); | 181 | try build_args.append("--verbose-cimport"); |
| 173 | try shell_out.print("--verbose-cimport ", .{}); | 182 | try shell_out.print("--verbose-cimport ", .{}); |
| ... | @@ -224,7 +233,6 @@ fn printOutput( | ... | @@ -224,7 +233,6 @@ fn printOutput( |
| 224 | break :code_block; | 233 | break :code_block; |
| 225 | } | 234 | } |
| 226 | } | 235 | } |
| 227 | | | |
| 228 | const target_query = try std.Target.Query.parse(.{ | 236 | const target_query = try std.Target.Query.parse(.{ |
| 229 | .arch_os_abi = code.target_str orelse "native", | 237 | .arch_os_abi = code.target_str orelse "native", |
| 230 | }); | 238 | }); |
| ... | @@ -319,6 +327,16 @@ fn printOutput( | ... | @@ -319,6 +327,16 @@ fn printOutput( |
| 319 | }, | 327 | }, |
| 320 | } | 328 | } |
| 321 | } | 329 | } |
| | 330 | if (code.use_llvm) |use_llvm| { |
| | 331 | if (use_llvm) { |
| | 332 | try test_args.append("-fllvm"); |
| | 333 | try shell_out.print("-fllvm", .{}); |
| | 334 | } else { |
| | 335 | try test_args.append("-fno-llvm"); |
| | 336 | try shell_out.print("-fno-llvm", .{}); |
| | 337 | } |
| | 338 | } |
| | 339 | |
| 322 | const result = run(arena, &env_map, tmp_dir_path, test_args.items) catch | 340 | const result = run(arena, &env_map, tmp_dir_path, test_args.items) catch |
| 323 | fatal("test failed", .{}); | 341 | fatal("test failed", .{}); |
| 324 | const escaped_stderr = try escapeHtml(arena, result.stderr); | 342 | const escaped_stderr = try escapeHtml(arena, result.stderr); |
| ... | @@ -469,6 +487,15 @@ fn printOutput( | ... | @@ -469,6 +487,15 @@ fn printOutput( |
| 469 | try build_args.appendSlice(&[_][]const u8{ "-target", triple }); | 487 | try build_args.appendSlice(&[_][]const u8{ "-target", triple }); |
| 470 | try shell_out.print("-target {s} ", .{triple}); | 488 | try shell_out.print("-target {s} ", .{triple}); |
| 471 | } | 489 | } |
| | 490 | if (code.use_llvm) |use_llvm| { |
| | 491 | if (use_llvm) { |
| | 492 | try build_args.append("-fllvm"); |
| | 493 | try shell_out.print("-fllvm", .{}); |
| | 494 | } else { |
| | 495 | try build_args.append("-fno-llvm"); |
| | 496 | try shell_out.print("-fno-llvm", .{}); |
| | 497 | } |
| | 498 | } |
| 472 | for (code.additional_options) |option| { | 499 | for (code.additional_options) |option| { |
| 473 | try build_args.append(option); | 500 | try build_args.append(option); |
| 474 | try shell_out.print("{s} ", .{option}); | 501 | try shell_out.print("{s} ", .{option}); |
| ... | @@ -538,6 +565,15 @@ fn printOutput( | ... | @@ -538,6 +565,15 @@ fn printOutput( |
| 538 | try test_args.appendSlice(&[_][]const u8{ "-target", triple }); | 565 | try test_args.appendSlice(&[_][]const u8{ "-target", triple }); |
| 539 | try shell_out.print("-target {s} ", .{triple}); | 566 | try shell_out.print("-target {s} ", .{triple}); |
| 540 | } | 567 | } |
| | 568 | if (code.use_llvm) |use_llvm| { |
| | 569 | if (use_llvm) { |
| | 570 | try test_args.append("-fllvm"); |
| | 571 | try shell_out.print("-fllvm", .{}); |
| | 572 | } else { |
| | 573 | try test_args.append("-fno-llvm"); |
| | 574 | try shell_out.print("-fno-llvm", .{}); |
| | 575 | } |
| | 576 | } |
| 541 | if (code.link_mode) |link_mode| { | 577 | if (code.link_mode) |link_mode| { |
| 542 | switch (link_mode) { | 578 | switch (link_mode) { |
| 543 | .static => { | 579 | .static => { |
| ... | @@ -827,6 +863,7 @@ const Code = struct { | ... | @@ -827,6 +863,7 @@ const Code = struct { |
| 827 | verbose_cimport: bool, | 863 | verbose_cimport: bool, |
| 828 | just_check_syntax: bool, | 864 | just_check_syntax: bool, |
| 829 | additional_options: []const []const u8, | 865 | additional_options: []const []const u8, |
| | 866 | use_llvm: ?bool, |
| 830 | | 867 | |
| 831 | const Id = union(enum) { | 868 | const Id = union(enum) { |
| 832 | @"test", | 869 | @"test", |
| ... | @@ -886,6 +923,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { | ... | @@ -886,6 +923,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { |
| 886 | var link_libc = false; | 923 | var link_libc = false; |
| 887 | var disable_cache = false; | 924 | var disable_cache = false; |
| 888 | var verbose_cimport = false; | 925 | var verbose_cimport = false; |
| | 926 | var use_llvm: ?bool = null; |
| 889 | | 927 | |
| 890 | while (it.next()) |prefixed_line| { | 928 | while (it.next()) |prefixed_line| { |
| 891 | const line = skipPrefix(prefixed_line); | 929 | const line = skipPrefix(prefixed_line); |
| ... | @@ -901,6 +939,10 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { | ... | @@ -901,6 +939,10 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { |
| 901 | try additional_options.append(arena, line["additional_option=".len..]); | 939 | try additional_options.append(arena, line["additional_option=".len..]); |
| 902 | } else if (mem.startsWith(u8, line, "target=")) { | 940 | } else if (mem.startsWith(u8, line, "target=")) { |
| 903 | target_str = line["target=".len..]; | 941 | target_str = line["target=".len..]; |
| | 942 | } else if (mem.eql(u8, line, "llvm=true")) { |
| | 943 | use_llvm = true; |
| | 944 | } else if (mem.eql(u8, line, "llvm=false")) { |
| | 945 | use_llvm = false; |
| 904 | } else if (mem.eql(u8, line, "link_libc")) { | 946 | } else if (mem.eql(u8, line, "link_libc")) { |
| 905 | link_libc = true; | 947 | link_libc = true; |
| 906 | } else if (mem.eql(u8, line, "disable_cache")) { | 948 | } else if (mem.eql(u8, line, "disable_cache")) { |
| ... | @@ -923,6 +965,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { | ... | @@ -923,6 +965,7 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { |
| 923 | .disable_cache = disable_cache, | 965 | .disable_cache = disable_cache, |
| 924 | .verbose_cimport = verbose_cimport, | 966 | .verbose_cimport = verbose_cimport, |
| 925 | .just_check_syntax = just_check_syntax, | 967 | .just_check_syntax = just_check_syntax, |
| | 968 | .use_llvm = use_llvm, |
| 926 | }; | 969 | }; |
| 927 | } | 970 | } |
| 928 | | 971 | |