Source commit: 750f29790fe2046599fbe5b5d06fdb63d92fabff Public tree identity: sha256:02326e08850bb287585789733ea5f3f153e1f7f3fd88afcc24e249107df91506
58 lines
1.6 KiB
JavaScript
Executable file
58 lines
1.6 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
|
|
const assert = require("assert");
|
|
const cp = require("child_process");
|
|
const fs = require("fs");
|
|
const os = require("os");
|
|
const path = require("path");
|
|
|
|
const repo = path.resolve(__dirname, "..");
|
|
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "disasmer-cli-install-"));
|
|
const installRoot = path.join(temp, "install");
|
|
const targetDir = path.join(temp, "target");
|
|
const project = path.join(repo, "examples/launch-build-demo");
|
|
const binName = process.platform === "win32" ? "disasmer.exe" : "disasmer";
|
|
const installedBin = path.join(installRoot, "bin", binName);
|
|
|
|
try {
|
|
cp.execFileSync(
|
|
"cargo",
|
|
[
|
|
"install",
|
|
"--path",
|
|
"crates/disasmer-cli",
|
|
"--bin",
|
|
"disasmer",
|
|
"--root",
|
|
installRoot,
|
|
"--debug"
|
|
],
|
|
{
|
|
cwd: repo,
|
|
env: {
|
|
...process.env,
|
|
CARGO_TARGET_DIR: targetDir
|
|
},
|
|
stdio: "inherit"
|
|
}
|
|
);
|
|
|
|
assert(fs.existsSync(installedBin), "installed disasmer binary must exist");
|
|
|
|
const inspection = JSON.parse(
|
|
cp.execFileSync(
|
|
installedBin,
|
|
["bundle", "inspect", "--project", project],
|
|
{ cwd: repo, encoding: "utf8" }
|
|
)
|
|
);
|
|
|
|
assert.strictEqual(inspection.project, project);
|
|
assert.strictEqual(inspection.metadata.embeds_full_container_images, false);
|
|
assert(inspection.metadata.environments.some((env) => env.name === "linux"));
|
|
assert(inspection.metadata.selected_inputs.some((input) => input.path === "src/build.rs"));
|
|
} finally {
|
|
fs.rmSync(temp, { recursive: true, force: true });
|
|
}
|
|
|
|
console.log("CLI install smoke passed");
|