summaryrefslogtreecommitdiff
path: root/tools/web_fixture.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-29 19:09:26 -0300
committerGabriel Schneider <[email protected]>2026-10-29 21:13:33 -0300
commit2eb8860b2ca05c426f3962661441aaee13d3be44 (patch)
tree8d363280576cc86db7209ef37c6210a0d5b75c8e /tools/web_fixture.py
parente4cfd57bc41c5740e3a823a8f05d70d3e87b68ca (diff)
downloadpardes-2eb8860b2ca05c426f3962661441aaee13d3be44.tar.gz
pardes-2eb8860b2ca05c426f3962661441aaee13d3be44.zip
web: the browser shell builds again and loads a dump of a native build: a theme by its name, a field compiled out passed over, no disk asked; touch.dump replaces the hand-written ZON fixture
Fixed for wasm32-freestanding: counts as usize, no threads, stb_image, tape or host stat there. touch.mjs follows the renderer's 13 tag-layer fields, helix's retuned colours and the tag column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools/web_fixture.py')
-rw-r--r--tools/web_fixture.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/web_fixture.py b/tools/web_fixture.py
new file mode 100644
index 00000000..06fc54cd
--- /dev/null
+++ b/tools/web_fixture.py
@@ -0,0 +1,34 @@
+"""web_fixture.py PARDES OUT: the web shell's touch fixture as a dump of this
+build: one pane on touch-fixture.zig at 100x30, theme helix.
+
+ python3 -B tools/web_fixture.py <pardes> test/web-snapshots/touch.dump
+"""
+import os, sys, time, shutil, struct, fcntl, termios
+from pathlib import Path
+sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'test'))
+import fs # noqa: E402
+
+binary, out = sys.argv[1], sys.argv[2]
+root = Path('/tmp/pardes-web-fixture') # fixed: the dump names it
+shutil.rmtree(root, ignore_errors=True)
+root.mkdir(parents=True, mode=0o700)
+shutil.copy(Path(__file__).resolve().parent.parent / 'test' / 'web-snapshots' / 'touch-fixture.zig', root / 'touch-fixture.zig')
+# Set at startup, which announces nothing: a fixture with no message on
+# its pane.
+(root / 'config' / 'pardes').mkdir(parents=True)
+(root / 'config' / 'pardes' / 'init').write_text('Theme helix\nVerbose off\n')
+handles = {}
+with fs.session(binary, root, 'web', tty=True, file=root / 'touch-fixture.zig', inherited={'PARDES_DAEMON': 'off'}, terminal=handles) as (client, address):
+ fcntl.ioctl(handles['input_fd'], termios.TIOCSWINSZ, struct.pack('HHHH', 30, 100, 0, 0))
+ deadline = time.monotonic() + 10
+ while client.screen()['cols'] != 100:
+ assert time.monotonic() < deadline
+ time.sleep(.01)
+ client.write('/ctl', b'Dump\n')
+ while b'\ndump ' not in client.read('/log'):
+ assert time.monotonic() < deadline
+ time.sleep(.01)
+ print(client.read('/index').decode())
+ shutil.copy(root / 'web.dump.zon', out)
+shutil.rmtree(root, ignore_errors=True)
+print(os.path.getsize(out), 'bytes')