Skip to content

Commit

Permalink
use setCwd in create_testdb fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultra-Code committed Oct 4, 2024
1 parent fa790d8 commit 825c6a5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ const builtin = @import("builtin");
const mem = std.mem;
const Build = std.Build;
const Step = Build.Step;
const MakeOptions = if (@hasDecl(Step, "MakeOptions"))
Step.MakeOptions
else
std.Progress.Node;

pub fn build(b: *Build) void {
if (comptime !checkVersion())
Expand Down Expand Up @@ -158,6 +154,11 @@ pub fn build(b: *Build) void {
// "mtest6.c", // disabled as it requires building liblmdb with MDB_DEBUG
};

const MakeOptions = if (@hasDecl(Step, "MakeOptions"))
Step.MakeOptions
else
std.Progress.Node;

const test_step = b.step("test", "Run lmdb tests");
const run_create_testdb = struct {
fn makeFn(step: *Step, options: MakeOptions) !void {
Expand All @@ -180,10 +181,8 @@ pub fn build(b: *Build) void {

fn create_testdb(owner: *Build, test_dirname: Build.LazyPath) *Step {
const run = Step.Run.create(owner, "create testdb at the generated path");
run.cwd = test_dirname;
run.step.makeFn = makeFn;

test_dirname.addStepDependencies(&run.step);
run.setCwd(test_dirname);

return &run.step;
}
Expand Down

0 comments on commit 825c6a5

Please sign in to comment.