summaryrefslogtreecommitdiff
path: root/test/fs_namespace.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/fs_namespace.zig')
-rw-r--r--test/fs_namespace.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig
index 22ce27fe..fa6657eb 100644
--- a/test/fs_namespace.zig
+++ b/test/fs_namespace.zig
@@ -285,7 +285,7 @@ test "owned cwd failed file opens never publish a pane or retain a reservation"
try std.testing.expect(succeeded);
}
-test "images decode through explicit filesystem mounts, and a dump reads one on disk from there" {
+test "images decode through explicit filesystem mounts, and a dump's pane reads its file again through the same mount" {
if (!filesystem.platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
@@ -310,13 +310,19 @@ test "images decode through explicit filesystem mounts, and a dump reads one on
try std.testing.expectEqual(@as(usize, 1), shown.len);
try std.testing.expectEqual(@as(u32, 1), shown[0].raster.w);
try std.testing.expectEqual(@as(u32, 1), shown[0].raster.h);
- // The picture's bytes are in the dump: it comes back as it was shown
- // (a placeholder holding them, as a core without the addon keeps it).
+ // The dump keeps its path, not its bytes: restored, it reads the file
+ // again through the mount its path names, and shows the same pixel.
try pardes.dump.dumpState(p);
- const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true }, p.dump_out.?);
+ var words: [64]pardes.Kind.LoadedWord = undefined;
+ const k = p.kinds.byName("image").?;
+ const brought = [_]pardes.Kind.Loaded{pardes.Kind.loadedOf(p.kinds.ops[k].?, p.kinds.kinds[k].path.slice(), p.kinds.kinds[k].hash, &words)};
+ const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true, .addons = &brought }, p.dump_out.?);
defer restored.deinit();
const slot = for (restored.panes) |pane| {
if (pane) |each| if (each.addon) |s| break s;
} else return error.NoImagePane;
- try std.testing.expectEqualStrings(bytes, slot.record.?);
+ try std.testing.expect(slot.record == null and slot.live and std.mem.eql(u8, slot.path, path));
+ while (restored.nextEffect()) |e| if (e == .job) restored.perform(e);
+ _ = try restored.render(arena.allocator());
+ try std.testing.expectEqual(@as(u32, 1), restored.surface.placements.items[0].raster.w);
}