From 8461d74f19828967c849fc6f08f405d47216987d Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 05:42:09 +0100 Subject: Check pure-serve, pipelined connections included The server checks run pure-serve, which replaced the module mode of the old document server. A keep-alive client and pipelined requests (sent in one write, and in writes that cut heads and bodies) must get the same answers, in order, as separate connections. --- Makefile | 2 +- tests/check.py | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0453068..60f2d06 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,6 @@ $(BUILD)/aup: src/main.c src/compile.c src/aup.h | $(BUILD) $(CC) $(CPPFLAGS) $(CFLAGS) src/main.c src/compile.c $(LDFLAGS) $(LDLIBS) -o $@ check: $(BUILD)/aup - $(MAKE) -C $(PURE) BUILD=build build/pure-run build/pure-edit-module build/pure-connections-module + $(MAKE) -C $(PURE) BUILD=build build/pure-run build/pure-edit-module build/pure-serve $(MAKE) -C $(PURE) BUILD=build/tree STORE=store-tree.c build/tree/pure-edit build/tree/pure-connections python3 tests/check.py --aup $(BUILD)/aup --pure-run $(PURE)/build/pure-run --pure $(PURE) diff --git a/tests/check.py b/tests/check.py index efe17ee..5b7cac5 100644 --- a/tests/check.py +++ b/tests/check.py @@ -15,8 +15,9 @@ Korean, emoji, combining marks, NUL, newlines), moves and deletions; string escapes and number text follow their stated rules. 9. Server: the HTTP document server running editor.aup answers random - requests exactly as the server running editor.pure; concurrent edits share - commits, and every acknowledged edit survives kill -9. + requests exactly as the server running editor.pure, on persistent and + pipelined connections too; concurrent edits share commits, and every + acknowledged edit survives kill -9. 8. Stored state: the list app and the text editor run on a tree store, restarting at random points (every other run saving in bursts), and still match their reference models. @@ -716,7 +717,7 @@ def server_parity(aup, pure, work, seeds, operations=150): rng = random.Random(seed + 13000) old = HttpHost([pure / 'build/tree/pure-connections', '--program', pure / 'examples/editor.pure', '--store', work / f'http-old-{seed}']) - new = HttpHost([pure / 'build/pure-connections-module', '--module', module, '--store', work / f'http-new-{seed}']) + new = HttpHost([pure / 'build/pure-serve', '--module', module, '--store', work / f'http-new-{seed}']) try: revision, size = {}, {} for _ in range(operations): @@ -749,6 +750,63 @@ def server_parity(aup, pure, work, seeds, operations=150): return compared +def server_pipelining(aup, pure, work): + """One connection, many requests: a keep-alive client and a pipelined + burst (all requests in one write, one split across writes) get the same + answers, in order, as separate connections would.""" + import http.client + import socket + import struct + module = work / 'editor-pipeline.pmod' + compile_module(aup, ROOT / 'examples/editor.aup', module) + host = HttpHost([pure / 'build/pure-serve', '--module', module, '--store', work / 'pipeline']) + try: + connection = http.client.HTTPConnection('127.0.0.1', host.port, timeout=30) + answers = [] + for body, headers in [(struct.pack('