Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
069caba
feat(test-framework): Add a README.md in the tests directory
miguelafsilva5 May 31, 2024
67b6c7f
feat(test-framework): Add a makefile for the test framework
miguelafsilva5 May 31, 2024
568fd23
feat(submodules): Add the test-framework (bao-test) repository
miguelafsilva5 Jun 3, 2024
1ee15ba
feat(submodules): Add the nix packages (bao-nix) repository
miguelafsilva5 Jun 3, 2024
42755c1
feat(recipe): add support for single baremetal tests
miguelafsilva5 Jun 3, 2024
d94bfb3
feat(test-framework): Add a tests rule to bao Makefile
miguelafsilva5 Jun 4, 2024
f2cb927
feat(irq_tests): add support to run IRQ tests (uart and timer)
Diogo21Costa Sep 4, 2024
1c076c1
feat(recipe): Add the main nix recipe file for a single baremetal
miguelafsilva5 Jun 3, 2024
b460084
add(uart_irq): include IRQ tests
Diogo21Costa Sep 24, 2024
93d7c92
fix(irq_test): update single baremetal tests
Diogo21Costa Apr 3, 2025
39098b0
feat(test): add support to single freertos tests
Diogo21Costa Apr 3, 2025
46428b3
update(single-baremetal): fix recipe and tests
Diogo21Costa Sep 13, 2025
16f9168
fix(Makefile): add missing endif instruction
Diogo21Costa Sep 14, 2025
9359fe2
update(README): include test framework instructions
Diogo21Costa Sep 14, 2025
d31251c
update(recipes): use boot only tests on single baremetal test
Diogo21Costa Oct 23, 2025
8851ff2
feat(fvp): include support to fvp tests
Diogo21Costa Sep 13, 2025
1f80c0a
wip(github_actions): test workflows
Diogo21Costa Nov 10, 2025
2789107
update(submodules): bump bao-tests and bao-nix submodules
Diogo21Costa Nov 20, 2025
806a376
wip(framework): update bao-tests to remove bao-nix
Diogo21Costa Jan 28, 2026
fcc86e9
wip(framework): refactor tests and benchmarks path
Diogo21Costa Mar 30, 2026
f74095b
update(bao-tests): update submodule version
Diogo21Costa Mar 30, 2026
cc1d423
update(bao-tests): update submodule version
Diogo21Costa Apr 1, 2026
2985d27
update: trim trailing whitespaces
danielRep Apr 2, 2026
98142c1
update(bao-tests): update submodule version
danielRep Apr 2, 2026
1b002b9
update(bao-benchmarks): update submodule version
danielRep Apr 2, 2026
fd1becc
ref(submodules): change submodules names
danielRep Apr 2, 2026
f152340
update: update submodules versions
danielRep Apr 6, 2026
b1ddd8e
feat(qemu-riscv64-virt): add tests support
Diogo21Costa Apr 6, 2026
f43518b
wip(tf): update submodule version
Diogo21Costa Apr 6, 2026
b524192
fix(test/boot): add timer_enable call
danielRep Apr 9, 2026
d5e2585
fix(configs): change test configurations folder name
danielRep Apr 9, 2026
58b70e1
update(benchs): update benchs submodule
danielRep Apr 9, 2026
4bd0b2c
update(tf): update tf submodule
danielRep Apr 9, 2026
d089e37
feat(gitignore): add wrkdir from tests to gitignore
danielRep Apr 9, 2026
af229f2
update(tf): update tf submodule
danielRep Apr 9, 2026
15d5557
feat(platform): add support to fvp-r
Diogo21Costa Apr 9, 2026
a314891
update(bao-tests): update submodule version
Diogo21Costa Apr 9, 2026
112a90d
fix(num_cpus): remove hardcoded NUM_CPUs for tests
Diogo21Costa Apr 10, 2026
9205eca
update(bao-tests): update submodule version
Diogo21Costa Apr 10, 2026
fde43a6
feat(platform): add support to zcu104
Diogo21Costa Apr 10, 2026
d164262
update(bao-tests): update submodule version
Diogo21Costa Apr 10, 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
37 changes: 37 additions & 0 deletions .github/workflows/test-framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test Franewrork

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


