Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
224b439
feat(kao): add support for bao kao testing framework
danielRep May 14, 2026
5931c67
fix(irq_test): fix IRQ priorities
Diogo21Costa May 21, 2026
7d5849b
fix(tc4dx_cfg): update baremetal test config
Diogo21Costa May 21, 2026
ce57353
update(kao): update submodule
danielRep May 22, 2026
ff5c6e2
fix(kao): test current sources
Diogo21Costa Aug 11, 2026
d47ac0f
ref(tests): move kao make targets
Diogo21Costa Aug 11, 2026
f69f2ce
feat(tests): forward kao arguments
Diogo21Costa Aug 11, 2026
1a690a5
fix(tests): check kao submodule
Diogo21Costa Aug 11, 2026
664d043
ref(benchs): remove private benchmarks
Diogo21Costa Aug 11, 2026
707e9e4
feat(kao): add wrkdir support
Diogo21Costa Aug 11, 2026
3ec913a
fix(ci): use bao container action
Diogo21Costa Aug 11, 2026
3769011
update(ci): cache fvp models
Diogo21Costa Aug 11, 2026
902ebe4
update(ci): reuse toolchains
Diogo21Costa Aug 11, 2026
54bfa12
fix(testf): respect log level
Diogo21Costa Aug 11, 2026
10aeae7
fix(irq_test): wait for uart interrupt
Diogo21Costa Aug 11, 2026
ab070b9
ref(configs): remove unsupported guests
Diogo21Costa Aug 11, 2026
f2f822f
ref(s32z270): defer test support
Diogo21Costa Aug 11, 2026
cbcf574
fix(riscv): update test configuration
Diogo21Costa Aug 11, 2026
0f69f50
update(kao): add boot timeout
Diogo21Costa Aug 11, 2026
0fcda4b
update(kao): use supported RISC-V QEMU
Diogo21Costa Aug 11, 2026
e17c3ab
update(kao): report setup failures
Diogo21Costa Aug 11, 2026
80c2f98
update(kao): enable RISC-V Svpbmt
Diogo21Costa Aug 11, 2026
dea359b
fix(riscv): build AIA test guest
Diogo21Costa Aug 11, 2026
fce6be8
update(kao): forward log level
Diogo21Costa Aug 11, 2026
3b5464f
update(kao): fix FVP toolchains
Diogo21Costa Aug 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/test-bkao.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Bao Kao Testing Framework

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:


jobs:

run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [
"qemu-aarch64-virt",
"qemu-riscv64-virt",
"fvp-a",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two download the FVP model (~101MB) on every run. Can we cache it with actions/cache keyed on the version?

Just so it's on record, we can't put it in the CI image. I read the EULA inside the tarball and it only grants use, there's no redistribution right (§1.1, §2.5). Downloading it like we do here is fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3769011.

"fvp-r"
]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache FVP model
if: startsWith(matrix.platform, 'fvp-')
uses: actions/cache@v4
with:
path: |
tests/wrkdir/platforms/fvp_a/FVP_Model_A
tests/wrkdir/platforms/fvp_r/FVP_Model_R
key: ${{ runner.os }}-${{ matrix.platform }}-fvp-11.28_23

