============================================================
HERB OS Bare Metal Test Suite
============================================================
Image: herb_os.img
QEMU:  C:\Program Files\qemu\qemu-system-x86_64.exe
QMP:   port 44444

Starting QEMU...

--- Test: Boot ---
  PASS: Boot reaches equilibrium
  PASS: Boot produces operations
  PASS: Interactive mode started
  Mode detected: KERNEL

============================================================
Boot-Time Compilation Tests
============================================================
  PASS: Boot compile: interactive_kernel succeeded
  PASS: Boot compile: shell succeeded
  PASS: Boot compile: producer succeeded
  PASS: Boot compile: consumer succeeded
  PASS: Boot compile: worker succeeded
  PASS: Boot compile: beacon succeeded
  PASS: Boot compile: schedule_priority succeeded
  PASS: Boot compile: schedule_roundrobin succeeded

--- Test: Timer ---
  PASS: Timer signal processed
  PASS: Timer produces ops

--- Test: New Process ---
  PASS: Process created
  PASS: Process has name
  PASS: Process has priority
  PASS: Process created with resources

--- Test: Kill ---
  PASS: Kill signal processed
  PASS: Kill produces ops

--- Test: Block ---
  PASS: Block signal processed
  PASS: Block produces ops

--- Test: Unblock ---
  FAIL: Unblock signal processed

============================================================
Kernel-Specific Tests (Scoped Resources)
============================================================

--- Test: Allocate Page ---
  PASS: Page allocation processed
  PASS: Alloc produces ops
  PASS: Alloc increases used pages

--- Test: Open FD ---
  PASS: FD open processed
  PASS: Open produces ops
  PASS: Open increases open FDs

--- Test: Free Page ---
  PASS: Page free processed
  PASS: Free restores page to free pool

--- Test: Close FD ---
  PASS: FD close processed
  PASS: Close restores FD to free pool

--- Test: Resource Isolation ---
  PASS: Alloc targets different processes after switch
  PASS: Resource isolation: operations affect only running process

--- Test: Kill with Resources ---
  PASS: Kill terminates process with resources
  PASS: Terminated process: p1

============================================================
Tension Toggle Tests (Session 44)
============================================================

--- Test: Tension Selection ---
  PASS: Tension selection works
  PASS: First tension has a name

--- Test: Tension Cycle ---
  PASS: Tension cycle advances index
  PASS: Second tension is timer_tick

--- Test: Disable Tension ---
  PASS: Tension disabled
  PASS: Disabled tension is timer_tick

--- Test: Disabled Tension Behavioral Effect ---
  PASS: Timer signal created with timer_tick disabled
  PASS: Timer with timer_tick disabled runs

--- Test: Re-enable Tension ---
  PASS: Tension re-enabled

--- Test: Behavior Restored ---
  PASS: Timer works after re-enable
  PASS: Timer produces ops with timer_tick enabled

--- Test: Disable schedule_ready ---
  PASS: Selected tension 0
  PASS: schedule_ready disabled
  PASS: Disabled tension is schedule_ready
  PASS: Kill executed with schedule_ready disabled
  PASS: Timer with empty CPU and disabled scheduler
  PASS: schedule_ready re-enabled

============================================================
Process-as-Tensions Tests (Session 45/46)
============================================================

--- Test: Create First Program Process ---
  PASS: First program loaded
  PASS: First program (consumer) has tension count > 23

--- Test: First Process Has Behavior ---
  PASS: Consumer consumed reported

--- Test: Buffer State Reported ---
  PASS: Buffer state reported
  PASS: Buffer capacity is 20

--- Test: Create Second Program Process ---
  PASS: Second program loaded
  PASS: Second program adds another tension
  PASS: Program types loaded (may match if pool limited)

--- Test: Second Process Has Behavior ---
  PASS: Producer produced reported

--- Test: Kill Removes Process Tensions ---
  PASS: Tensions removed on kill
  PASS: At least 1 tension removed

--- Test: Tension Count Decreased ---
  PASS: Tension count reflects removal

--- Test: Program Runs When Scheduled ---
  PASS: Fresh process behavior reported
  PASS: Producer behavior reported

--- Test: Block Stops Process Behavior ---
  PASS: Timer with blocked process

============================================================
Cross-Process Interaction Tests (Session 46)
============================================================

--- Test: First Interaction Process ---
  PASS: First interaction process created
  PASS: Buffer reported after first process

--- Test: Timer Drives Single Process ---
  PASS: Buffer reported after timer

