Skip to content

Commit ee5e80a

Browse files
authored
Merge pull request #205 from ryanbreen/feat/path-scope-and-improvements
feat: PATH as JS global scope layer, virtio input/graphics, and shell improvements
2 parents 85b7ae0 + c4af986 commit ee5e80a

32 files changed

+3536
-340
lines changed

docker/qemu/run-aarch64-boot-test-native.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ run_single_test() {
4747
-display none -no-reboot \
4848
-device virtio-gpu-device \
4949
-device virtio-keyboard-device \
50+
-device virtio-tablet-device \
5051
-device virtio-blk-device,drive=ext2 \
5152
-drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \
5253
-device virtio-net-device,netdev=net0 \
@@ -55,12 +56,12 @@ run_single_test() {
5556
local QEMU_PID=$!
5657

5758
# Wait for USERSPACE shell prompt (20s timeout)
58-
# ONLY accept "breenix>" - the actual userspace shell prompt
59+
# Accept "breenix>" (init_shell) or "bsh " (bsh shell) as valid userspace prompts
5960
# DO NOT accept "Interactive Shell" - that's the KERNEL FALLBACK when userspace FAILS
6061
local BOOT_COMPLETE=false
6162
for i in $(seq 1 10); do
6263
if [ -f "$OUTPUT_DIR/serial.txt" ]; then
63-
if grep -q "breenix>" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
64+
if grep -qE "(breenix>|bsh )" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
6465
BOOT_COMPLETE=true
6566
break
6667
fi
@@ -75,14 +76,14 @@ run_single_test() {
7576
wait $QEMU_PID 2>/dev/null || true
7677

7778
if $BOOT_COMPLETE; then
78-
# Verify no excessive init_shell spawning
79-
local SHELL_COUNT=$(grep -o "init_shell" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
79+
# Verify no excessive shell spawning (init_shell or bsh)
80+
local SHELL_COUNT=$(grep -oE "(init_shell|/bin/bsh)" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
8081
SHELL_COUNT=${SHELL_COUNT:-0}
8182
if [ "$SHELL_COUNT" -le 5 ]; then
82-
echo "SUCCESS (${SHELL_COUNT} init_shell mentions)"
83+
echo "SUCCESS (${SHELL_COUNT} shell mentions)"
8384
return 0
8485
else
85-
echo "FAIL: Too many init_shell mentions: $SHELL_COUNT"
86+
echo "FAIL: Too many shell mentions: $SHELL_COUNT"
8687
return 1
8788
fi
8889
else

docker/qemu/run-aarch64-boot-test-strict.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ run_single_test() {
5757
-display none -no-reboot \
5858
-device virtio-gpu-device \
5959
-device virtio-keyboard-device \
60+
-device virtio-tablet-device \
6061
-device virtio-blk-device,drive=ext2 \
6162
-drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \
6263
-device virtio-net-device,netdev=net0 \
@@ -65,12 +66,12 @@ run_single_test() {
6566
local QEMU_PID=$!
6667

6768
# Wait for USERSPACE shell prompt (18s max, checking every 1.5s)
68-
# ONLY accept "breenix>" - the actual userspace shell prompt
69+
# Accept "breenix>" (init_shell) or "bsh " (bsh shell) as valid userspace prompts
6970
# DO NOT accept "Interactive Shell" - that's the KERNEL FALLBACK when userspace FAILS
7071
local BOOT_COMPLETE=false
7172
for i in $(seq 1 12); do
7273
if [ -f "$OUTPUT_DIR/serial.txt" ]; then
73-
if grep -q "breenix>" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
74+
if grep -qE "(breenix>|bsh )" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
7475
BOOT_COMPLETE=true
7576
break
7677
fi
@@ -85,14 +86,14 @@ run_single_test() {
8586
wait $QEMU_PID 2>/dev/null || true
8687

8788
if $BOOT_COMPLETE; then
88-
# Verify no excessive init_shell spawning
89-
local SHELL_COUNT=$(grep -o "init_shell" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
89+
# Verify no excessive shell spawning (init_shell or bsh)
90+
local SHELL_COUNT=$(grep -oE "(init_shell|/bin/bsh)" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
9091
SHELL_COUNT=${SHELL_COUNT:-0}
9192
if [ "$SHELL_COUNT" -le 5 ]; then
92-
echo " [OK] Boot $iteration: SUCCESS (${SHELL_COUNT} init_shell mentions)"
93+
echo " [OK] Boot $iteration: SUCCESS (${SHELL_COUNT} shell mentions)"
9394
return 0
9495
else
95-
echo " [FAIL] Boot $iteration: Too many init_shell mentions: $SHELL_COUNT"
96+
echo " [FAIL] Boot $iteration: Too many shell mentions: $SHELL_COUNT"
9697
return 1
9798
fi
9899
else

docker/qemu/run-aarch64-interactive.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ docker run --rm \
8888
-device virtio-gpu-device \
8989
-vnc :0 \
9090
-device virtio-keyboard-device \
91+
-device virtio-tablet-device \
9192
$DISK_OPTS \
9293
-device virtio-net-device,netdev=net0 \
9394
-netdev user,id=net0 \

docker/qemu/run-aarch64-kthread-parallel.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ for i in $(seq 1 $COUNT); do
6363
-display none -no-reboot \
6464
-device virtio-gpu-device \
6565
-device virtio-keyboard-device \
66+
-device virtio-tablet-device \
6667
-device virtio-blk-device,drive=ext2 \
6768
-drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \
6869
-device virtio-net-device,netdev=net0 \
@@ -82,9 +83,9 @@ for i in $(seq 1 $COUNT); do
8283
OUTPUT_DIR="/tmp/breenix_aarch64_kthread_$i"
8384

8485
# Wait up to 60 seconds for this test
85-
# Look for userspace shell prompt "breenix>" which indicates:
86+
# Look for userspace shell prompt ("breenix>" or "bsh ") which indicates:
8687
# - Scheduler initialized successfully
87-
# - Context switching works (idle thread -> init_shell)
88+
# - Context switching works (idle thread -> shell)
8889
# - Timer interrupts firing correctly
8990
# - Per-CPU data working
9091
#
@@ -93,7 +94,7 @@ for i in $(seq 1 $COUNT); do
9394
FOUND=false
9495
for j in $(seq 1 30); do
9596
if [ -f "$OUTPUT_DIR/serial.txt" ]; then
96-
if grep -q "breenix>" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
97+
if grep -qE "(breenix>|bsh )" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
9798
FOUND=true
9899
break
99100
fi
@@ -110,14 +111,14 @@ for i in $(seq 1 $COUNT); do
110111
wait ${QEMU_PIDS[$i]} 2>/dev/null || true
111112

112113
if $FOUND; then
113-
# Verify no excessive init_shell spawning (would indicate scheduler bugs)
114-
SHELL_COUNT=$(grep -o "init_shell" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
114+
# Verify no excessive shell spawning (would indicate scheduler bugs)
115+
SHELL_COUNT=$(grep -oE "(init_shell|/bin/bsh)" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
115116
SHELL_COUNT=${SHELL_COUNT:-0}
116117
if [ "$SHELL_COUNT" -le 5 ]; then
117-
echo " Test $i: PASS (${SHELL_COUNT} init_shell mentions)"
118+
echo " Test $i: PASS (${SHELL_COUNT} shell mentions)"
118119
PASSED=$((PASSED + 1))
119120
else
120-
echo " Test $i: FAIL (too many init_shell: $SHELL_COUNT)"
121+
echo " Test $i: FAIL (too many shell spawns: $SHELL_COUNT)"
121122
FAILED=$((FAILED + 1))
122123
fi
123124
else

docker/qemu/run-aarch64-stability-test.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# ARM64 stability test - ensures kernel stays stable after init_shell prompt.
2+
# ARM64 stability test - ensures kernel stays stable after shell prompt.
33
#
44
# This test boots to the userspace shell, then continues monitoring serial
55
# output for aborts/exceptions for a short window (post-boot stability).
@@ -65,23 +65,24 @@ timeout "$QEMU_TIMEOUT_SECS" qemu-system-aarch64 \
6565
-display none -no-reboot \
6666
-device virtio-gpu-device \
6767
-device virtio-keyboard-device \
68+
-device virtio-tablet-device \
6869
-device virtio-blk-device,drive=ext2 \
6970
-drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \
7071
-device virtio-net-device,netdev=net0 \
7172
-netdev user,id=net0 \
7273
-serial file:"$OUTPUT_DIR/serial.txt" &
7374
QEMU_PID=$!
7475

75-
# Wait for USERSPACE shell prompt (init_shell)
76-
# ONLY accept "breenix>" - the actual userspace shell prompt
76+
# Wait for USERSPACE shell prompt (init_shell or bsh)
77+
# Accept "breenix>" (init_shell) or "bsh " (bsh shell) as valid userspace prompts
7778
# DO NOT accept "Interactive Shell" - that's the KERNEL FALLBACK when userspace FAILS
7879
BOOT_COMPLETE=false
7980
PROMPT_LINE=0
8081
for _ in $(seq 1 $((WAIT_FOR_PROMPT_SECS / CHECK_INTERVAL_SECS))); do
8182
if [ -f "$OUTPUT_DIR/serial.txt" ]; then
82-
if grep -q "breenix>" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
83+
if grep -qE "(breenix>|bsh )" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
8384
BOOT_COMPLETE=true
84-
PROMPT_LINE=$(grep -n "breenix>" "$OUTPUT_DIR/serial.txt" | tail -1 | cut -d: -f1)
85+
PROMPT_LINE=$(grep -nE "(breenix>|bsh )" "$OUTPUT_DIR/serial.txt" | tail -1 | cut -d: -f1)
8586
break
8687
fi
8788
if grep -qiE "(KERNEL PANIC|panic!)" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
@@ -102,11 +103,11 @@ if ! $BOOT_COMPLETE; then
102103
exit 1
103104
fi
104105

105-
# Verify init_shell appears at least once
106-
SHELL_COUNT=$(grep -o "init_shell" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
106+
# Verify shell (init_shell or bsh) appears at least once
107+
SHELL_COUNT=$(grep -oE "(init_shell|bsh)" "$OUTPUT_DIR/serial.txt" 2>/dev/null | wc -l | tr -d ' ')
107108
SHELL_COUNT=${SHELL_COUNT:-0}
108109
if [ "$SHELL_COUNT" -lt 1 ]; then
109-
echo "FAIL: init_shell marker not found after prompt"
110+
echo "FAIL: shell marker (init_shell or bsh) not found after prompt"
110111
tail -10 "$OUTPUT_DIR/serial.txt" 2>/dev/null || true
111112
exit 1
112113
fi

docker/qemu/run-aarch64-test-runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def read_output():
8888
try:
8989
line = output_queue.get(timeout=0.5)
9090
output_lines.append(line)
91-
if "breenix>" in line:
91+
if "breenix>" in line or "bsh " in line:
9292
prompt_found = True
9393
break
9494
except queue.Empty:

docker/qemu/run-aarch64-test-suite.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ kernel_src = sys.argv[1]
9292
test_name = sys.argv[2]
9393
with open(kernel_src, 'r') as f:
9494
content = f.read()
95-
# Replace the path in run_userspace_from_ext2 call
95+
# Replace the path in run_userspace_from_ext2 call (handles both init_shell and bsh)
9696
content = re.sub(
97-
r'run_userspace_from_ext2\("/bin/init_shell"\)',
97+
r'run_userspace_from_ext2\("/bin/(init_shell|bsh)"\)',
9898
f'run_userspace_from_ext2("/bin/{test_name}")',
9999
content
100100
)
@@ -123,6 +123,7 @@ PYTHON
123123
-display none -no-reboot \
124124
-device virtio-gpu-device \
125125
-device virtio-keyboard-device \
126+
-device virtio-tablet-device \
126127
-device virtio-blk-device,drive=ext2 \
127128
-drive if=none,id=ext2,format=raw,file="$EXT2_DISK_WRITABLE" \
128129
-device virtio-net-device,netdev=net0 \

docker/qemu/run-aarch64-test.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spawn qemu-system-aarch64 \
3636

3737
# Wait for shell prompt
3838
expect {
39-
"breenix>" {
39+
-re {breenix>|bsh } {
4040
puts "\n\[expect\] Shell prompt found"
4141
}
4242
timeout {
@@ -64,7 +64,7 @@ expect {
6464
set test_result "FAIL"
6565
puts "\n\[expect\] Test failed marker found"
6666
}
67-
"breenix>" {
67+
-re {breenix>|bsh } {
6868
# Test completed, check output
6969
puts "\n\[expect\] Test completed (shell returned)"
7070
}

docker/qemu/run-aarch64-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ docker run --rm \
4949
-display none \
5050
-device virtio-gpu-device \
5151
-device virtio-keyboard-device \
52+
-device virtio-tablet-device \
5253
-device virtio-net-device,netdev=net0 \
5354
-netdev user,id=net0 \
5455
-no-reboot \

docker/qemu/run-aarch64-userspace-test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ timeout "$TIMEOUT" qemu-system-aarch64 \
5959
-display none -no-reboot \
6060
-device virtio-gpu-device \
6161
-device virtio-keyboard-device \
62+
-device virtio-tablet-device \
6263
-device virtio-blk-device,drive=ext2 \
6364
-drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \
6465
-device virtio-net-device,netdev=net0 \
@@ -72,7 +73,7 @@ QEMU_PID=$!
7273
echo "Waiting for shell prompt..."
7374
FOUND_PROMPT=false
7475
for i in $(seq 1 30); do
75-
if [ -f "$OUTPUT_DIR/serial.txt" ] && grep -q "breenix>" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
76+
if [ -f "$OUTPUT_DIR/serial.txt" ] && grep -qE "(breenix>|bsh )" "$OUTPUT_DIR/serial.txt" 2>/dev/null; then
7677
FOUND_PROMPT=true
7778
break
7879
fi

0 commit comments

Comments
 (0)