- name: Run Bao Kao tests
uses: ./.github/actions/bao-container-run
with:
run: >
git config --global url.https://github.com/.insteadOf git@github.com:
&& make tests PLATFORM=${{ matrix.platform }}
KAO_ARGS=--no-toolchain-build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/*
build/*
tests/wrkdir/
*.o
*.elf
*.bin
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "ci"]
path = ci
url = git@github.com:bao-project/bao-ci.git
[submodule "tests/kao"]
path = tests/kao
url = git@github.com:bao-project/bao-kao.git
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ configs_dir=$(cur_dir)/configs
CONFIG_REPO?=$(configs_dir)
scripts_dir:=$(cur_dir)/scripts
ci_dir:=$(cur_dir)/ci
tests_dir:=$(cur_dir)/tests
src_dirs:=

all:

-include $(ci_dir)/ci.mk
-include $(tests_dir)/tests.mk

targets:=$(MAKECMDGOALS)
ifeq ($(targets),)
Expand Down
1 change: 1 addition & 0 deletions tests/kao
Submodule kao added at 5128ee
23 changes: 23 additions & 0 deletions tests/tests.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) Bao Project and Contributors. All rights reserved

kao_dir:=$(tests_dir)/kao/src
kao_script:=$(kao_dir)/kao.py

KAO_TESTS?=all
KAO_ARGS?=

non_build_targets+=tests check-kao

.PHONY: check-kao
check-kao:
@if [ ! -f $(kao_script) ]; then \
echo "Bao Kao is not initialized; run 'git submodule update --init --recursive tests/kao'."; \
exit 1; \
fi

.PHONY: tests
tests: check-kao
@echo "Running bao-kao tests for $(PLATFORM)..."
@python3 $(kao_script) -t $(KAO_TESTS) -p $(PLATFORM) \
--hyp-srcs $(cur_dir) --wrkdir $(tests_dir)/wrkdir $(KAO_ARGS)
28 changes: 28 additions & 0 deletions tests/tests/configs/baremetal/fvp-a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Bao Hypervisor VM Configuration
# This YAML describes the fields needed to generate a C config file (config.c)

vms:
- vm1:
name: "baremetal"
build_options: ""
config:
image:
base_addr: 0x90000000
entry: 0x90000000
platform:
cpu_num: 4
regions:
- base: 0x90000000
size: 0x4000000
devs:
- pa: 0x1c090000
va: 0x1c090000
size: 0x10000
interrupts:
- 37
- interrupts:
- 27
arch:
gic:
gicd_addr: 0x2F000000
gicr_addr: 0x2F100000
30 changes: 30 additions & 0 deletions tests/tests/configs/baremetal/fvp-r.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Bao Hypervisor VM Configuration
# This YAML describes the fields needed to generate a C config file (config.c)

vms:
- vm1:
name: "baremetal"
build_options: "MEM_BASE=0x10000000"
config:
image:
load_addr: 0x10000000
phys_addr: 0x10000000
size: 102400
entry: 0x10000000
platform:
cpu_num: 4
regions:
- base: 0x10000000
size: 0x4000000
devs:
- pa: 0x9c0A0000
va: 0x9c0A0000
size: 0x10000
interrupts:
- 38
- interrupts:
- 27
arch:
gic:
gicd_addr: 0xAF000000
gicr_addr: 0xAF100000
30 changes: 30 additions & 0 deletions tests/tests/configs/baremetal/qemu-aarch64-virt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@


# Bao Hypervisor VM Configuration
# This YAML describes the fields needed to generate a C config file (config.c)

vms:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, not a change request: what do we get from the yaml + jinja over just writing config.c?

One yaml per (setup, platform) is one config.c per (setup, platform), so it's not fewer files, and nothing in the output is actually dynamic. Every value comes from the yaml, and BAO_WRKDIR_IMGS is resolved by the preprocessor, not the template. It's also missing things we'd want to test: cpu_affinity, colors, ipcs, remio_devs, mmu. And s32z270 already ships a hand-written plat.c next to its yaml.

Is the idea (a) to describe VMs separately and compose them for multi-guest setups, or (b) to be able to generate configs for another hypervisor? args[2].split("+") already builds a guest list so (a) looks intended, but the config lookup is still per-combination. If it is (a), does it also do the allocation (non-overlapping regions, cpu partitioning)? Just concatenating two VM configs doesn't really save anything.

Either way it should be in the README, because from outside it isn't obvious what it's for.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a design choice; its main purpose is to make a test scenario a single, declarative unit: the Bao configuration together with the guest/build parameters needed to reproduce that scenario. In that sense, a YAML file describes more than the contents of config.c. It is intended to be the input consumed by the test/build tooling, while the generated config.c is one target-specific artifact of that description. This also gives us a path to emit equivalent scenario configurations for other hypervisors, rather than making the benchmark/test definitions inherently Bao-specific.

That said, the current implementation does not yet fully realize the compositional model you describe:

  • args[2].split("+") was introduced with multi-guest scenarios in mind, but configuration selection is still effectively per (setup, platform) combination.
  • It does not currently compose independently defined VM descriptions and perform resource allocation or validation (for example, CPU partitioning, non-overlapping memory regions, cache colors, IPCs, remote-I/O devices, or MMU settings).

So the intended answer is closer to (a) as a longer-term scenario-description direction, plus (b) as an eventual portability benefit, rather than a claim that the current YAML files already provide full VM composition or allocation. Today, they mainly centralize the scenario metadata/configuration used by the test infrastructure and generate a Bao-specific configuration from it.

- vm1:
name: "baremetal"
build_options:
config:
image:
base_addr: 0x50000000
entry: 0x50000000
platform:
cpu_num: 4
regions:
- base: 0x50000000
size: 0x4000000
devs:
- pa: 0x9000000
va: 0x9000000
size: 0x10000
interrupts:
- 33
- interrupts:
- 27
arch:
gic:
gicd_addr: 0x08000000
gicr_addr: 0x080A0000
29 changes: 29 additions & 0 deletions tests/tests/configs/baremetal/qemu-riscv64-virt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Bao Hypervisor VM Configuration
# This YAML describes the fields needed to generate a C config file (config.c)

vms:
- vm1:
name: "baremetal"
build_options: "IRQC=AIA"
config:
image:
base_addr: 0x80200000
entry: 0x80200000
platform:
cpu_num: 4
regions:
- base: 0x80200000
size: 0x4000000
devs:
- pa: 0x10000000
va: 0x10000000
size: 0x1000
interrupts:
- 10
arch:
irqc:
aia:
aplic:
base: 0xd000000
imsic:
base: 0x28000000
37 changes: 37 additions & 0 deletions tests/tests/configs/baremetal/tc4dx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Bao Hypervisor VM Configuration
# This YAML describes the fields needed to generate a C config file (config.c)

vms:
- vm1:
name: "baremetal"
build_options:
config:
image:
base_addr: 0x90100000
entry: 0x90100000
platform:
cpu_num: 6
regions:
- base: 0x90100000
size: 0x80000
devs:
- pa: 0xF8800000
va: 0xF8800000
size: 0x1000
interrupts:
- 10
- pa: 0xF003D400
va: 0xF003D400
size: 0x400
- pa: 0xF003D800
va: 0xF003D800
size: 0x400
- pa: 0xF46C0000
va: 0xF46C0000
size: 0x200
interrupts:
- 173
arch:
gpsr_num: 1
gspr_groups:
Comment thread
miguelafsilva5 marked this conversation as resolved.
- 1
28 changes: 28 additions & 0 deletions tests/tests/configs/baremetal/zcu104.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Bao Hypervisor VM Configuration
# This YAML describes the fields needed to generate a C config file (config.c)

vms:
- vm1:
name: "baremetal"
build_options:
config:
image:
base_addr: 0x20000000
entry: 0x20000000
platform:
cpu_num: 4
regions:
- base: 0x20000000
size: 0x8000000
devs:
- pa: 0xFF000000
va: 0xFF000000
size: 0x10000
interrupts:
- 53
- interrupts:
- 27
arch:
gic:
gicd_addr: 0xF9010000
gicc_addr: 0xF9020000
46 changes: 46 additions & 0 deletions tests/tests/src/bao-test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) Bao Project and Contributors. All rights reserved
# SPDX-License-Identifier: Apache-2.0

ifndef TESTF_TESTS_DIR
$(error User must define the variable(s) TESTF_TESTS_DIR with the path to the \
directory containing the test sources)
endif

ifdef BAO_TEST

TESTF_SRC_DIR:=$(TESTF_TESTS_DIR)/src
ifneq ($(wildcard $(TESTF_TESTS_DIR)/src/tests/*.c),)
TESTF_SRC_DIR:=$(TESTF_TESTS_DIR)/src/tests
endif
TESTF_INC_DIR:=$(TESTF_TESTS_DIR)/src/inc


TESTF_SRCS += $(TESTF_TESTS_DIR)/src/testf_entry.c
TESTF_SRCS += $(filter-out $(TESTF_TESTS_DIR)/src/testf_entry.c, $(wildcard $(TESTF_SRC_DIR)/*.c))

ifndef SUITES
ifndef TESTS
$(error User must define the variable(s) SUITES and/or TESTS)
endif
endif

ifdef SUITES
TESTF_FLAGS+=$(addprefix -D, $(SUITES))
endif

ifdef TESTS
TESTF_FLAGS+=$(addprefix -D, $(TESTS))
endif

ifdef TESTF_LOG_LEVEL
TESTF_FLAGS+=-DTESTF_LOG_LEVEL=$(TESTF_LOG_LEVEL)
endif

ifdef TESTF_NO_RTE
TESTF_FLAGS+=-Dno_rte
endif

else
TESTF_SRCS += $(TESTF_SRC_DIR)/testf_weak.c

endif
35 changes: 35 additions & 0 deletions tests/tests/src/boot.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <cpu.h>
#include <timer.h>
#include <spinlock.h>
#include "testf.h"

#define CPU_BOOT_WAIT_TIME TIME_MS(1000)

volatile bool cpu_boot_status[NUM_CPUS] = {false};
spinlock_t boot_status_lock = SPINLOCK_INITVAL;

BAO_TEST(BOOT_CHECK, VM_BOOT, BAREMETAL, "Check that baremetal guest boots successfully")
{
if(cpu_is_master()) {
TESTF_PASS("System booted successfully!\n");
}
}

BAO_TEST(BOOT_CHECK, CPU_BOOT, BAREMETAL, "Check that all CPUs on the baremetal boot successfully")
{
int cpu_id = get_cpuid();
spin_lock(&boot_status_lock);
cpu_boot_status[cpu_id] = true;
spin_unlock(&boot_status_lock);

if(cpu_is_master()) {
timer_wait(CPU_BOOT_WAIT_TIME);
for(int i = 0; i < NUM_CPUS; i++) {
if(!cpu_boot_status[i]) {
TESTF_FAIL("CPUs did not boot successfully!\n");
return;
}
}
TESTF_PASS("All CPUs booted successfully!\n");
}
}
Loading
Loading