| ... | ... | @@ -34,6 +34,7 @@ const TestTarget = struct { |
| 34 | 34 | link_libc: bool = false, |
| 35 | 35 | single_threaded: bool = false, |
| 36 | 36 | disable_native: bool = false, |
| 37 | backend: ?std.builtin.CompilerBackend = null, |
| 37 | 38 | }; |
| 38 | 39 | |
| 39 | 40 | const test_targets = blk: { |
| ... | ... | @@ -42,15 +43,73 @@ const test_targets = blk: { |
| 42 | 43 | // lot of branches) |
| 43 | 44 | @setEvalBranchQuota(50000); |
| 44 | 45 | break :blk [_]TestTarget{ |
| 45 | | TestTarget{}, |
| 46 | | TestTarget{ |
| 46 | .{}, |
| 47 | .{ |
| 47 | 48 | .link_libc = true, |
| 48 | 49 | }, |
| 49 | | TestTarget{ |
| 50 | .{ |
| 50 | 51 | .single_threaded = true, |
| 51 | 52 | }, |
| 52 | 53 | |
| 53 | | TestTarget{ |
| 54 | .{ |
| 55 | .link_libc = true, |
| 56 | .backend = .stage2_c, |
| 57 | }, |
| 58 | .{ |
| 59 | .target = .{ |
| 60 | .cpu_arch = .x86_64, |
| 61 | .os_tag = .linux, |
| 62 | .abi = .none, |
| 63 | }, |
| 64 | .backend = .stage2_x86_64, |
| 65 | }, |
| 66 | .{ |
| 67 | .target = .{ |
| 68 | .cpu_arch = .aarch64, |
| 69 | .os_tag = .linux, |
| 70 | }, |
| 71 | .backend = .stage2_aarch64, |
| 72 | }, |
| 73 | .{ |
| 74 | .target = .{ |
| 75 | .cpu_arch = .wasm32, |
| 76 | .os_tag = .wasi, |
| 77 | }, |
| 78 | .single_threaded = true, |
| 79 | .backend = .stage2_wasm, |
| 80 | }, |
| 81 | .{ |
| 82 | .target = .{ |
| 83 | .cpu_arch = .arm, |
| 84 | .os_tag = .linux, |
| 85 | }, |
| 86 | .backend = .stage2_wasm, |
| 87 | }, |
| 88 | .{ |
| 89 | .target = CrossTarget.parse(.{ |
| 90 | .arch_os_abi = "arm-linux-none", |
| 91 | .cpu_features = "generic+v8a", |
| 92 | }) catch unreachable, |
| 93 | .backend = .stage2_arm, |
| 94 | }, |
| 95 | .{ |
| 96 | .target = .{ |
| 97 | .cpu_arch = .aarch64, |
| 98 | .os_tag = .macos, |
| 99 | .abi = .gnu, |
| 100 | }, |
| 101 | .backend = .stage2_aarch64, |
| 102 | }, |
| 103 | .{ |
| 104 | .target = .{ |
| 105 | .cpu_arch = .x86_64, |
| 106 | .os_tag = .macos, |
| 107 | .abi = .gnu, |
| 108 | }, |
| 109 | .backend = .stage2_x86_64, |
| 110 | }, |
| 111 | |
| 112 | .{ |
| 54 | 113 | .target = .{ |
| 55 | 114 | .cpu_arch = .wasm32, |
| 56 | 115 | .os_tag = .wasi, |
| ... | ... | @@ -58,7 +117,7 @@ const test_targets = blk: { |
| 58 | 117 | .link_libc = false, |
| 59 | 118 | .single_threaded = true, |
| 60 | 119 | }, |
| 61 | | TestTarget{ |
| 120 | .{ |
| 62 | 121 | .target = .{ |
| 63 | 122 | .cpu_arch = .wasm32, |
| 64 | 123 | .os_tag = .wasi, |
| ... | ... | @@ -67,14 +126,14 @@ const test_targets = blk: { |
| 67 | 126 | .single_threaded = true, |
| 68 | 127 | }, |
| 69 | 128 | |
| 70 | | TestTarget{ |
| 129 | .{ |
| 71 | 130 | .target = .{ |
| 72 | 131 | .cpu_arch = .x86_64, |
| 73 | 132 | .os_tag = .linux, |
| 74 | 133 | .abi = .none, |
| 75 | 134 | }, |
| 76 | 135 | }, |
| 77 | | TestTarget{ |
| 136 | .{ |
| 78 | 137 | .target = .{ |
| 79 | 138 | .cpu_arch = .x86_64, |
| 80 | 139 | .os_tag = .linux, |
| ... | ... | @@ -82,7 +141,7 @@ const test_targets = blk: { |
| 82 | 141 | }, |
| 83 | 142 | .link_libc = true, |
| 84 | 143 | }, |
| 85 | | TestTarget{ |
| 144 | .{ |
| 86 | 145 | .target = .{ |
| 87 | 146 | .cpu_arch = .x86_64, |
| 88 | 147 | .os_tag = .linux, |
| ... | ... | @@ -91,14 +150,14 @@ const test_targets = blk: { |
| 91 | 150 | .link_libc = true, |
| 92 | 151 | }, |
| 93 | 152 | |
| 94 | | TestTarget{ |
| 153 | .{ |
| 95 | 154 | .target = .{ |
| 96 | 155 | .cpu_arch = .i386, |
| 97 | 156 | .os_tag = .linux, |
| 98 | 157 | .abi = .none, |
| 99 | 158 | }, |
| 100 | 159 | }, |
| 101 | | TestTarget{ |
| 160 | .{ |
| 102 | 161 | .target = .{ |
| 103 | 162 | .cpu_arch = .i386, |
| 104 | 163 | .os_tag = .linux, |
| ... | ... | @@ -106,7 +165,7 @@ const test_targets = blk: { |
| 106 | 165 | }, |
| 107 | 166 | .link_libc = true, |
| 108 | 167 | }, |
| 109 | | TestTarget{ |
| 168 | .{ |
| 110 | 169 | .target = .{ |
| 111 | 170 | .cpu_arch = .i386, |
| 112 | 171 | .os_tag = .linux, |
| ... | ... | @@ -115,14 +174,14 @@ const test_targets = blk: { |
| 115 | 174 | .link_libc = true, |
| 116 | 175 | }, |
| 117 | 176 | |
| 118 | | TestTarget{ |
| 177 | .{ |
| 119 | 178 | .target = .{ |
| 120 | 179 | .cpu_arch = .aarch64, |
| 121 | 180 | .os_tag = .linux, |
| 122 | 181 | .abi = .none, |
| 123 | 182 | }, |
| 124 | 183 | }, |
| 125 | | TestTarget{ |
| 184 | .{ |
| 126 | 185 | .target = .{ |
| 127 | 186 | .cpu_arch = .aarch64, |
| 128 | 187 | .os_tag = .linux, |
| ... | ... | @@ -130,7 +189,7 @@ const test_targets = blk: { |
| 130 | 189 | }, |
| 131 | 190 | .link_libc = true, |
| 132 | 191 | }, |
| 133 | | TestTarget{ |
| 192 | .{ |
| 134 | 193 | .target = .{ |
| 135 | 194 | .cpu_arch = .aarch64, |
| 136 | 195 | .os_tag = .linux, |
| ... | ... | @@ -138,7 +197,7 @@ const test_targets = blk: { |
| 138 | 197 | }, |
| 139 | 198 | .link_libc = true, |
| 140 | 199 | }, |
| 141 | | TestTarget{ |
| 200 | .{ |
| 142 | 201 | .target = .{ |
| 143 | 202 | .cpu_arch = .aarch64, |
| 144 | 203 | .os_tag = .windows, |
| ... | ... | @@ -147,13 +206,13 @@ const test_targets = blk: { |
| 147 | 206 | .link_libc = true, |
| 148 | 207 | }, |
| 149 | 208 | |
| 150 | | TestTarget{ |
| 209 | .{ |
| 151 | 210 | .target = CrossTarget.parse(.{ |
| 152 | 211 | .arch_os_abi = "arm-linux-none", |
| 153 | 212 | .cpu_features = "generic+v8a", |
| 154 | 213 | }) catch unreachable, |
| 155 | 214 | }, |
| 156 | | TestTarget{ |
| 215 | .{ |
| 157 | 216 | .target = CrossTarget.parse(.{ |
| 158 | 217 | .arch_os_abi = "arm-linux-musleabihf", |
| 159 | 218 | .cpu_features = "generic+v8a", |
| ... | ... | @@ -161,7 +220,7 @@ const test_targets = blk: { |
| 161 | 220 | .link_libc = true, |
| 162 | 221 | }, |
| 163 | 222 | // https://github.com/ziglang/zig/issues/3287 |
| 164 | | //TestTarget{ |
| 223 | //.{ |
| 165 | 224 | // .target = CrossTarget.parse(.{ |
| 166 | 225 | // .arch_os_abi = "arm-linux-gnueabihf", |
| 167 | 226 | // .cpu_features = "generic+v8a", |
| ... | ... | @@ -169,7 +228,7 @@ const test_targets = blk: { |
| 169 | 228 | // .link_libc = true, |
| 170 | 229 | //}, |
| 171 | 230 | |
| 172 | | TestTarget{ |
| 231 | .{ |
| 173 | 232 | .target = .{ |
| 174 | 233 | .cpu_arch = .mips, |
| 175 | 234 | .os_tag = .linux, |
| ... | ... | @@ -177,7 +236,7 @@ const test_targets = blk: { |
| 177 | 236 | }, |
| 178 | 237 | }, |
| 179 | 238 | |
| 180 | | TestTarget{ |
| 239 | .{ |
| 181 | 240 | .target = .{ |
| 182 | 241 | .cpu_arch = .mips, |
| 183 | 242 | .os_tag = .linux, |
| ... | ... | @@ -187,7 +246,7 @@ const test_targets = blk: { |
| 187 | 246 | }, |
| 188 | 247 | |
| 189 | 248 | // https://github.com/ziglang/zig/issues/4927 |
| 190 | | //TestTarget{ |
| 249 | //.{ |
| 191 | 250 | // .target = .{ |
| 192 | 251 | // .cpu_arch = .mips, |
| 193 | 252 | // .os_tag = .linux, |
| ... | ... | @@ -196,7 +255,7 @@ const test_targets = blk: { |
| 196 | 255 | // .link_libc = true, |
| 197 | 256 | //}, |
| 198 | 257 | |
| 199 | | TestTarget{ |
| 258 | .{ |
| 200 | 259 | .target = .{ |
| 201 | 260 | .cpu_arch = .mipsel, |
| 202 | 261 | .os_tag = .linux, |
| ... | ... | @@ -204,7 +263,7 @@ const test_targets = blk: { |
| 204 | 263 | }, |
| 205 | 264 | }, |
| 206 | 265 | |
| 207 | | TestTarget{ |
| 266 | .{ |
| 208 | 267 | .target = .{ |
| 209 | 268 | .cpu_arch = .mipsel, |
| 210 | 269 | .os_tag = .linux, |
| ... | ... | @@ -214,7 +273,7 @@ const test_targets = blk: { |
| 214 | 273 | }, |
| 215 | 274 | |
| 216 | 275 | // https://github.com/ziglang/zig/issues/4927 |
| 217 | | //TestTarget{ |
| 276 | //.{ |
| 218 | 277 | // .target = .{ |
| 219 | 278 | // .cpu_arch = .mipsel, |
| 220 | 279 | // .os_tag = .linux, |
| ... | ... | @@ -223,14 +282,14 @@ const test_targets = blk: { |
| 223 | 282 | // .link_libc = true, |
| 224 | 283 | //}, |
| 225 | 284 | |
| 226 | | TestTarget{ |
| 285 | .{ |
| 227 | 286 | .target = .{ |
| 228 | 287 | .cpu_arch = .powerpc, |
| 229 | 288 | .os_tag = .linux, |
| 230 | 289 | .abi = .none, |
| 231 | 290 | }, |
| 232 | 291 | }, |
| 233 | | TestTarget{ |
| 292 | .{ |
| 234 | 293 | .target = .{ |
| 235 | 294 | .cpu_arch = .powerpc, |
| 236 | 295 | .os_tag = .linux, |
| ... | ... | @@ -239,7 +298,7 @@ const test_targets = blk: { |
| 239 | 298 | .link_libc = true, |
| 240 | 299 | }, |
| 241 | 300 | // https://github.com/ziglang/zig/issues/2256 |
| 242 | | //TestTarget{ |
| 301 | //.{ |
| 243 | 302 | // .target = .{ |
| 244 | 303 | // .cpu_arch = .powerpc, |
| 245 | 304 | // .os_tag = .linux, |
| ... | ... | @@ -248,7 +307,7 @@ const test_targets = blk: { |
| 248 | 307 | // .link_libc = true, |
| 249 | 308 | //}, |
| 250 | 309 | |
| 251 | | TestTarget{ |
| 310 | .{ |
| 252 | 311 | .target = .{ |
| 253 | 312 | .cpu_arch = .riscv64, |
| 254 | 313 | .os_tag = .linux, |
| ... | ... | @@ -256,7 +315,7 @@ const test_targets = blk: { |
| 256 | 315 | }, |
| 257 | 316 | }, |
| 258 | 317 | |
| 259 | | TestTarget{ |
| 318 | .{ |
| 260 | 319 | .target = .{ |
| 261 | 320 | .cpu_arch = .riscv64, |
| 262 | 321 | .os_tag = .linux, |
| ... | ... | @@ -266,7 +325,7 @@ const test_targets = blk: { |
| 266 | 325 | }, |
| 267 | 326 | |
| 268 | 327 | // https://github.com/ziglang/zig/issues/3340 |
| 269 | | //TestTarget{ |
| 328 | //.{ |
| 270 | 329 | // .target = .{ |
| 271 | 330 | // .cpu_arch = .riscv64, |
| 272 | 331 | // .os = .linux, |
| ... | ... | @@ -275,7 +334,7 @@ const test_targets = blk: { |
| 275 | 334 | // .link_libc = true, |
| 276 | 335 | //}, |
| 277 | 336 | |
| 278 | | TestTarget{ |
| 337 | .{ |
| 279 | 338 | .target = .{ |
| 280 | 339 | .cpu_arch = .x86_64, |
| 281 | 340 | .os_tag = .macos, |
| ... | ... | @@ -283,7 +342,7 @@ const test_targets = blk: { |
| 283 | 342 | }, |
| 284 | 343 | }, |
| 285 | 344 | |
| 286 | | TestTarget{ |
| 345 | .{ |
| 287 | 346 | .target = .{ |
| 288 | 347 | .cpu_arch = .aarch64, |
| 289 | 348 | .os_tag = .macos, |
| ... | ... | @@ -291,7 +350,7 @@ const test_targets = blk: { |
| 291 | 350 | }, |
| 292 | 351 | }, |
| 293 | 352 | |
| 294 | | TestTarget{ |
| 353 | .{ |
| 295 | 354 | .target = .{ |
| 296 | 355 | .cpu_arch = .i386, |
| 297 | 356 | .os_tag = .windows, |
| ... | ... | @@ -299,7 +358,7 @@ const test_targets = blk: { |
| 299 | 358 | }, |
| 300 | 359 | }, |
| 301 | 360 | |
| 302 | | TestTarget{ |
| 361 | .{ |
| 303 | 362 | .target = .{ |
| 304 | 363 | .cpu_arch = .x86_64, |
| 305 | 364 | .os_tag = .windows, |
| ... | ... | @@ -307,7 +366,7 @@ const test_targets = blk: { |
| 307 | 366 | }, |
| 308 | 367 | }, |
| 309 | 368 | |
| 310 | | TestTarget{ |
| 369 | .{ |
| 311 | 370 | .target = .{ |
| 312 | 371 | .cpu_arch = .i386, |
| 313 | 372 | .os_tag = .windows, |
| ... | ... | @@ -316,7 +375,7 @@ const test_targets = blk: { |
| 316 | 375 | .link_libc = true, |
| 317 | 376 | }, |
| 318 | 377 | |
| 319 | | TestTarget{ |
| 378 | .{ |
| 320 | 379 | .target = .{ |
| 321 | 380 | .cpu_arch = .x86_64, |
| 322 | 381 | .os_tag = .windows, |
| ... | ... | @@ -326,38 +385,38 @@ const test_targets = blk: { |
| 326 | 385 | }, |
| 327 | 386 | |
| 328 | 387 | // Do the release tests last because they take a long time |
| 329 | | TestTarget{ |
| 388 | .{ |
| 330 | 389 | .mode = .ReleaseFast, |
| 331 | 390 | }, |
| 332 | | TestTarget{ |
| 391 | .{ |
| 333 | 392 | .link_libc = true, |
| 334 | 393 | .mode = .ReleaseFast, |
| 335 | 394 | }, |
| 336 | | TestTarget{ |
| 395 | .{ |
| 337 | 396 | .mode = .ReleaseFast, |
| 338 | 397 | .single_threaded = true, |
| 339 | 398 | }, |
| 340 | 399 | |
| 341 | | TestTarget{ |
| 400 | .{ |
| 342 | 401 | .mode = .ReleaseSafe, |
| 343 | 402 | }, |
| 344 | | TestTarget{ |
| 403 | .{ |
| 345 | 404 | .link_libc = true, |
| 346 | 405 | .mode = .ReleaseSafe, |
| 347 | 406 | }, |
| 348 | | TestTarget{ |
| 407 | .{ |
| 349 | 408 | .mode = .ReleaseSafe, |
| 350 | 409 | .single_threaded = true, |
| 351 | 410 | }, |
| 352 | 411 | |
| 353 | | TestTarget{ |
| 412 | .{ |
| 354 | 413 | .mode = .ReleaseSmall, |
| 355 | 414 | }, |
| 356 | | TestTarget{ |
| 415 | .{ |
| 357 | 416 | .link_libc = true, |
| 358 | 417 | .mode = .ReleaseSmall, |
| 359 | 418 | }, |
| 360 | | TestTarget{ |
| 419 | .{ |
| 361 | 420 | .mode = .ReleaseSmall, |
| 362 | 421 | .single_threaded = true, |
| 363 | 422 | }, |
| ... | ... | @@ -524,6 +583,9 @@ pub fn addPkgTests( |
| 524 | 583 | skip_single_threaded: bool, |
| 525 | 584 | skip_non_native: bool, |
| 526 | 585 | skip_libc: bool, |
| 586 | skip_stage1: bool, |
| 587 | skip_stage2: bool, |
| 588 | is_stage1: bool, |
| 527 | 589 | ) *build.Step { |
| 528 | 590 | const step = b.step(b.fmt("test-{s}", .{name}), desc); |
| 529 | 591 | |
| ... | ... | @@ -549,6 +611,11 @@ pub fn addPkgTests( |
| 549 | 611 | continue; |
| 550 | 612 | } |
| 551 | 613 | |
| 614 | if (test_target.backend) |backend| switch (backend) { |
| 615 | .stage1 => if (skip_stage1) continue, |
| 616 | else => if (skip_stage2) continue, |
| 617 | } else if (is_stage1 and skip_stage1) continue; |
| 618 | |
| 552 | 619 | const want_this_mode = for (modes) |m| { |
| 553 | 620 | if (m == test_target.mode) break true; |
| 554 | 621 | } else false; |
| ... | ... | @@ -565,12 +632,14 @@ pub fn addPkgTests( |
| 565 | 632 | |
| 566 | 633 | const these_tests = b.addTest(root_src); |
| 567 | 634 | const single_threaded_txt = if (test_target.single_threaded) "single" else "multi"; |
| 568 | | these_tests.setNamePrefix(b.fmt("{s}-{s}-{s}-{s}-{s} ", .{ |
| 635 | const backend_txt = if (test_target.backend) |backend| @tagName(backend) else "default"; |
| 636 | these_tests.setNamePrefix(b.fmt("{s}-{s}-{s}-{s}-{s}-{s} ", .{ |
| 569 | 637 | name, |
| 570 | 638 | triple_prefix, |
| 571 | 639 | @tagName(test_target.mode), |
| 572 | 640 | libc_prefix, |
| 573 | 641 | single_threaded_txt, |
| 642 | backend_txt, |
| 574 | 643 | })); |
| 575 | 644 | these_tests.single_threaded = test_target.single_threaded; |
| 576 | 645 | these_tests.setFilter(test_filter); |
| ... | ... | @@ -581,6 +650,24 @@ pub fn addPkgTests( |
| 581 | 650 | } |
| 582 | 651 | these_tests.overrideZigLibDir("lib"); |
| 583 | 652 | these_tests.addIncludePath("test"); |
| 653 | if (test_target.backend) |backend| switch (backend) { |
| 654 | .stage1 => { |
| 655 | these_tests.use_stage1 = true; |
| 656 | }, |
| 657 | .stage2_llvm => { |
| 658 | these_tests.use_stage1 = false; |
| 659 | these_tests.use_llvm = true; |
| 660 | }, |
| 661 | .stage2_c => { |
| 662 | these_tests.use_stage1 = false; |
| 663 | these_tests.use_llvm = false; |
| 664 | these_tests.ofmt = .c; |
| 665 | }, |
| 666 | else => { |
| 667 | these_tests.use_stage1 = false; |
| 668 | these_tests.use_llvm = false; |
| 669 | }, |
| 670 | }; |
| 584 | 671 | |
| 585 | 672 | step.dependOn(&these_tests.step); |
| 586 | 673 | } |