Skip to content

Conversation

@valentinbreiz
Copy link
Owner

No description provided.

@valentinbreiz valentinbreiz marked this pull request as draft November 5, 2025 05:03
Implemented complete test runner framework for NativeAOT kernels with
QEMU execution, binary protocol over UART, and GitHub Actions CI/CD
integration. The system supports both x64 and ARM64 architectures with
automated testing, result reporting, and artifact management.

Test Runner Components:
- Engine: QEMU host implementations (x64/ARM64) with configurable timeout
- Framework: In-kernel test API (Assert, TestRunner.Start/Run/Finish)
- Protocol: Binary UART messages (0x64-0x69) with Latin1 encoding
- Output Handlers: Console (colored), XML (JUnit), multiplexing support

Build System Fixes:
- Added -DARCH_X64 and -DARCH_ARM64 to GCC compiler flags in Cosmos.Build.GCC.targets
- Fixed architecture-specific code compilation (kmain.c now compiles correctly per arch)

QEMU Configuration Fixes:
- Added -boot d flag to boot from CD-ROM properly
- Added -no-reboot flag to prevent boot loops after kernel halt
- Both x64 and ARM64 hosts now boot and execute tests successfully

VS Code Integration:
- Added "dev" mode parameter to debug configurations for visual QEMU testing
- Created test tasks for quick HelloWorld testing (x64/ARM64)
- Debug configurations for both architectures with proper display settings

CI/CD Workflow (.github/workflows/kernel-tests.yml):
- Parallel x64/ARM64 testing matrix with Ubuntu + QEMU
- Automated test result publishing to PR comments
- JUnit XML report generation and artifact uploads
- Test summary generation with pass/fail counts
- Automatic failure comments with UART debug logs

Example Test Kernel:
- Cosmos.Kernel.Tests.HelloWorld with 3 passing assertions
- Demonstrates test framework API usage
- Works on both x64 and ARM64 architectures

Documentation:
- tests/README.md: Usage guide for developers
- .taskmaster/docs/test-runner-prd.txt: Product requirements document
- CLAUDE.md: Updated with test workflow and Task Master integration

Tests performed:
- x64: HelloWorld kernel passes 3/3 tests with QEMU
- ARM64: HelloWorld kernel passes 3/3 tests with QEMU (requires UEFI firmware)
- Both architectures produce correct UART output and JUnit XML results
@valentinbreiz valentinbreiz force-pushed the feature/Cosmos.Kernel.Tests branch from 4cd0947 to 49f8fb0 Compare November 5, 2025 05:40
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

🧪 Cosmos Kernel Tests (x64)

1 tests   1 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 87052f1.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

🧪 Cosmos Kernel Tests (arm64)

0 tests   0 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 87052f1.

♻️ This comment has been updated with latest results.

@valentinbreiz valentinbreiz force-pushed the feature/Cosmos.Kernel.Tests branch from 1370336 to 87052f1 Compare November 5, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants