Skip to content

Commit

Permalink
integration test: attach a test directory to test file system
Browse files Browse the repository at this point in the history
  • Loading branch information
saza-ku committed Apr 9, 2024
1 parent dc59c77 commit b08f46c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
22 changes: 11 additions & 11 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ const BuildParams = struct {
fn new(b: *Build) Self {
var params = BuildParams{};

const test_option = b.option(bool, "test", "run tests");
if (test_option) |t| {
params.is_test = t;
if (t) {
createTestDir() catch unreachable;
params.dir_path = TEST_DIR_PATH;
}
} else {
params.is_test = false;
}

const obj_path_option = b.option([]const u8, "app-obj", "object file of application");
if (obj_path_option) |p| {
params.obj_path = p;
Expand All @@ -50,6 +39,17 @@ const BuildParams = struct {
params.dir_path = null;
}

const test_option = b.option(bool, "test", "run tests");
if (test_option) |t| {
params.is_test = t;
if (t) {
createTestDir() catch unreachable;
params.dir_path = TEST_DIR_PATH;
}
} else {
params.is_test = false;
}

return params;
}

Expand Down
1 change: 1 addition & 0 deletions src/fs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ fn oct2int(oct: []const u8, len: usize) u32 {
pub fn init() void {
// check if fs is enabled
if (!options.has_fs) {
log.debug.print("file system is not attached\n");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wasi.zig
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ fn testServerSocket(base: usize) bool {
log.fatal.printf("sock_open failed: res={d}\n", .{@intFromEnum(res)});
return false;
}
if (!(fd1.* == 4)) {
if (!(fd1.* == 5)) {
log.fatal.printf("sock_open failed: fd={d}\n", .{fd1.*});
return false;
}
Expand Down

0 comments on commit b08f46c

Please sign in to comment.