--- Test: Add Complementary Process ---
  PASS: Second interaction process created
  PASS: Interaction process types loaded
  PASS: Buffer reported after both processes

--- Test: Both Running - Dynamic Interaction ---
  PASS: Timer produces ops with both running
  PASS: More ops with both processes

--- Test: Block Producer - Consumer Starves ---
  PASS: Buffer reported after blocking
  PASS: Buffer changed after blocking one process

--- Test: Kill Process - Buffer Effect ---
  PASS: Process tensions removed on kill
  PASS: Buffer reported after kill

--- Test: Tension Toggle Affects Behavior ---
  PASS: Process tension disabled via toggle
  PASS: Timer works after tension toggle
  PASS: Process tension re-enabled

============================================================
Hot-Swappable Policy Tests (Session 48)
============================================================

--- Test: Setup Processes for Policy Test ---
  PASS: Process A created
  PASS: Process B created
  PASS: Process C created

--- Test: Priority Scheduling (Default) ---
  PASS: Kill under priority scheduling
  PASS: Timer under priority scheduling

--- Test: Swap to Round-Robin ---
  PASS: Old scheduling tension removed
  PASS: Round-robin policy loaded
  PASS: System settled under round-robin

--- Test: Round-Robin Scheduling Behavior ---
  PASS: High-pri process created under RR
  PASS: Kill under round-robin
  PASS: Round-robin produces scheduling ops

--- Test: Swap Back to Priority ---
  PASS: Round-robin tension removed
  PASS: Priority policy loaded
  PASS: System settled under priority

--- Test: Priority Scheduling Restored ---
  PASS: Timer works after restoring priority

--- Test: Multiple Rapid Swaps ---
  PASS: Rapid swap to RR
  PASS: Rapid swap back to priority
  PASS: Third swap to RR
  PASS: Timer works after multiple swaps

============================================================
Text Input Tests (Session 49)
============================================================

--- Test: Enter Text Mode ---
  PASS: Slash enters text mode

--- Test: Type Character ---
  PASS: Character typed in text mode
  PASS: Buffer has content

--- Test: Type Multiple Characters ---
  PASS: Second character typed
  PASS: Buffer length grows
  PASS: Third character typed
  PASS: Buffer contains 'help'

--- Test: Backspace ---
  PASS: Backspace processed
  PASS: Buffer length decreased

--- Test: Submit Command ---
  PASS: Command submitted via serial
  PASS: Returns to command mode after submit

--- Test: ESC Cancels ---
  PASS: Re-enter text mode
  PASS: ESC returns to command mode

--- Test: Command Keys After Text Mode ---
  PASS: Timer still works after text mode
  PASS: New process still works after text mode

--- Test: Empty Submit ---
  PASS: Empty submit produces (empty)

--- Test: Rapid Mode Switching ---
  PASS: Rapid mode switching stable

============================================================
Shell Process Tests (Session 50)
============================================================

--- Test: Shell Help Command ---
  PASS: Help command produces HELP output
  PASS: Help command dispatched via text_key lookup

--- Test: Shell List Command ---
  PASS: List command produces LIST output
  PASS: Shell process visible in list

--- Test: Shell Kill Command ---
  PASS: Kill command dispatched via text_key lookup
  PASS: Shell kill cleaned up process tensions

--- Test: Shell Block Command ---
  PASS: Block command dispatched via text_key lookup

--- Test: Shell Unblock Command ---
  PASS: Unblock command dispatched via text_key lookup

--- Test: Shell Swap Command ---
  PASS: Swap command triggers policy change

--- Test: Shell Load Producer ---
  PASS: Load producer dispatched
  PASS: Load producer creates new process

--- Test: Shell Unknown Command ---
  PASS: Unknown command reported

--- Test: Shell Tensions in Panel ---
  PASS: Shell tension visible in tension panel

--- Test: Disable Shell Tension ---
  PASS: Shell tension disabled
  PASS: Shell tension re-enabled

--- Test: HAM All Tensions ---
  PASS: HAM diagnostic output received
  INFO: HAM compiled 87 tensions, 6171 bytes, 20 ops
  PASS: HAM compiled >= 40 tensions (system+shell)
  PASS: HAM bytecode size reasonable (100-8000 bytes)
  PASS: HAM executed operations
  FAIL: HAM schedule_ready: entity moved to CPU0 (ready 6->6, cpu0 0->0)

--- Test: HAM Idempotent ---
  PASS: HAM second invocation succeeds
  PASS: HAM second run terminates cleanly

