@impz/testing 6.5.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +87 -39
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -18834,7 +18834,11 @@ import { createImpClient as createImpClient2, watchEvents } from "@impz/client";
18834
18834
  // packages/daemon/src/vm/storage/data-layout.ts
18835
18835
  import { mkdirSync } from "fs";
18836
18836
  import { join } from "path";
18837
- var UFFD_RUN_FILES = { socket: "uffd.sock", pidFile: "uffd.pid" };
18837
+ var UFFD_RUN_FILES = {
18838
+ socket: "uffd.sock",
18839
+ pidFile: "uffd.pid",
18840
+ statsFile: "uffd.stats"
18841
+ };
18838
18842
  var DATA_DIRS = ["db", "system", "images", "imps"];
18839
18843
  function createDataDirs(dataDir) {
18840
18844
  for (const name of DATA_DIRS) {
@@ -18864,6 +18868,7 @@ function buildImpPaths(dataDir, impId) {
18864
18868
  pidFile: join(runDir, "pid"),
18865
18869
  uffdSocket: join(runDir, UFFD_RUN_FILES.socket),
18866
18870
  uffdPidFile: join(runDir, UFFD_RUN_FILES.pidFile),
18871
+ uffdStatsFile: join(runDir, UFFD_RUN_FILES.statsFile),
18867
18872
  ...buildSnapshotPaths(join(directory, "snapshot")),
18868
18873
  vmIdentity: join(directory, "vm.json"),
18869
18874
  checkpointsDir: join(directory, "checkpoints"),
@@ -21961,13 +21966,13 @@ function parseKsmConfig(parsed) {
21961
21966
  }
21962
21967
 
21963
21968
  // packages/daemon/src/create-impd.ts
21964
- import { readFileSync as readFileSync37 } from "fs";
21969
+ import { readFileSync as readFileSync38 } from "fs";
21965
21970
  import { release as release2 } from "os";
21966
21971
  import { join as join48 } from "path";
21967
21972
  // packages/daemon/package.json
21968
21973
  var package_default = {
21969
21974
  name: "@impz/daemon",
21970
- version: "6.5.0",
21975
+ version: "6.6.0",
21971
21976
  private: true,
21972
21977
  description: "impd: the imp host daemon",
21973
21978
  type: "module",
@@ -24141,6 +24146,12 @@ function writeRegularFile(path, text) {
24141
24146
  closeSync2(fd);
24142
24147
  }
24143
24148
  }
24149
+ function createZeroedFile(path, sizeBytes) {
24150
+ const fd = openRegularFile(path, constants.O_RDWR, 420);
24151
+ ftruncateSync(fd, 0);
24152
+ ftruncateSync(fd, sizeBytes);
24153
+ return fd;
24154
+ }
24144
24155
  function readRegularFile(path) {
24145
24156
  const fd = openSync2(path, constants.O_RDONLY | SAFE_FLAGS);
24146
24157
  try {
@@ -37526,6 +37537,7 @@ async function createImpdFirewall(config, deps, secretFiles, plan) {
37526
37537
  }
37527
37538
 
37528
37539
  // packages/daemon/src/create-impd-imps.ts
37540
+ import { readFileSync as readFileSync25 } from "fs";
37529
37541
  import { availableParallelism } from "os";
37530
37542
 
37531
37543
  // packages/daemon/src/host-net/net/tap-bytes.ts
@@ -42547,6 +42559,11 @@ function readDiskMib(path) {
42547
42559
  }
42548
42560
  }
42549
42561
 
42562
+ // packages/daemon/src/imps/imps/format-page-handler.ts
42563
+ function formatPageHandler(stats) {
42564
+ return stats === undefined ? "" : `; page handler faults=${String(stats.faults)} blocks=${String(stats.blocks)} serve=${String(stats.serveMs)}ms`;
42565
+ }
42566
+
42550
42567
  // packages/daemon/src/imps/imps/pick-huge-pages.ts
42551
42568
  function pickHugePages(isOn, imp) {
42552
42569
  return isOn && imp.maxMemoryMib <= imp.memoryMib && imp.memoryMib % 2 === 0 ? "2M" : "None";
@@ -42628,10 +42645,11 @@ function makeWakeImpVm(deps) {
42628
42645
  return startAfterFailedWake(imp, paths, wrong);
42629
42646
  }
42630
42647
  const wakeMs = Math.round(performance.now() - started);
42631
- getImpdLogger("imps").with({ imp: imp.name }).info("woke pid {pid} in {wakeMs}ms {timings}", {
42648
+ getImpdLogger("imps").with({ imp: imp.name }).info("woke pid {pid} in {wakeMs}ms {timings}{pageHandler}", {
42632
42649
  pid: String(woken.pid),
42633
42650
  wakeMs: String(wakeMs),
42634
- timings: formatTimings(woken.timings)
42651
+ timings: formatTimings(woken.timings),
42652
+ pageHandler: formatPageHandler(woken.pageHandler)
42635
42653
  });
42636
42654
  if (hugePages === "None") {
42637
42655
  writeHostPagesIdentity(imp, paths);
@@ -43206,10 +43224,11 @@ function probeSealedEntry(paths, path) {
43206
43224
  const entry = lstatSync3(path);
43207
43225
  const uffdSocket = join21(paths.runDir, UFFD_RUN_FILES.socket);
43208
43226
  const uffdPidFile = join21(paths.runDir, UFFD_RUN_FILES.pidFile);
43227
+ const uffdStatsFile = join21(paths.runDir, UFFD_RUN_FILES.statsFile);
43209
43228
  if (path === paths.apiSocket || path === paths.vsockSocket || path === uffdSocket) {
43210
43229
  return entry.isSocket();
43211
43230
  }
43212
- return (path === paths.logFile || path === paths.pidFile || path === uffdPidFile) && entry.isFile() && entry.uid === IMPD_USER.uid && entry.nlink === 1;
43231
+ return (path === paths.logFile || path === paths.pidFile || path === uffdPidFile || path === uffdStatsFile) && entry.isFile() && entry.uid === IMPD_USER.uid && entry.nlink === 1;
43213
43232
  }
43214
43233
  function setupImpdDir(directory) {
43215
43234
  setupRealDir(directory);
@@ -43254,6 +43273,16 @@ function readOwnerUid(path) {
43254
43273
 
43255
43274
  // packages/daemon/src/vm/vmm/uffd-handler.ts
43256
43275
  import { closeSync as closeSync10, existsSync as existsSync13, openSync as openSync8, rmSync as rmSync20 } from "fs";
43276
+
43277
+ // packages/daemon/src/vm/vmm/uffd-stats-layout.ts
43278
+ var UFFD_STATS_OFFSETS = {
43279
+ faults: 0,
43280
+ blocks: 8,
43281
+ serveNs: 16
43282
+ };
43283
+ var UFFD_STATS_BYTES = 24;
43284
+
43285
+ // packages/daemon/src/vm/vmm/uffd-handler.ts
43257
43286
  var MEM_FILE_FD = 3;
43258
43287
  var SOCKET_WAIT_MS2 = 3000;
43259
43288
  async function startUffdHandler(plan) {
@@ -43266,11 +43295,13 @@ async function startUffdHandler(plan) {
43266
43295
  ...plan.jail === null ? [] : ["--uid", String(plan.jail.uid), "--gid", String(plan.jail.gid)]
43267
43296
  ];
43268
43297
  const memFd = openSync8(plan.memFile, "r");
43298
+ const statsFd = createZeroedFile(paths.uffdStatsFile, UFFD_STATS_BYTES);
43269
43299
  const log = setupLogFile(paths.logFile);
43270
43300
  const child = Bun.spawn(buildSpawnArgv(command, plan.cgroup?.procsPath ?? null, null), {
43271
- stdio: ["ignore", log, log, memFd]
43301
+ stdio: ["ignore", log, log, memFd, statsFd]
43272
43302
  });
43273
43303
  closeSync10(memFd);
43304
+ closeSync10(statsFd);
43274
43305
  closeSync10(log);
43275
43306
  child.unref();
43276
43307
  writeRegularFile(paths.uffdPidFile, `${String(child.pid)}
@@ -43289,6 +43320,15 @@ function removeUffdFiles(paths) {
43289
43320
  rmSync20(paths.uffdSocket, { force: true });
43290
43321
  rmSync20(`${paths.uffdSocket}.new`, { force: true });
43291
43322
  rmSync20(paths.uffdPidFile, { force: true });
43323
+ rmSync20(paths.uffdStatsFile, { force: true });
43324
+ }
43325
+ function readUffdStats(paths, readFile) {
43326
+ const raw = readFile(paths.uffdStatsFile);
43327
+ return {
43328
+ faults: Number(raw.readBigUInt64LE(UFFD_STATS_OFFSETS.faults)),
43329
+ blocks: Number(raw.readBigUInt64LE(UFFD_STATS_OFFSETS.blocks)),
43330
+ serveMs: Math.round(Number(raw.readBigUInt64LE(UFFD_STATS_OFFSETS.serveNs)) / 1e6)
43331
+ };
43292
43332
  }
43293
43333
  function readHandlerState(paths, procRoot = "/proc") {
43294
43334
  if (!existsSync13(paths.uffdPidFile)) {
@@ -45160,11 +45200,12 @@ var UFFD_WATCH_INTERVAL_MS = 100;
45160
45200
  var WAKE_AGENT_DEADLINE_MS = 1e4;
45161
45201
  var GUEST_MEMORY_TIMEOUTS = { requestMs: 1000, snapshotMs: 1000 };
45162
45202
  var UPTIME_PING_TIMEOUT_MS = 250;
45163
- function createVmRunner(jails, options = {}) {
45203
+ function createVmRunner(jails, options) {
45164
45204
  const mergeWrapper = options.mergeWrapper ?? null;
45165
45205
  const sendUptimePing = options.sendUptimePing ?? sendPing;
45166
45206
  const procRoot = options.procRoot ?? "/proc";
45167
45207
  const createClient = options.createClient ?? createFirecrackerClient;
45208
+ const readFile = options.readFile;
45168
45209
  const uffdHandlerBin = options.uffdHandlerBin ?? null;
45169
45210
  const uffdWatch = createUffdWatch({
45170
45211
  probeVmAlive: (pid, paths) => probeProcessAlive(pid, paths.apiSocket, procRoot),
@@ -45395,7 +45436,8 @@ ${readLogTail(plan.paths.logFile)}`, {
45395
45436
  firecrackerVersion,
45396
45437
  agentVersion: ping.version,
45397
45438
  timings: timer.marks,
45398
- bootId: ping.bootId
45439
+ bootId: ping.bootId,
45440
+ ...isUffd && { pageHandler: readUffdStats(plan.paths, readFile) }
45399
45441
  };
45400
45442
  } catch (error) {
45401
45443
  const reason = explainUffdFailure(plan.paths, procRoot, getErrorMessage(error));
@@ -45494,7 +45536,8 @@ function createImpdImps(config, deps, parts) {
45494
45536
  killCgroup: cgroups.kill
45495
45537
  }), {
45496
45538
  mergeWrapper: config.ksm?.execBin ?? null,
45497
- uffdHandlerBin: config.hugePages?.handlerBin ?? null
45539
+ uffdHandlerBin: config.hugePages?.handlerBin ?? null,
45540
+ readFile: readFileSync25
45498
45541
  });
45499
45542
  const {
45500
45543
  readVmRam,
@@ -50099,7 +50142,7 @@ function planRootfsOverhead(treeBytes) {
50099
50142
  }
50100
50143
 
50101
50144
  // packages/daemon/src/imps/images/rootfs/unpack-export.ts
50102
- import { readFileSync as readFileSync25 } from "fs";
50145
+ import { readFileSync as readFileSync26 } from "fs";
50103
50146
  var CAP_SETFCAP_BIT = 31n;
50104
50147
  var SETFCAP_HELP = "imp-host needs CAP_SETFCAP (docs/architecture/host.md#privileges)";
50105
50148
  var UNPACK_TAR_ARGS = [
@@ -50141,7 +50184,7 @@ function findXattrFailure(stderr) {
50141
50184
  });
50142
50185
  return failures.find((failure) => failure.missingSetfcap) ?? failures[0] ?? null;
50143
50186
  }
50144
- function readSetfcapWarning(status = readFileSync25("/proc/self/status", "utf8")) {
50187
+ function readSetfcapWarning(status = readFileSync26("/proc/self/status", "utf8")) {
50145
50188
  const effective = /^CapEff:\s*(?<mask>[0-9a-f]+)$/mu.exec(status)?.groups?.["mask"] ?? "0";
50146
50189
  if (BigInt(`0x${effective}`) >> CAP_SETFCAP_BIT & 1n) {
50147
50190
  return null;
@@ -51627,12 +51670,12 @@ function createTailnetAccess(config, deps, readStatus) {
51627
51670
  }
51628
51671
 
51629
51672
  // packages/daemon/src/identity/token.ts
51630
- import { existsSync as existsSync21, readFileSync as readFileSync26, writeFileSync as writeFileSync9 } from "fs";
51673
+ import { existsSync as existsSync21, readFileSync as readFileSync27, writeFileSync as writeFileSync9 } from "fs";
51631
51674
  import { join as join34 } from "path";
51632
51675
  function loadOrCreateToken(dataDir) {
51633
51676
  const path = join34(dataDir, "token");
51634
51677
  if (existsSync21(path)) {
51635
- return readFileSync26(path, "utf8").trim();
51678
+ return readFileSync27(path, "utf8").trim();
51636
51679
  }
51637
51680
  const token = mintSecret();
51638
51681
  writeFileSync9(path, `${token}
@@ -52969,13 +53012,13 @@ function createPublicRecordsLink() {
52969
53012
 
52970
53013
  // packages/daemon/src/network/tailnet-names/host-id.ts
52971
53014
  import { randomBytes as randomBytes11 } from "crypto";
52972
- import { existsSync as existsSync22, mkdirSync as mkdirSync23, readFileSync as readFileSync27, writeFileSync as writeFileSync10 } from "fs";
53015
+ import { existsSync as existsSync22, mkdirSync as mkdirSync23, readFileSync as readFileSync28, writeFileSync as writeFileSync10 } from "fs";
52973
53016
  import { join as join36 } from "path";
52974
53017
  function loadOrCreateHostId(dataDir) {
52975
53018
  const directory = join36(dataDir, "tailnet-names");
52976
53019
  const path = join36(directory, "host-id");
52977
53020
  if (existsSync22(path)) {
52978
- return readFileSync27(path, "utf8").trim();
53021
+ return readFileSync28(path, "utf8").trim();
52979
53022
  }
52980
53023
  mkdirSync23(directory, { recursive: true });
52981
53024
  const id = randomBytes11(16).toString("hex");
@@ -52985,7 +53028,7 @@ function loadOrCreateHostId(dataDir) {
52985
53028
  }
52986
53029
 
52987
53030
  // packages/daemon/src/network/tailnet-names/oauth-credential.ts
52988
- import { readFileSync as readFileSync28, statSync as statSync14 } from "fs";
53031
+ import { readFileSync as readFileSync29, statSync as statSync14 } from "fs";
52989
53032
  import * as z92 from "zod";
52990
53033
  var CredentialSchema = z92.object({ clientId: z92.string().min(1), clientSecret: z92.string().min(1) });
52991
53034
  function readOAuthCredential(path) {
@@ -53001,7 +53044,7 @@ function readOAuthCredential(path) {
53001
53044
  }
53002
53045
  function readJson(path) {
53003
53046
  try {
53004
- return JSON.parse(readFileSync28(path, "utf8"));
53047
+ return JSON.parse(readFileSync29(path, "utf8"));
53005
53048
  } catch {
53006
53049
  return null;
53007
53050
  }
@@ -53398,7 +53441,7 @@ async function startOtlpExport(env, version) {
53398
53441
  }
53399
53442
 
53400
53443
  // packages/daemon/src/network/https/wire-https-service.ts
53401
- import { readFileSync as readFileSync30 } from "fs";
53444
+ import { readFileSync as readFileSync31 } from "fs";
53402
53445
 
53403
53446
  // packages/daemon/src/platform/db/exposure.ts
53404
53447
  async function readPublicImp(db, name) {
@@ -53593,7 +53636,7 @@ function formatAcmeError(error) {
53593
53636
  }
53594
53637
 
53595
53638
  // packages/daemon/src/network/https/acme/cert-store.ts
53596
- import { existsSync as existsSync23, mkdirSync as mkdirSync24, readFileSync as readFileSync29, rmSync as rmSync29 } from "fs";
53639
+ import { existsSync as existsSync23, mkdirSync as mkdirSync24, readFileSync as readFileSync30, rmSync as rmSync29 } from "fs";
53597
53640
  import { join as join37 } from "path";
53598
53641
  import * as z95 from "zod";
53599
53642
  var AttemptStateSchema = z95.object({
@@ -53675,7 +53718,7 @@ ${certificate.chainPem.trimEnd()}
53675
53718
  };
53676
53719
  }
53677
53720
  function readIfExists(path) {
53678
- return existsSync23(path) ? readFileSync29(path, "utf8") : null;
53721
+ return existsSync23(path) ? readFileSync30(path, "utf8") : null;
53679
53722
  }
53680
53723
  function parseJson(text) {
53681
53724
  try {
@@ -54481,7 +54524,7 @@ function wireHttpsService(options) {
54481
54524
  const issue = createAcmeIssuer({
54482
54525
  directoryUrl: config.acmeDirectory,
54483
54526
  email: config.acmeEmail,
54484
- caPem: config.acmeCaFile === null ? null : readFileSync30(config.acmeCaFile, "utf8"),
54527
+ caPem: config.acmeCaFile === null ? null : readFileSync31(config.acmeCaFile, "utf8"),
54485
54528
  store,
54486
54529
  dns
54487
54530
  });
@@ -55068,7 +55111,7 @@ function buildTooMany() {
55068
55111
 
55069
55112
  // packages/daemon/src/surface/ssh/host-key.ts
55070
55113
  var import_ssh22 = __toESM(require_lib2(), 1);
55071
- import { existsSync as existsSync24, mkdirSync as mkdirSync25, readFileSync as readFileSync31, writeFileSync as writeFileSync11 } from "fs";
55114
+ import { existsSync as existsSync24, mkdirSync as mkdirSync25, readFileSync as readFileSync32, writeFileSync as writeFileSync11 } from "fs";
55072
55115
  import { join as join38 } from "path";
55073
55116
  function setupSshDir(dataDir) {
55074
55117
  const directory = join38(dataDir, "ssh");
@@ -55078,7 +55121,7 @@ function setupSshDir(dataDir) {
55078
55121
  function loadOrCreateHostKey(sshDir) {
55079
55122
  const path = join38(sshDir, "host_key");
55080
55123
  if (existsSync24(path)) {
55081
- return readFileSync31(path, "utf8");
55124
+ return readFileSync32(path, "utf8");
55082
55125
  }
55083
55126
  const pair = generateEd25519Key();
55084
55127
  writeFileSync11(path, pair.private, { mode: 384, flag: "wx" });
@@ -56243,7 +56286,7 @@ async function stopImpd(parts, options) {
56243
56286
  }
56244
56287
 
56245
56288
  // packages/daemon/src/vm/storage/create-storage-backend.ts
56246
- import { existsSync as existsSync31, readFileSync as readFileSync35, readdirSync as readdirSync14, writeFileSync as writeFileSync14 } from "fs";
56289
+ import { existsSync as existsSync31, readFileSync as readFileSync36, readdirSync as readdirSync14, writeFileSync as writeFileSync14 } from "fs";
56247
56290
  import { join as join47 } from "path";
56248
56291
 
56249
56292
  // packages/daemon/src/vm/storage/xfs-backend.ts
@@ -56314,7 +56357,7 @@ import {
56314
56357
  copyFileSync as copyFileSync4,
56315
56358
  existsSync as existsSync25,
56316
56359
  mkdirSync as mkdirSync26,
56317
- readFileSync as readFileSync32,
56360
+ readFileSync as readFileSync33,
56318
56361
  readdirSync as readdirSync10,
56319
56362
  renameSync as renameSync6,
56320
56363
  rmSync as rmSync30,
@@ -56328,7 +56371,7 @@ function createXfsBackups(ctx) {
56328
56371
  const freshCopies = new Set;
56329
56372
  const readCopies = () => {
56330
56373
  try {
56331
- return CopiesSchema.parse(JSON.parse(readFileSync32(backup.copies, "utf8")));
56374
+ return CopiesSchema.parse(JSON.parse(readFileSync33(backup.copies, "utf8")));
56332
56375
  } catch {
56333
56376
  return {};
56334
56377
  }
@@ -56423,13 +56466,13 @@ function removeUnlisted(directory, keep) {
56423
56466
  }
56424
56467
 
56425
56468
  // packages/daemon/src/vm/storage/loop-backing-file.ts
56426
- import { readFileSync as readFileSync33, realpathSync, statfsSync } from "fs";
56469
+ import { readFileSync as readFileSync34, realpathSync, statfsSync } from "fs";
56427
56470
  import { dirname as dirname12, join as join40 } from "path";
56428
56471
  var HOST_DIRS = { procDir: "/proc", sysDir: "/sys" };
56429
56472
  function readLoopBackingFile(directory, hostDirs = HOST_DIRS) {
56430
56473
  try {
56431
56474
  const target = realpathSync(directory);
56432
- const mountInfo = readFileSync33(join40(hostDirs.procDir, "self", "mountinfo"), "utf8");
56475
+ const mountInfo = readFileSync34(join40(hostDirs.procDir, "self", "mountinfo"), "utf8");
56433
56476
  for (const line of mountInfo.split(`
56434
56477
  `)) {
56435
56478
  const [mounts = "", fields = ""] = line.split(" - ");
@@ -56438,7 +56481,7 @@ function readLoopBackingFile(directory, hostDirs = HOST_DIRS) {
56438
56481
  const loop = /^\/dev\/(?<name>loop\d+)$/u.exec(source)?.groups?.["name"];
56439
56482
  if (mountPoint === target && loop !== undefined) {
56440
56483
  const backing = join40(hostDirs.sysDir, "block", loop, "loop", "backing_file");
56441
- return readFileSync33(backing, "utf8").trim();
56484
+ return readFileSync34(backing, "utf8").trim();
56442
56485
  }
56443
56486
  }
56444
56487
  } catch {}
@@ -56779,7 +56822,7 @@ function isSharedExtent(extent) {
56779
56822
  }
56780
56823
 
56781
56824
  // packages/daemon/src/vm/storage/zfs/zfs-backend.ts
56782
- import { existsSync as existsSync30, mkdirSync as mkdirSync28, readFileSync as readFileSync34, rmdirSync as rmdirSync3, writeFileSync as writeFileSync13 } from "fs";
56825
+ import { existsSync as existsSync30, mkdirSync as mkdirSync28, readFileSync as readFileSync35, rmdirSync as rmdirSync3, writeFileSync as writeFileSync13 } from "fs";
56783
56826
  import { join as join46 } from "path";
56784
56827
 
56785
56828
  // packages/daemon/src/platform/process/run-stream.ts
@@ -58041,7 +58084,7 @@ function createZfsBackend(deps) {
58041
58084
  }
58042
58085
  function readZfsModuleVersion() {
58043
58086
  try {
58044
- return readFileSync34("/sys/module/zfs/version", "utf8").trim();
58087
+ return readFileSync35("/sys/module/zfs/version", "utf8").trim();
58045
58088
  } catch {
58046
58089
  return null;
58047
58090
  }
@@ -58085,7 +58128,7 @@ function createBackend(config, boundaries) {
58085
58128
  }
58086
58129
  function checkStorageMarker(dataDir, kind) {
58087
58130
  const marker = join47(dataDir, MARKER_FILE);
58088
- const recorded = existsSync31(marker) ? readFileSync35(marker, "utf8").trim() : readUnmarked(dataDir);
58131
+ const recorded = existsSync31(marker) ? readFileSync36(marker, "utf8").trim() : readUnmarked(dataDir);
58089
58132
  if (recorded !== null && recorded !== kind) {
58090
58133
  throw new Error(`${dataDir} holds ${recorded} storage, but IMP_STORAGE_BACKEND is ${kind}; moving imps between backends is not supported`);
58091
58134
  }
@@ -58104,7 +58147,7 @@ function readUnmarked(dataDir) {
58104
58147
  }
58105
58148
 
58106
58149
  // packages/daemon/src/vm/storage/setup-system-files.ts
58107
- import { existsSync as existsSync32, mkdirSync as mkdirSync29, readFileSync as readFileSync36 } from "fs";
58150
+ import { existsSync as existsSync32, mkdirSync as mkdirSync29, readFileSync as readFileSync37 } from "fs";
58108
58151
  import { dirname as dirname15 } from "path";
58109
58152
 
58110
58153
  // packages/daemon/src/vm/storage/system-file-info.ts
@@ -58140,7 +58183,7 @@ async function setupSystemFiles(config) {
58140
58183
  const missing = config.kernelSource === null ? " and no source is configured" : "";
58141
58184
  throw new Error(`${kernelSource} does not exist${missing}`);
58142
58185
  }
58143
- const kernel = readFileSync36(kernelSource);
58186
+ const kernel = readFileSync37(kernelSource);
58144
58187
  const guestKernel = readKernelInfo(kernel);
58145
58188
  if (config.kernelSource !== null && !probeContent(config.kernelPath, kernel)) {
58146
58189
  writeCopy(config.kernelSource, config.kernelPath);
@@ -58160,7 +58203,7 @@ async function setupSystemFiles(config) {
58160
58203
  };
58161
58204
  }
58162
58205
  function probeContent(path, content) {
58163
- return existsSync32(path) && Buffer.from(content).equals(readFileSync36(path));
58206
+ return existsSync32(path) && Buffer.from(content).equals(readFileSync37(path));
58164
58207
  }
58165
58208
  function writeCopy(source, target) {
58166
58209
  mkdirSync29(dirname15(target), { recursive: true });
@@ -58385,7 +58428,7 @@ async function startImpdParts(config, boundaries, plan) {
58385
58428
  readTailnetNames: tailnetNames === null ? null : tailnetNames.readStatus,
58386
58429
  hostReaders: {
58387
58430
  readKernel: () => deps.hostKernelRelease ?? release2(),
58388
- readCpuInfo: deps.readCpuInfo ?? (() => readFileSync37("/proc/cpuinfo", "utf8")),
58431
+ readCpuInfo: deps.readCpuInfo ?? (() => readFileSync38("/proc/cpuinfo", "utf8")),
58389
58432
  readHugePagePool: deps.imps?.readHugePagePool ?? (() => readHugePagePool())
58390
58433
  },
58391
58434
  isReady: () => state.ready,
@@ -58634,7 +58677,8 @@ function buildStubVmm() {
58634
58677
  uptimeMs: 60000,
58635
58678
  identityReset: "ok",
58636
58679
  hasBootId: true,
58637
- bootSteps: {}
58680
+ bootSteps: {},
58681
+ pageHandler: undefined
58638
58682
  };
58639
58683
  const guestMemory = new Map;
58640
58684
  const readFakeGuestMemory = (directory) => {
@@ -58756,7 +58800,8 @@ log tail`);
58756
58800
  return {
58757
58801
  ...vm,
58758
58802
  hugePages: plan.hugePages ?? "None",
58759
- bootId: bootIds.get(plan.paths.apiSocket)
58803
+ bootId: bootIds.get(plan.paths.apiSocket),
58804
+ ...plan.hugePages === "2M" && { pageHandler: guest.pageHandler }
58760
58805
  };
58761
58806
  } finally {
58762
58807
  usedSnapshots.add(plan.paths.snapshotDir);
@@ -58966,6 +59011,9 @@ log tail`);
58966
59011
  setGuestBootSteps: (steps) => {
58967
59012
  guest.bootSteps = steps;
58968
59013
  },
59014
+ setPageHandlerStats: (stats) => {
59015
+ guest.pageHandler = stats;
59016
+ },
58969
59017
  setIdentityReset: (result) => {
58970
59018
  guest.identityReset = result;
58971
59019
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/testing",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "ts-pattern": "^5.9.2",
44
44
  "xstate": "^5.33.3",
45
45
  "zod": "^4.6.7",
46
- "@impz/client": "6.5.0"
46
+ "@impz/client": "6.6.0"
47
47
  },
48
48
  "engines": {
49
49
  "bun": ">=1.4.3"