diff options
| -rw-r--r-- | build.zig | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -153,6 +153,8 @@ pub fn build(b: *std.build.Builder) !void { | |||
| 153 | 153 | ||
| 154 | const target = b.standardTargetOptions(.{}); | 154 | const target = b.standardTargetOptions(.{}); |
| 155 | 155 | ||
| 156 | // If the target is native we assume the user didn't change it with -Dtarget and run all test targets. | ||
| 157 | // Otherwise we run a single test target. | ||
| 156 | const test_targets = if (target.isNative()) | 158 | const test_targets = if (target.isNative()) |
| 157 | &all_test_targets | 159 | &all_test_targets |
| 158 | else | 160 | else |
| @@ -162,6 +164,12 @@ pub fn build(b: *std.build.Builder) !void { | |||
| 162 | }}; | 164 | }}; |
| 163 | 165 | ||
| 164 | const test_step = b.step("test", "Run library tests"); | 166 | const test_step = b.step("test", "Run library tests"); |
| 167 | |||
| 168 | // By default the tests will only be execute for native test targets, however they will be compiled | ||
| 169 | // for _all_ targets defined in `test_targets`. | ||
| 170 | // | ||
| 171 | // If you want to execute tests for other targets you can pass -fqemu, -fdarling, -fwine, -frosetta. | ||
| 172 | |||
| 165 | for (test_targets) |test_target| { | 173 | for (test_targets) |test_target| { |
| 166 | const bundled = use_bundled orelse test_target.bundled; | 174 | const bundled = use_bundled orelse test_target.bundled; |
| 167 | const cross_target = getTarget(test_target.target, bundled); | 175 | const cross_target = getTarget(test_target.target, bundled); |