--- Test: HAM Incremental ---
  PASS: HAM eval stats present
  PASS: HAM incremental: some tensions skipped (eval < total)
  INFO: eval=87/272
  INFO: eval=77/231
  INFO: eval=51/308
  INFO: eval=116/462
  INFO: eval=49/308

============================================================
Disk + Filesystem Tests (Session 75)
============================================================

--- Test: Disk Detection ---
  PASS: Disk detected
  PASS: Disk has sectors
  PASS: Disk self-test passed

--- Test: Filesystem Init ---
  PASS: Filesystem initialized

--- Test: Save File ---
  PASS: File saved

--- Test: List Files ---
  PASS: File listed

--- Test: Read File ---
  PASS: File content correct

--- Test: File Overwrite ---
  PASS: File overwrite saved
  PASS: Overwritten content correct

--- Test: Slash in Filename ---
  FAIL: File with / in name saved

--- Test: 8MB Disk ---
  PASS: Disk has >= 16384 sectors (8MB)

--- Test: Bitmap Free Sectors ---
  PASS: Free sectors > 16000

============================================================
Flow Tests (Session 76)
============================================================

--- Test: Flow Compilation ---
  PASS: test_flow compiled
  PASS: test_flow loaded

--- Test: Flow Count ---
  PASS: Flow count reported
  PASS: Flow count >= 1

--- Test: Flow Creates Entities ---
  PASS: FLOW_DST entity count reported
  PASS: FLOW_DST has 3 entities

--- Test: Flow Set Properties ---
  PASS: Found 3 doubled values
  PASS: Found 3 cumsum values
  PASS: doubled: 20,40,60
  PASS: cumsum: 10,30,60

============================================================
Editor Tests (Session 76)
============================================================

--- Test: Editor Compilation ---
  PASS: Interactive kernel compiled with editor

--- Test: Editor Tensions ---
  PASS: Editor tensions compiled (count > 72)

--- Test: Editor Flow ---
  PASS: render_editor flow compiled (count >= 2)

--- Test: Edit Command (skipped in text mode) ---
  Editor mode=2 is graphics-only; skipping editor tests

============================================================
Game Prototype Tests (Session 81)
============================================================

--- Test: NPC Data in Kernel ---
  PASS: Interactive kernel compiled
  PASS: Kernel source size 25503 > 20000 (NPC data present)

--- Test: Player Movement (Game Mode) ---
  FAIL: Game mode activated
  FAIL: Player move south
  FAIL: Player move north

--- Test: Gather Wood ---
  FAIL: Gather command executed

--- Test: Eval Under Game Load ---
  PASS: Eval stats present
  INFO: Last eval=81/510
  PASS: Incremental: eval 81 < total 510
  INFO: eval=81/510
  INFO: eval=81/510
  INFO: eval=46/340
  INFO: eval=81/510
  INFO: eval=81/510
  FAIL: Game mode deactivated

============================================================
NIC Tests (Session 82)
============================================================

--- Test: NIC Detected ---
  PASS: E1000 NIC detected
  INFO: slot=3 BAR0=-21233664 IRQ=11

--- Test: NIC Initialized ---
  PASS: E1000 NIC initialized (MAC read)

--- Test: MMIO Mapped ---
  PASS: MMIO region mapped

--- Test: ARP Request Sent ---
  PASS: ARP request sent for gateway

--- Test: ARP Reply Received ---
  PASS: ARP reply received and cached

--- Test: System Responsive ---
  PASS: System responsive after NIC init

============================================================
Ping Tests (Session 84)
============================================================

--- Test: Ping Command ---
  FAIL: PING echo request sent

--- Test: IP Packet Received ---
  FAIL: IPv4 ICMP packet received from gateway

--- Test: Ping Reply Received ---
  FAIL: PING echo reply received

============================================================
Results: 175/186 passed, 11 failed
SOME TESTS FAILED

--- Serial Output (last 2000 chars) ---
  (Full serial saved to test_debug.log, 193895 chars)
...MER] t573 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t574 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t576 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t577 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t579 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t580 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t582 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t583 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t585 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t586 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t588 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t593 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=46/340

[INPUT] mode=1 len=11 buf=save a/b hi

[HAM] eval=81/510

[TIMER] t597 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t598 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t599 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t600 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20

[HAM] eval=81/510

[TIMER] t601 ops=20 [EMPTY]->[EMPTY]

[BUFFER] count=0/20


============================================================
