Skip to content

Commit 30ced98

Browse files
committed
test(starry): add top app test case to verify TERM is set for TUI applications
1 parent 6c858fd commit 30ced98

10 files changed

Lines changed: 162 additions & 0 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
target = "aarch64-unknown-none-softfloat"
2+
log = "Warn"
3+
features = [
4+
"qemu",
5+
"ax-driver/virtio-blk",
6+
"ax-driver/virtio-net",
7+
"ax-driver/virtio-gpu",
8+
"ax-driver/virtio-input",
9+
"ax-driver/virtio-socket",
10+
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
target = "loongarch64-unknown-none-softfloat"
2+
log = "Warn"
3+
features = [
4+
"ax-hal/loongarch64-qemu-virt",
5+
"qemu",
6+
"ax-driver/plat-static",
7+
"ax-driver/virtio-blk",
8+
"ax-driver/virtio-net",
9+
"ax-driver/virtio-gpu",
10+
"ax-driver/virtio-input",
11+
"ax-driver/virtio-socket",
12+
]
13+
plat_dyn = false
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
features = [
2+
"ax-feat/display",
3+
"ax-feat/rtc",
4+
"ax-driver/serial",
5+
"ax-driver/virtio-blk",
6+
"ax-driver/virtio-net",
7+
"ax-driver/virtio-gpu",
8+
"ax-driver/virtio-input",
9+
"ax-driver/virtio-socket",
10+
"starry-kernel/input",
11+
"starry-kernel/vsock",
12+
]
13+
log = "Warn"
14+
target = "riscv64gc-unknown-none-elf"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target = "x86_64-unknown-none"
2+
log = "Warn"
3+
features = [
4+
"ax-driver/virtio-blk",
5+
"ax-driver/virtio-net",
6+
"ax-driver/virtio-gpu",
7+
"ax-driver/virtio-input",
8+
"ax-driver/virtio-socket",
9+
]

‎apps/starry/top/prebuild.sh‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
app_dir="${STARRY_APP_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
5+
overlay_dir="${STARRY_OVERLAY_DIR:-}"
6+
7+
if [[ -z "$overlay_dir" ]]; then
8+
echo "error: STARRY_OVERLAY_DIR is required" >&2
9+
exit 1
10+
fi
11+
12+
install -Dm0755 "$app_dir/top-test.sh" "$overlay_dir/usr/bin/top-test.sh"

‎apps/starry/top/qemu-aarch64.toml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
args = [
2+
"-nographic",
3+
"-m",
4+
"512M",
5+
"-cpu",
6+
"cortex-a53",
7+
"-device",
8+
"virtio-blk-pci,drive=disk0",
9+
"-drive",
10+
"id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-aarch64-alpine.img",
11+
"-device",
12+
"virtio-net-pci,netdev=net0",
13+
"-netdev",
14+
"user,id=net0",
15+
]
16+
uefi = false
17+
to_bin = true
18+
shell_prefix = "root@starry:"
19+
shell_init_cmd = "/usr/bin/top-test.sh"
20+
success_regex = ["(?m)^TOP_TEST_PASSED\\s*$"]
21+
fail_regex = ['(?i)\bpanic(?:ked)?\b', "(?m)^TOP_TEST_FAILED\\s*$"]
22+
timeout = 300
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
args = [
2+
"-machine",
3+
"virt",
4+
"-cpu",
5+
"la464",
6+
"-nographic",
7+
"-m",
8+
"512M",
9+
"-device",
10+
"virtio-blk-pci,drive=disk0",
11+
"-drive",
12+
"id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-loongarch64-alpine.img",
13+
"-device",
14+
"virtio-net-pci,netdev=net0",
15+
"-netdev",
16+
"user,id=net0",
17+
]
18+
uefi = false
19+
to_bin = true
20+
shell_prefix = "root@starry:"
21+
shell_init_cmd = "/usr/bin/top-test.sh"
22+
success_regex = ["(?m)^TOP_TEST_PASSED\\s*$"]
23+
fail_regex = ['(?i)\bpanic(?:ked)?\b', "(?m)^TOP_TEST_FAILED\\s*$"]
24+
timeout = 300

‎apps/starry/top/qemu-riscv64.toml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
args = [
2+
"-nographic",
3+
"-m",
4+
"512M",
5+
"-cpu",
6+
"rv64",
7+
"-device",
8+
"virtio-blk-pci,drive=disk0",
9+
"-drive",
10+
"id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-riscv64-alpine.img",
11+
"-device",
12+
"virtio-net-pci,netdev=net0",
13+
"-netdev",
14+
"user,id=net0",
15+
]
16+
uefi = false
17+
to_bin = true
18+
shell_prefix = "root@starry:"
19+
shell_init_cmd = "/usr/bin/top-test.sh"
20+
success_regex = ["(?m)^TOP_TEST_PASSED\\s*$"]
21+
fail_regex = ['(?i)\bpanic(?:ked)?\b', "(?m)^TOP_TEST_FAILED\\s*$"]
22+
timeout = 300

‎apps/starry/top/qemu-x86_64.toml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
args = [
2+
"-nographic",
3+
"-m",
4+
"512M",
5+
"-device",
6+
"virtio-blk-pci,drive=disk0",
7+
"-drive",
8+
"id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-x86_64-alpine.img",
9+
"-device",
10+
"virtio-net-pci,netdev=net0",
11+
"-netdev",
12+
"user,id=net0",
13+
]
14+
uefi = false
15+
to_bin = false
16+
shell_prefix = "root@starry:"
17+
shell_init_cmd = "/usr/bin/top-test.sh"
18+
success_regex = ["(?m)^TOP_TEST_PASSED\\s*$"]
19+
fail_regex = ['(?i)\bpanic(?:ked)?\b', "(?m)^TOP_TEST_FAILED\\s*$"]
20+
timeout = 300

‎apps/starry/top/top-test.sh‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
echo "=== install procps ==="
3+
apk add procps || { echo "TOP_TEST_FAILED"; exit 1; }
4+
5+
echo "=== test top requires TERM ==="
6+
output="/tmp/top_output.txt"
7+
top -n 1 > "$output" 2> /dev/null
8+
9+
if [ -s "$output" ]; then
10+
rm -f "$output"
11+
echo "TOP_TEST_PASSED"
12+
else
13+
rm -f "$output"
14+
echo "TOP_TEST_FAILED: top produced no output (TERM may not be set)"
15+
exit 1
16+
fi

0 commit comments

Comments
 (0)