Conversation
6f43b3a to
2ef3a2a
Compare
010c9b8 to
fe6b4ea
Compare
| # Bao Hypervisor VM Configuration | ||
| # This YAML describes the fields needed to generate a C config file (config.c) | ||
|
|
||
| vms: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
8922c08 to
fce6be8
Compare
|
@Diogo21Costa can you go comment by comment and say which points of the review are addressed by the latest push, and if relevant, provide futher information. For those not addressed and we which you don't plan to address, please explain we don't think they should be. |
@josecm Matched each of the comments with the specific fixes. While validating the review changes, make tests PLATFORM=qemu-riscv64-virt exposed additional integration problems. These were addressed by: with corresponding Bao Kao commits: |
Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com> Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com> Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
|
Are all tests compiled and executed for all platforms? Let's say I want to develop and test a specific feature from a certain platform, how do I implement such tests? Can they be excluded from some architectures? Let's use cache coloring as an example. I might be reasonable to test if the coloring is working, but some platforms do not use caches. |
|
I was testing creating tests. And commenting a test does not compile. Example: |
I think this is a very important point. Each platform driver must be behind an abstract interface (class?) and each platform implements its access details. Is this the current architecture? |
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
Platform-specific operations are already encapsulated in individual platform classes, and the Kao runner accesses them through a common set of methods, such as This update introduces changes in the bao-kao repo only (bao-project/bao-kao@15006f7). |
A Kao invocation targets one platform only. Kao does not automatically execute the test suite across every platform; CI must invoke Kao separately for each target. To add a test, the author defines it using There is currently no declarative mechanism for a test author to specify supported platforms, architectures, or required capabilities. Therefore, a cache-coloring test cannot currently be marked to automatically skip platforms without cache-coloring support; each platform invocation or CI matrix entry must explicitly include or exclude it. |
You are correct. Kao was scanning the raw C source, so BAO_TEST definitions inside comments were still discovered and added to the generated test entry code, causing the build to fail. Fixed in bao-project/bao-kao@62ee65e |
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
@Diogo21Costa is this solution only available via python? Can I not overwrite the port using make? If the make functionality is meant to be mainly used by the CI, I believe such an override still needs to be available. Imagine you have several boards connected to server. And for some reason, a board needs to be taken out to a live demo or something. The CI should be able to update the actions script easily to adapt to such conditions. |
@Diogo21Costa my only gripe with this approach is that you are limiting a test developer from using platform-specific APIs. If I develop a test for TC4 using CSFR reads/writes, they won't compile for ARM or RISC-V. And then, you are putting a strain on the ARM and RISC-V developers to one-by-one exclude tests that don't compile from their builds. |
Tested and working 👌 |
I think this makes a lot of sense. Each test should be couple with some description of it targets the hypervisor globally, a given architecture, or a given platform. And the framework could understand "oh! I only run this test on this platforms" or "I can't run this on this platform". But maybe we can get the PR through without such feature and add it next. |
@miguelafsilva5 can you explain exactly what do you mean by "update the actions script"? You mean when the tty board for a given board changes name? I kind of agree that the ci make rule should allow one to do this. I want to test and i need to override the tty port I write something like |
Yap. That's what I meant and that's what I propose. |
We can opt for a simple solution in the meanwhile, like allowing folders inside tests/tests/src with platform names, and if the makefile finds a folder matching the PLATFORM=xxx name, it includes all the sources of that folder too. But I'm also ok with moving forward with the PR and opening an issue |
|
@josecm @Diogo21Costa I think this might a bit out-of-scope, but may be worth addressing in some form of Test Guidelines. |
This is a very good point 🤔 should we add some |
kao now owns the harness, the headers and the make glue the guest includes, so the copies under tests/tests/src are gone. tests.mk hands kao everything explicitly: the tests root, the source directories that apply to the platform (the generic ones plus the arch subtree matching ARCH, ARCH_SUB, ARCH_PROFILE and arch_mem_prot, and the platform subtree, mirroring how src_dirs is composed), the configurations directory, and the default exclusion of nightly and manual tests. The PLATFORM and submodule checks move to parse time, guarded by the tests goal. Signed-off-by: Jose Martins <josemartins90@gmail.com>
Test sources live under 00_generic, 01_arch/SS_<ARCH>/... and 02_platform/SS_<PLATFORM>/, and ids are CC_SS_FF_TT, derived from the file location. The existing boot and irq tests move to 00_generic with the KAO_TEST registration, a type and a suite tag each, and vm_boot in the smoke set. check_ids.py verifies ids against their location and rejects duplicates; make tests runs it first. Signed-off-by: Jose Martins <josemartins90@gmail.com>
The directory holds the environments the tests declare with ENVS(...), so it is named after them; kao takes it through --envs. Signed-off-by: Jose Martins <josemartins90@gmail.com>
Test functions are <scope>_<module>_<what>: gen, arch or plat for the category, the file module name, and what is checked. The name is what kao prints next to the id, and the prefix keeps static names apart in the unity build. Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Points at the kao that discovers tests through the preprocessor, selects them by id, tags and environments, and builds the guest in place from its own framework directory. Signed-off-by: Jose Martins <josemartins90@gmail.com>
While that might be a good solution for the generic tests, how do you propose to implement a clear state for platform or architectural tests? Probably a better solution is to have the test developer be responsible for this and we as reviewers also be responsible for checking that before accepting any test. |
Overview
This PR integrates Bao Kao (abbreviated as bkao, "to put to the test"), an end-to-end testing (and benchmarking) framework for the Bao Hypervisor. Bao Kao automates the full pipeline from source build to on-target execution: it fetches toolchains, builds guest workloads, generates Bao configuration files based on targeted setup from YAML descriptors, assembles a bootable image (with optional firmware), launches it on the target platform (emulated or physical), and captures serial output to determine pass/fail.
Two new submodules are introduced:
Platforms supported:
Note
This PR supersedes #154. We have refactored completely the framework, removing nix support and leveraging only python to implement bao kao.
Source Tree Structure
Tests Available
Tests are defined using the
BAO_TEST(suite, test, setup, description)macro and discovered automatically at runtime by scanningtests/tests/src/*.c. Each test is tagged with a suite, a setup (which selects the VM configuration to use), and an ID used for selective execution.IDs are computed as
(file_index × 100) + test_index_within_file, where:tests/tests/src/
So with the current files (boot.c, irq.c):
Guest types supported in test configs: baremetal, freertos, linux. For now, we only target a baremetal setup.
How to Run (TLDR)
Via bao Makefile targets:
Run all tests for a platform:
make tests PLATFORM=<platform>Run all benchmarks for a platform:
make benchs PLATFORM=<platform>Other options only via calling bkao-py directly:
Run specific tests or benchmarks by ID:
python3 tests/bkao/src/bkao.py -t 100 101 -p <platform>python3 tests/bkao/src/bkao.py -b 100 -p <platform>Run all tests except some:
python3 bkao.py -t -x 200,201 -p <platform>Skip firmware and toolchain rebuild (faster iteration):
python3 bkao.py -t -p <platform> --no-firmware-build --no-toolchain-buildUse custom hypervisor sources:
python3 bkao.py -t -p <platform> --hyp-srcs /path/to/baoSet verbosity (0=final report only, 1=failures, 2=all):
python3 bkao.py -t -p <platform> -l 2Pass platform-specific args - only virtual platforms (e.g. GIC version):
python3 bkao.py -t -p qemu-aarch64-virt --plat-virt-args "GICV3"Bao Kao Process Pipeline
For each test or benchmark, bkao executes the following pipeline:
tests/tests/src/*.cforBAO_TESTmacros,benchs/src/benchmarks/for benchmark dirs, andplatforms/*.pyfor platform builders.[TESTF-C]tokens for pass/fail.