jobs:

run-tests:
runs-on: ubuntu-latest
container:
image: diogo21costa/bao-tests:latest
options: --user root
strategy:
matrix:
platform: [
"qemu-aarch64-virt",
]
recipe: [
"single-baremetal/default.nix"
]
gic: [
"GICV2",
]
cross_compile: [
"CROSS_COMPILE=clang"
]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Run tests inside nix shell
run: nix develop ./tests --command make tests PLATFORM=${{ matrix.platform }} RECIPE=${{ matrix.recipe }} ${{ matrix.cross_compile }} GIC_VERSION=${{ matrix.gic }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/*
build/*
**/wrkdir/
*.o
*.elf
*.bin
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "ci"]
path = ci
url = git@github.com:bao-project/bao-ci.git
[submodule "tests/tf"]
path = tests/tf
url = https://github.com/bao-project/bao-tf.git
[submodule "tests/benchs"]
path = tests/benchs
url = git@github.com:osyxtechnologies/bao-benchmarks.git
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ targets:=$(MAKECMDGOALS)
ifeq ($(targets),)
targets:=all
endif
non_build_targets+=ci clean
non_build_targets+=ci clean tests
build_targets:=$(strip $(foreach target, $(targets), \
$(if $(findstring $(target),$(non_build_targets)),,$(target))))

Expand Down Expand Up @@ -436,4 +436,10 @@ $(call ci, format, $(all_c_files))
.PHONY: ci
ci: license-check format-check

endif
tests_dir := $(cur_dir)/tests
-include $(tests_dir)/tests.mk

.PHONY: tests
tests: framework

endif
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,23 @@ In IEEE Access, 2024. https://ieeexplore.ieee.org/document/10781314

10. Hidemasa Kawasaki and Soramichi Akiyama. "**Running Bao Hypervisor on gem5**"
In gem5 blog, 2024. https://www.gem5.org/2024/11/12/bao-on-gem5.html


Testing Framework Usage
-----------------------

### Prerequisites
- Ensure [Nix package manager](https://nixos.org/download.html) is installed.
- Ensure that all dependencies (check [here](./tests/README.md)) are installed.

### Run the test framework locally
(Follow [this instructions](./tests/README.md) to use Docker)
```sh
make tests PLATFORM=<platform_name> RECIPE=<target_recipe>
```

Example using `qemu-aarch64-virt` with a single baremetal setup:

```sh
make tests PLATFORM=qemu-aarch64-virt RECIPE=single-baremetal/default.nix IRQC=gicv3
```
49 changes: 49 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Bao Test Framework

### Prerequesites
If you prefer not to use Docker or Nix, you can install the required dependencies manually:
```sh
sudo apt-get update && sudo apt-get install -y \
git curl wget tree vim nano sudo make net-tools socat xterm \
python3 python3-pip nodejs npm bison flex gawk device-tree-compiler \
ninja-build pkg-config enchant

pip install psutil pyserial
```


### Clone docker
To pull the Docker image, run the following command:

```sh
docker pull baoproject/bao-tests:latest
```

### Run the Test framework inside Docker

First, start Docker with the following command in the repo's root directory:
```sh
docker run --rm -it \
-v "$(pwd):$(pwd)" \
-w "$(pwd)" \
-u $(id -u):$(id -g) \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
baoproject/bao-tests:latest
```

Then, initialize the Nix environment:
```sh
nix develop ./tests/
```

Finally, run the test framework with:
```sh
make tests PLATFORM=<platform_name> RECIPE=<target_recipe>
```

Currently, the following platforms are available:
- QEMU RV64 virt (qemu-aarch64-virt)
- QEMU Aarch64 virt (qemu-aarch64-virt)
- FVP-A AArch64 (fvp-a)
- FVP-R AArch64 (fvp-r)
1 change: 1 addition & 0 deletions tests/benchs
Submodule benchs added at 08baf0
46 changes: 46 additions & 0 deletions tests/tests.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) Bao Project and Contributors. All rights reserved

