build: dynamically tangle to INSTALL_DIR without copying .org files
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
- Updated all 150+ :tangle headers across harness/ and skills/ to use elisp (expand-file-name) to target INSTALL_DIR dynamically. - Cleaned up environment/ directory depth by moving memory-image.lisp to state/. - Moved test scripts to tests/ and deleted redundant chat scripts.
This commit is contained in:
50
tests/run-all-tests.lisp
Normal file
50
tests/run-all-tests.lisp
Normal file
@@ -0,0 +1,50 @@
|
||||
(load "~/quicklisp/setup.lisp")
|
||||
|
||||
(push #p"./" asdf:*central-registry*)
|
||||
|
||||
(ql:quickload '(:usocket :bordeaux-threads :cl-postgres :split-sequence
|
||||
:dexador :jonathan :cl-dotenv :hunchentoot
|
||||
:trivial-garbage :s-sql :str :uuid :cl-json :uiop :fiveam))
|
||||
|
||||
(asdf:load-system :opencortex)
|
||||
(asdf:load-system :opencortex/tests)
|
||||
|
||||
(format t "~%=== Running ALL Test Suites ===~%")
|
||||
|
||||
;; Engineering Standards tests
|
||||
(when (find-package :OPENCORTEX-ENGINEERING-STANDARDS-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-ENGINEERING-STANDARDS-TESTS::ENGINEERING-STANDARDS-SUITE))
|
||||
|
||||
;; Literate Programming tests
|
||||
(when (find-package :OPENCORTEX-LITERATE-PROGRAMMING-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-LITERATE-PROGRAMMING-TESTS::LITERATE-PROGRAMMING-SUITE))
|
||||
|
||||
;; Communication tests
|
||||
(when (find-package :OPENCORTEX-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-TESTS::COMMUNICATION-PROTOCOL-SUITE))
|
||||
|
||||
;; Pipeline tests
|
||||
(when (find-package :OPENCORTEX-PIPELINE-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-PIPELINE-TESTS::PIPELINE-SUITE))
|
||||
|
||||
;; Boot sequence tests
|
||||
(when (find-package :OPENCORTEX-BOOT-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-BOOT-TESTS::BOOT-SUITE))
|
||||
|
||||
;; Memory tests
|
||||
(when (find-package :OPENCORTEX-MEMORY-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-MEMORY-TESTS::MEMORY-SUITE))
|
||||
|
||||
;; Immune system tests
|
||||
(when (find-package :OPENCORTEX-IMMUNE-SYSTEM-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-IMMUNE-SYSTEM-TESTS::IMMUNE-SUITE))
|
||||
|
||||
;; Emacs edit tests
|
||||
(when (find-package :OPENCORTEX-EMACS-EDIT-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-EMACS-EDIT-TESTS::EMACS-EDIT-SUITE))
|
||||
|
||||
;; Lisp utils tests
|
||||
(when (find-package :OPENCORTEX-LISP-UTILS-TESTS)
|
||||
(fiveam:run! 'OPENCORTEX-LISP-UTILS-TESTS::LISP-UTILS-SUITE))
|
||||
|
||||
(format t "~%=== ALL TESTS COMPLETE ===~%")
|
||||
46
tests/test_cli.py
Normal file
46
tests/test_cli.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import socket
|
||||
import struct
|
||||
|
||||
def frame_message(msg_string):
|
||||
payload = msg_string.encode('utf-8')
|
||||
return f"{len(payload):06x}".encode('ascii') + payload
|
||||
|
||||
def read_framed(sock):
|
||||
header = b''
|
||||
while len(header) < 6:
|
||||
chunk = sock.recv(6 - len(header))
|
||||
if not chunk:
|
||||
return None
|
||||
header += chunk
|
||||
length = int(header, 16)
|
||||
data = b''
|
||||
while len(data) < length:
|
||||
chunk = sock.recv(length - len(data))
|
||||
if not chunk:
|
||||
return None
|
||||
data += chunk
|
||||
return data.decode('utf-8')
|
||||
|
||||
msg = '(:TYPE :REQUEST :PAYLOAD (:ACTION :MESSAGE :TEXT "hello") :META (:SOURCE :CLI :SESSION-ID "test1"))'
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect(('127.0.0.1', 9105))
|
||||
sock.settimeout(10.0)
|
||||
|
||||
# Read handshake
|
||||
handshake = read_framed(sock)
|
||||
print("HANDSHAKE:", handshake)
|
||||
|
||||
# Read status
|
||||
status = read_framed(sock)
|
||||
print("STATUS:", status)
|
||||
|
||||
# Send message
|
||||
sock.sendall(frame_message(msg))
|
||||
print("SENT:", msg)
|
||||
|
||||
# Read response
|
||||
response = read_framed(sock)
|
||||
print("RESPONSE:", response)
|
||||
|
||||
sock.close()
|
||||
85
tests/ui_driver.py
Executable file
85
tests/ui_driver.py
Executable file
@@ -0,0 +1,85 @@
|
||||
import pty
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import select
|
||||
import re
|
||||
|
||||
class VirtualTerminal:
|
||||
def __init__(self, rows=24, cols=80):
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
self.buffer = [[' ' for _ in range(cols)] for _ in range(rows)]
|
||||
self.cursor_y = 0
|
||||
self.cursor_x = 0
|
||||
|
||||
def _strip_ansi(self, text):
|
||||
# Very basic ANSI parser for cursor moves and clears
|
||||
# CSI n ; m H (cursor move)
|
||||
# CSI J (clear screen)
|
||||
# CSI K (clear line)
|
||||
|
||||
# This is a simplified state machine
|
||||
parts = re.split(r'(\x1b\[[0-9;?]*[a-zA-Z])', text)
|
||||
for part in parts:
|
||||
if part.startswith('\x1b['):
|
||||
cmd = part[-1]
|
||||
params = part[2:-1].split(';')
|
||||
if cmd == 'H' or cmd == 'f': # Move cursor
|
||||
self.cursor_y = int(params[0]) - 1 if params[0] else 0
|
||||
self.cursor_x = int(params[1]) - 1 if (len(params) > 1 and params[1]) else 0
|
||||
elif cmd == 'J': # Clear
|
||||
mode = int(params[0]) if params[0] else 0
|
||||
if mode == 2: # Full clear
|
||||
self.buffer = [[' ' for _ in range(self.cols)] for _ in range(self.rows)]
|
||||
elif cmd == 'm': # Attributes - ignore for now
|
||||
pass
|
||||
else:
|
||||
for char in part:
|
||||
if char == '\n':
|
||||
self.cursor_y += 1
|
||||
self.cursor_x = 0
|
||||
elif char == '\r':
|
||||
self.cursor_x = 0
|
||||
elif 0 <= self.cursor_y < self.rows and 0 <= self.cursor_x < self.cols:
|
||||
self.buffer[self.cursor_y][self.cursor_x] = char
|
||||
self.cursor_x += 1
|
||||
|
||||
def get_screen(self):
|
||||
return "\n".join(["".join(row) for row in self.buffer])
|
||||
|
||||
def run_test(command, input_sequence, wait_time=5):
|
||||
pid, fd = pty.fork()
|
||||
if pid == 0:
|
||||
os.environ["TERM"] = "xterm"
|
||||
os.environ["COLUMNS"] = "80"
|
||||
os.environ["LINES"] = "24"
|
||||
os.execvp(command[0], command)
|
||||
else:
|
||||
vt = VirtualTerminal()
|
||||
start_time = time.time()
|
||||
input_sent = False
|
||||
|
||||
while time.time() - start_time < wait_time:
|
||||
r, w, e = select.select([fd], [], [], 0.1)
|
||||
if fd in r:
|
||||
try:
|
||||
data = os.read(fd, 8192).decode(errors='ignore')
|
||||
vt._strip_ansi(data)
|
||||
except OSError:
|
||||
break
|
||||
|
||||
if not input_sent and time.time() - start_time > 2:
|
||||
os.write(fd, input_sequence.encode())
|
||||
input_sent = True
|
||||
|
||||
os.kill(pid, 9)
|
||||
os.waitpid(pid, 0)
|
||||
return vt
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Example usage: python3 ui_driver.py sbcl --eval ...
|
||||
vt = run_test(sys.argv[1:], "Hi\r", wait_time=10)
|
||||
print("--- VIRTUAL SCREEN SNAPSHOT ---")
|
||||
print(vt.get_screen())
|
||||
print(f"--- CURSOR POSITION: ({vt.cursor_y}, {vt.cursor_x}) ---")
|
||||
Reference in New Issue
Block a user