diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -409,6 +409,36 @@ pub fn build(b: *Build) void { test_step.dependOn(&moved.step); b.step("test-import", "Export a session from one database, import it into another, replay it").dependOn(&moved.step); + // A script run twice records the same database but for the wall clock's + // times: the log and the keyframes follow from the script alone. From + // fresh state it records in memory: no database at all. + const same_sessions = b.addExecutable(.{ .name = "same_sessions", .root_module = b.createModule(.{ + .root_source_file = b.path("test/same_sessions.zig"), + .target = target, + .optimize = optimize, + .imports = &.{.{ .name = "Sessions", .module = b.createModule(.{ .root_source_file = b.path("src/host/Sessions.zig"), .imports = &.{ .{ .name = "abi", .module = abi }, .{ .name = "xitdb", .module = xitdb } } }) }}, + }) }); + const twice = b.addSystemCommand(&.{ "sh", "-c", + \\set -e + \\mkdir -p "$3"; d=$(realpath "$3"); rm -f "$d"/* + \\"$0" --headless --script "$1" --state "$d/a.state" "$4" + \\"$0" --headless --script "$1" --state "$d/b.state" "$4" + \\"$2" "$d/a.xitdb" "$d/b.xitdb" + \\"$0" --headless --fresh --script "$1" --state "$d/c.state" "$4" + \\test -e "$d/c.state"; test ! -e "$d/c.xitdb" + \\rm -f "$d"/* + }); + twice.setName("a script recorded twice"); + twice.addArtifactArg(host_exe); + twice.addFileArg(b.path("test/past.script")); + twice.addArtifactArg(same_sessions); + _ = twice.addOutputDirectoryArg("twice"); + twice.addArtifactArg(recorded); + twice.has_side_effects = true; + twice.expectExitCode(0); + test_step.dependOn(&twice.step); + b.step("test-same", "A script run twice records the same database but for times").dependOn(&twice.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. |