bao-tests_dir = $(tests_dir)/bao-tests
bao-nix_dir = $(tests_dir)/bao-nix
recipes_dir = $(tests_dir)/recipes

LOG_LEVEL?=2
ECHO?=tf
SETUP?=baremetal
TEST?=boot

irq_flags:=

ifdef GIC_VERSION
irq_flags+=-gicv
irq_flags+=$(GIC_VERSION)
endif

ifdef IRQC
irq_flags+=-irqc
irq_flags+=$(IRQC)
endif

ifdef IPIC
irq_flags+=-ipic
irq_flags+=$(IPIC)
endif


.PHONY: test-framework
framework:

ifndef RECIPE
@echo "Error: RECIPE variable is not defined. Please specify the path to the recipe file."
@exit 1
endif

@echo "Running Bao Tests Framework..."
python3 $(bao-tests_dir)/framework/test_framework.py \
-log_level $(LOG_LEVEL) \
-echo $(ECHO) \
-platform $(PLATFORM) \
-test $(TEST) \
-setup $(SETUP) \
$(irq_flags)
49 changes: 49 additions & 0 deletions tests/tests/configs/baremetal/fvp-r.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <config.h>


struct config config = {

.vmlist_size = 1,
.vmlist = (struct vm_config[]) {
{
.image = VM_IMAGE_LOADED(0x10000000, 0x10000000, 100*1024),

.entry = 0x10000000,

.platform = {
.cpu_num = 4,

.region_num = 1,
.regions = (struct vm_mem_region[]) {
{
.base = 0x10000000,
.size = 0x4000000,
},
},

.dev_num = 2,
.devs = (struct vm_dev_region[]) {
{
/* UART2, PL011 */
.pa = 0x9c0A0000,
.va = 0x9c0A0000,
.size = 0x10000,
.interrupt_num = 1,
.interrupts = (irqid_t[]) {38}
},
{
.interrupt_num = 1,
.interrupts = (irqid_t[]) {27}
}
},

.arch = {
.gic = {
.gicd_addr = 0xAF000000,
.gicr_addr = 0xAF100000,
}
}
},
}
}
};
58 changes: 58 additions & 0 deletions tests/tests/configs/baremetal/qemu-aarch64-virt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x50000000,
.load_addr = VM_IMAGE_OFFSET(baremetal_image),
.size = VM_IMAGE_SIZE(baremetal_image)
},

.entry = 0x50000000,

.platform = {
.cpu_num = 4,

.region_num = 1,
.regions = (struct vm_mem_region[]) {
{
.base = 0x50000000,
.size = 0x4000000
}
},

.dev_num = 2,
.devs = (struct vm_dev_region[]) {
{
/* PL011 */
.pa = 0x9000000,
.va = 0x9000000,
.size = 0x10000,
.interrupt_num = 1,
.interrupts = (irqid_t[]) {33}
},
{
/* Arch timer interrupt */
.interrupt_num = 1,
.interrupts =
(irqid_t[]) {27}
}
},

.arch = {
.gic = {
.gicd_addr = (paddr_t) 0x08000000,
.gicr_addr = (paddr_t) 0x080A0000,
}
}
},
}
},
};
48 changes: 48 additions & 0 deletions tests/tests/configs/baremetal/qemu-riscv64-virt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x80200000,
.load_addr = VM_IMAGE_OFFSET(baremetal_image),
.size = VM_IMAGE_SIZE(baremetal_image)
},

.entry = 0x80200000,

.platform = {
.cpu_num = 4,

.region_num = 1,
.regions = (struct vm_mem_region[]) {
{
.base = 0x80200000,
.size = 0x4000000
}
},

.dev_num = 1,
.devs = (struct vm_dev_region[]) {
{
.pa = 0x10000000,
.va = 0x10000000,
.size = 0x1000,
.interrupt_num = 1,
.interrupts = (irqid_t[]) {10}
},
},

.arch = {
.irqc.plic.base = 0xc000000,
}
},
},
}
};
Loading
Loading