Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Created January 26, 2025 08:30
Show Gist options
  • Save lupyuen/9d9fe108e8aaf387fcc390c57717cf81 to your computer and use it in GitHub Desktop.
Save lupyuen/9d9fe108e8aaf387fcc390c57717cf81 to your computer and use it in GitHub Desktop.
OSTest on QEMU RISC-V 64-bit: Fails on Docker
sudo docker run -it \
ghcr.io/apache/nuttx/apache-nuttx-ci-linux:latest \
/bin/bash
root@b144b3a498bf:/tmp/build-test-knsh64/nuttx# expect qemu-riscv-knsh64.exp
spawn qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -kernel nuttx -nographic
OpenSBI v0.9
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : riscv-virtio,qemu
Platform Features : timer,mfdeleg
Platform HART Count : 1
Firmware Base : 0x80000000
Firmware Size : 100 KB
Runtime SBI Version : 0.2
Domain0 Name : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*
Domain0 Region00 : 0x0000000080000000-0x000000008001ffff ()
Domain0 Region01 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000080200000
Domain0 Next Arg1 : 0x0000000087000000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 0
Boot HART Domain : root
Boot HART ISA : rv64imafdcsu
Boot HART Features : scounteren,mcounteren,time
Boot HART PMP Count : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count : 0
Boot HART MHPM Count : 0
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
ABC
NuttShell (NSH) NuttX-12.8.0
nsh> uname -a
NuttX 12.8.0 8f3a2a6f76 Jan 26 2025 08:20:01 risc-v rv-virt
nsh> free
total used free maxused maxfree nused nfree name
2064576 10120 2054456 21880 2050992 25 4 Kmem
4194304 606208 3588096 3588096 Page
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 0003056 0001496 48.9% Idle_Task
1 0 100 RR Kthread - Waiting Semaphore 0000000000000000 0001968 0000720 36.5% lpwork 0x80400100 0x80400148
2 2 100 RR Task - Running 0000000000000000 0003008 0001872 62.2% /system/bin/init
nsh> ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 null
crw-rw-rw- 0 ttyS0
crw-rw-rw- 0 zero
nsh> hello
Hello, World!!
nsh> getprime
Set thread priority to 10
Set thread policy to SCHED_RR
Start thread #0
thread #0 started, looking for primes < 10000, doing 10 run(s)
thread #0 finished, found 1230 primes, last one was 9973
Done
getprime took 719 msec
nsh> hello
Hello, World!!
nsh> getprime
Set thread priority to 10
Set thread policy to SCHED_RR
Start thread #0
thread #0 started, looking for primes < 10000, doing 10 run(s)
thread #0 finished, found 1230 primes, last one was 9973
Done
getprime took 733 msec
nsh> ostest
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
stdio_test: Standard I/O Check: fprintf to stderr
ostest_main: putenv(Variable1=BadValue3)
ostest_main: setenv(Variable1, GoodValue1, TRUE)
ostest_main: setenv(Variable2, BadValue1, FALSE)
ostest_main: setenv(Variable2, GoodValue2, TRUE)
ostest_main: setenv(Variable3, GoodValue3, FALSE)
ostest_main: setenv(Variable3, BadValue2, FALSE)
show_variable: Variable=Variable1 has value=GoodValue1
show_variable: Variable=Variable2 has value=GoodValue2
show_variable: Variable=Variable3 has value=GoodValue3
ostest_main: Started user_main at PID=10
===== Error: Test Failed
root@b144b3a498bf:/tmp/build-test-knsh64/nuttx# exit
exit
luppy@thinkstation:~/nuttx-build-farm$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment