mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 22:04:21 +00:00
test-cli: port build options test to new build system API
Since we need testing for passing `--build-file` and `--cache-dir` together anyway, use it to test the disabled build options test.
This commit is contained in:
parent
fe855691f6
commit
cdba1d591a
2 changed files with 18 additions and 11 deletions
|
|
@ -8,7 +8,7 @@ pub fn build(b: *std.Build) void {
|
||||||
}) });
|
}) });
|
||||||
|
|
||||||
const options = b.addOptions();
|
const options = b.addOptions();
|
||||||
main.addOptions("build_options", options);
|
main.root_module.addOptions("build_options", options);
|
||||||
options.addOption(bool, "bool_true", b.option(bool, "bool_true", "t").?);
|
options.addOption(bool, "bool_true", b.option(bool, "bool_true", "t").?);
|
||||||
options.addOption(bool, "bool_false", b.option(bool, "bool_false", "f").?);
|
options.addOption(bool, "bool_false", b.option(bool, "bool_false", "f").?);
|
||||||
options.addOption(u32, "int", b.option(u32, "int", "i").?);
|
options.addOption(u32, "int", b.option(u32, "int", "i").?);
|
||||||
|
|
|
||||||
|
|
@ -1657,16 +1657,23 @@ pub fn addCliTests(b: *std.Build) *Step {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// TODO this should move to become a CLI test rather than standalone
|
const run_test = b.addSystemCommand(&.{
|
||||||
// cases.addBuildFile("test/standalone/options/build.zig", .{
|
b.graph.zig_exe,
|
||||||
// .extra_argv = &.{
|
"build",
|
||||||
// "-Dbool_true",
|
"test",
|
||||||
// "-Dbool_false=false",
|
"-Dbool_true",
|
||||||
// "-Dint=1234",
|
"-Dbool_false=false",
|
||||||
// "-De=two",
|
"-Dint=1234",
|
||||||
// "-Dstring=hello",
|
"-De=two",
|
||||||
// },
|
"-Dstring=hello",
|
||||||
// });
|
});
|
||||||
|
run_test.addArg("--build-file");
|
||||||
|
run_test.addFileArg(b.path("test/standalone/options/build.zig"));
|
||||||
|
run_test.addArg("--cache-dir");
|
||||||
|
run_test.addFileArg(.{ .cwd_relative = b.cache_root.join(b.allocator, &.{}) catch @panic("OOM") });
|
||||||
|
run_test.setName("test build options");
|
||||||
|
|
||||||
|
step.dependOn(&run_test.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue