summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 809ddb1..d8da703 100644
--- a/build.zig
+++ b/build.zig
@@ -386,6 +386,29 @@ pub fn build(b: *Build) void {
test_step.dependOn(&past.step);
b.step("test-past", "Replay past sessions, to a time and across a code change").dependOn(&past.step);
+ // A session exported from one database and imported into another plays
+ // there to the same State: at the mark it carries, and two seconds in.
+ const moved = b.addSystemCommand(&.{ "sh", "-c",
+ \\set -e
+ \\mkdir -p "$4"; d=$(realpath "$4"); rm -f "$d"/*
+ \\"$0" --headless --script "$1" --state "$d/a.state" "$5"
+ \\"$0" --headless --script "$2" --state "$d/a.state" --define file="$d/one.xitdb" "$5"
+ \\"$0" --headless --script "$3" --state "$d/z.state" --define file="$d/one.xitdb" "$5"
+ \\test "$(stat -c %s "$d/one.xitdb")" -lt 1048576
+ \\rm -f "$d"/*
+ });
+ moved.setName("export and import a session");
+ moved.addArtifactArg(host_exe);
+ moved.addFileArg(b.path("test/past.script"));
+ moved.addFileArg(b.path("test/session_export.script"));
+ moved.addFileArg(b.path("test/session_import.script"));
+ _ = moved.addOutputDirectoryArg("import");
+ moved.addArtifactArg(recorded);
+ moved.has_side_effects = true;
+ moved.expectExitCode(0);
+ test_step.dependOn(&moved.step);
+ b.step("test-import", "Export a session from one database, import it into another, replay it").dependOn(&moved.step);
+
// Where files go. Without --state: the XDG data directory, state and
// sessions. In .sketchbook/ (`zig build run`'s): a .gitignore, and an
// older build's state moved in, once, never over a file there.