Skip to content

Commit

Permalink
fixup! feat(cli): build based on configuration
Browse files Browse the repository at this point in the history
sqfs drive
  • Loading branch information
tuler committed Oct 16, 2024
1 parent 59ec222 commit 0909525
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
23 changes: 22 additions & 1 deletion apps/cli/test/builder/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("when building with the docker builder", () => {
);
});

tmpdirTest("should build a docker drive", async ({ tmpdir }) => {
tmpdirTest("should build an ext2 drive", async ({ tmpdir }) => {
const destination = tmpdir;
const drive: DockerDriveConfig = {
builder: "docker",
Expand All @@ -60,5 +60,26 @@ describe("when building with the docker builder", () => {
target: undefined,
};
await build("root", drive, image, destination);
const filename = path.join(destination, "root.ext2");
const stat = fs.statSync(filename);
expect(stat.size).toEqual(76087296);
});

tmpdirTest("should build a sqfs drive", async ({ tmpdir }) => {
const destination = tmpdir;
const drive: DockerDriveConfig = {
builder: "docker",
context: path.join(__dirname, "data"),
dockerfile: path.join(__dirname, "data", "Dockerfile"),
extraSize: 0,
format: "sqfs",
tags: [],
image: undefined,
target: undefined,
};
await build("root", drive, image, destination);
const filename = path.join(destination, "root.sqfs");
const stat = fs.statSync(filename);
expect(stat.size).toEqual(29327360);
});
});
16 changes: 15 additions & 1 deletion apps/cli/test/builder/tar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("when building with the tar builder", () => {
);
});

tmpdirTest("should build a tar drive", async ({ tmpdir }) => {
tmpdirTest("should build a ext2 drive", async ({ tmpdir }) => {
const destination = tmpdir;
const drive: TarDriveConfig = {
builder: "tar",
Expand All @@ -34,4 +34,18 @@ describe("when building with the tar builder", () => {
const stat = fs.statSync(filename);
expect(stat.size).toEqual(36864);
});

tmpdirTest("should build a sqfs drive", async ({ tmpdir }) => {
const destination = tmpdir;
const drive: TarDriveConfig = {
builder: "tar",
filename: path.join(__dirname, "data", "data.tar"),
extraSize: 0,
format: "sqfs",
};
await build("root", drive, image, destination);
const filename = path.join(destination, "root.sqfs");
const stat = fs.statSync(filename);
expect(stat.size).toEqual(4096);
});
});

0 comments on commit 0909525

Please sign in to comment.