Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration test: attach a test directory to test file system #61

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 1 addition & 8 deletions scripts/build-fs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ mkdir -p build
tar -cf build/disk.tar --format=ustar -C $dir_path .
echo "tar archive created"

# check if llvm-objcopy is installed
if ! command -v llvm-objcopy &> /dev/null
then
echo "llvm-objcopy could not be found"
exit 1
fi

# convert the archive to binary
llvm-objcopy -Ibinary -Oelf64-x86-64 build/disk.tar build/disk.o
objcopy -Ibinary -Oelf64-x86-64 build/disk.tar build/disk.o
echo "disk.o created"
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
2 changes: 1 addition & 1 deletion submodules/lwip
Submodule lwip updated from d0efd9 to 1cc153
Loading