@@ -15,6 +15,7 @@ const stack_size = 32 * 1024 * 1024;
15
15
16
16
pub fn build (b : * Builder ) ! void {
17
17
b .setPreferredReleaseMode (.ReleaseFast );
18
+ const test_step = b .step ("test" , "Run all the tests" );
18
19
const mode = b .standardReleaseOptions ();
19
20
const target = b .standardTargetOptions (.{});
20
21
const single_threaded = b .option (bool , "single-threaded" , "Build artifacts that run in single threaded mode" );
@@ -39,8 +40,6 @@ pub fn build(b: *Builder) !void {
39
40
const docs_step = b .step ("docs" , "Build documentation" );
40
41
docs_step .dependOn (& docgen_cmd .step );
41
42
42
- const toolchain_step = b .step ("test-toolchain" , "Run the tests for the toolchain" );
43
-
44
43
var test_cases = b .addTest ("src/test.zig" );
45
44
test_cases .stack_size = stack_size ;
46
45
test_cases .setBuildMode (mode );
@@ -64,10 +63,9 @@ pub fn build(b: *Builder) !void {
64
63
65
64
const only_install_lib_files = b .option (bool , "lib-files-only" , "Only install library files" ) orelse false ;
66
65
67
- const is_stage1 = b .option (bool , "stage1" , "Build the stage1 compiler, put stage2 behind a feature flag" ) orelse false ;
68
- const omit_stage2 = b .option (bool , "omit-stage2" , "Do not include stage2 behind a feature flag inside stage1" ) orelse false ;
66
+ const have_stage1 = b .option (bool , "enable-stage1" , "Include the stage1 compiler behind a feature flag" ) orelse false ;
69
67
const static_llvm = b .option (bool , "static-llvm" , "Disable integration with system-installed LLVM, Clang, LLD, and libc++" ) orelse false ;
70
- const enable_llvm = b .option (bool , "enable-llvm" , "Build self-hosted compiler with LLVM backend enabled" ) orelse (is_stage1 or static_llvm );
68
+ const enable_llvm = b .option (bool , "enable-llvm" , "Build self-hosted compiler with LLVM backend enabled" ) orelse (have_stage1 or static_llvm );
71
69
const llvm_has_m68k = b .option (
72
70
bool ,
73
71
"llvm-has-m68k" ,
@@ -137,7 +135,7 @@ pub fn build(b: *Builder) !void {
137
135
};
138
136
139
137
const main_file : ? []const u8 = mf : {
140
- if (! is_stage1 ) break :mf "src/main.zig" ;
138
+ if (! have_stage1 ) break :mf "src/main.zig" ;
141
139
if (use_zig0 ) break :mf null ;
142
140
break :mf "src/stage1.zig" ;
143
141
};
@@ -150,7 +148,7 @@ pub fn build(b: *Builder) !void {
150
148
exe .setBuildMode (mode );
151
149
exe .setTarget (target );
152
150
if (! skip_stage2_tests ) {
153
- toolchain_step .dependOn (& exe .step );
151
+ test_step .dependOn (& exe .step );
154
152
}
155
153
156
154
b .default_step .dependOn (& exe .step );
@@ -248,7 +246,7 @@ pub fn build(b: *Builder) !void {
248
246
}
249
247
};
250
248
251
- if (is_stage1 ) {
249
+ if (have_stage1 ) {
252
250
const softfloat = b .addStaticLibrary ("softfloat" , null );
253
251
softfloat .setBuildMode (.ReleaseFast );
254
252
softfloat .setTarget (target );
@@ -360,8 +358,7 @@ pub fn build(b: *Builder) !void {
360
358
exe_options .addOption (bool , "enable_tracy_callstack" , tracy_callstack );
361
359
exe_options .addOption (bool , "enable_tracy_allocation" , tracy_allocation );
362
360
exe_options .addOption (bool , "value_tracing" , value_tracing );
363
- exe_options .addOption (bool , "is_stage1" , is_stage1 );
364
- exe_options .addOption (bool , "omit_stage2" , omit_stage2 );
361
+ exe_options .addOption (bool , "have_stage1" , have_stage1 );
365
362
if (tracy ) | tracy_path | {
366
363
const client_cpp = fs .path .join (
367
364
b .allocator ,
@@ -396,8 +393,7 @@ pub fn build(b: *Builder) !void {
396
393
test_cases_options .addOption (bool , "enable_link_snapshots" , enable_link_snapshots );
397
394
test_cases_options .addOption (bool , "skip_non_native" , skip_non_native );
398
395
test_cases_options .addOption (bool , "skip_stage1" , skip_stage1 );
399
- test_cases_options .addOption (bool , "is_stage1" , is_stage1 );
400
- test_cases_options .addOption (bool , "omit_stage2" , omit_stage2 );
396
+ test_cases_options .addOption (bool , "have_stage1" , have_stage1 );
401
397
test_cases_options .addOption (bool , "have_llvm" , enable_llvm );
402
398
test_cases_options .addOption (bool , "llvm_has_m68k" , llvm_has_m68k );
403
399
test_cases_options .addOption (bool , "llvm_has_csky" , llvm_has_csky );
@@ -418,7 +414,7 @@ pub fn build(b: *Builder) !void {
418
414
const test_cases_step = b .step ("test-cases" , "Run the main compiler test cases" );
419
415
test_cases_step .dependOn (& test_cases .step );
420
416
if (! skip_stage2_tests ) {
421
- toolchain_step .dependOn (test_cases_step );
417
+ test_step .dependOn (test_cases_step );
422
418
}
423
419
424
420
var chosen_modes : [4 ]builtin.Mode = undefined ;
@@ -442,11 +438,11 @@ pub fn build(b: *Builder) !void {
442
438
const modes = chosen_modes [0.. chosen_mode_index ];
443
439
444
440
// run stage1 `zig fmt` on this build.zig file just to make sure it works
445
- toolchain_step .dependOn (& fmt_build_zig .step );
441
+ test_step .dependOn (& fmt_build_zig .step );
446
442
const fmt_step = b .step ("test-fmt" , "Run zig fmt against build.zig to make sure it works" );
447
443
fmt_step .dependOn (& fmt_build_zig .step );
448
444
449
- toolchain_step .dependOn (tests .addPkgTests (
445
+ test_step .dependOn (tests .addPkgTests (
450
446
b ,
451
447
test_filter ,
452
448
"test/behavior.zig" ,
@@ -457,11 +453,10 @@ pub fn build(b: *Builder) !void {
457
453
skip_non_native ,
458
454
skip_libc ,
459
455
skip_stage1 ,
460
- omit_stage2 ,
461
- is_stage1 ,
456
+ skip_stage2_tests ,
462
457
));
463
458
464
- toolchain_step .dependOn (tests .addPkgTests (
459
+ test_step .dependOn (tests .addPkgTests (
465
460
b ,
466
461
test_filter ,
467
462
"lib/compiler_rt.zig" ,
@@ -472,11 +467,10 @@ pub fn build(b: *Builder) !void {
472
467
skip_non_native ,
473
468
true , // skip_libc
474
469
skip_stage1 ,
475
- omit_stage2 or true , // TODO get these all passing
476
- is_stage1 ,
470
+ skip_stage2_tests or true , // TODO get these all passing
477
471
));
478
472
479
- toolchain_step .dependOn (tests .addPkgTests (
473
+ test_step .dependOn (tests .addPkgTests (
480
474
b ,
481
475
test_filter ,
482
476
"lib/c.zig" ,
@@ -487,37 +481,36 @@ pub fn build(b: *Builder) !void {
487
481
skip_non_native ,
488
482
true , // skip_libc
489
483
skip_stage1 ,
490
- omit_stage2 or true , // TODO get these all passing
491
- is_stage1 ,
484
+ skip_stage2_tests or true , // TODO get these all passing
492
485
));
493
486
494
- toolchain_step .dependOn (tests .addCompareOutputTests (b , test_filter , modes ));
495
- toolchain_step .dependOn (tests .addStandaloneTests (
487
+ test_step .dependOn (tests .addCompareOutputTests (b , test_filter , modes ));
488
+ test_step .dependOn (tests .addStandaloneTests (
496
489
b ,
497
490
test_filter ,
498
491
modes ,
499
492
skip_non_native ,
500
493
enable_macos_sdk ,
501
494
target ,
502
- omit_stage2 ,
495
+ skip_stage2_tests ,
503
496
b .enable_darling ,
504
497
b .enable_qemu ,
505
498
b .enable_rosetta ,
506
499
b .enable_wasmtime ,
507
500
b .enable_wine ,
508
501
));
509
- toolchain_step .dependOn (tests .addLinkTests (b , test_filter , modes , enable_macos_sdk , omit_stage2 ));
510
- toolchain_step .dependOn (tests .addStackTraceTests (b , test_filter , modes ));
511
- toolchain_step .dependOn (tests .addCliTests (b , test_filter , modes ));
512
- toolchain_step .dependOn (tests .addAssembleAndLinkTests (b , test_filter , modes ));
513
- toolchain_step .dependOn (tests .addTranslateCTests (b , test_filter ));
502
+ test_step .dependOn (tests .addLinkTests (b , test_filter , modes , enable_macos_sdk , skip_stage2_tests ));
503
+ test_step .dependOn (tests .addStackTraceTests (b , test_filter , modes ));
504
+ test_step .dependOn (tests .addCliTests (b , test_filter , modes ));
505
+ test_step .dependOn (tests .addAssembleAndLinkTests (b , test_filter , modes ));
506
+ test_step .dependOn (tests .addTranslateCTests (b , test_filter ));
514
507
if (! skip_run_translated_c ) {
515
- toolchain_step .dependOn (tests .addRunTranslatedCTests (b , test_filter , target ));
508
+ test_step .dependOn (tests .addRunTranslatedCTests (b , test_filter , target ));
516
509
}
517
510
// tests for this feature are disabled until we have the self-hosted compiler available
518
- // toolchain_step .dependOn(tests.addGenHTests(b, test_filter));
511
+ // test_step .dependOn(tests.addGenHTests(b, test_filter));
519
512
520
- const std_step = tests .addPkgTests (
513
+ test_step . dependOn ( tests .addPkgTests (
521
514
b ,
522
515
test_filter ,
523
516
"lib/std/std.zig" ,
@@ -528,14 +521,8 @@ pub fn build(b: *Builder) !void {
528
521
skip_non_native ,
529
522
skip_libc ,
530
523
skip_stage1 ,
531
- omit_stage2 or true , // TODO get these all passing
532
- is_stage1 ,
533
- );
534
-
535
- const test_step = b .step ("test" , "Run all the tests" );
536
- test_step .dependOn (toolchain_step );
537
- test_step .dependOn (std_step );
538
- test_step .dependOn (docs_step );
524
+ true , // TODO get these all passing
525
+ ));
539
526
}
540
527
541
528
const exe_cflags = [_ ][]const u8 {
0 commit comments