Skip to main content

Test Overview

Aurora OS includes multiple test suites to ensure kernel stability and correctness:
  • Unit Tests - Kernel component tests (allocator, scheduler, capabilities)
  • QEMU Boot Tests - End-to-end boot validation
  • Source Checks - Validate kernel symbols and structure
  • Browser Tests - WebAssembly runtime testing with Playwright
  • Fuzz Testing - Automated fuzzing for security

Running All Tests

make test
This command:
  1. Builds the kernel (if needed)
  2. Compiles and runs unit tests
  3. Executes QEMU boot validation
The test suite runs automatically in CI on every pull request.

Unit Tests

Test Harness

The kernel includes a hosted test harness that runs without QEMU:
# Compile and run unit tests
gcc -I kernel/src tests/unit/kernel/test_harness.c -o dist/test_runner
./dist/test_runner

Test Coverage

Tests the kernel’s physical memory allocator:
  • Page allocation and deallocation
  • Memory region management
  • Boundary conditions
  • Out-of-memory handling
Tests kernel heap allocation:
  • Dynamic allocation
  • Memory coalescing
  • Free list management
  • Fragmentation handling
Tests the object-capability system:
  • Capability creation
  • Capability verification
  • Capability revocation
  • Permission enforcement
Tests the CFS-style scheduler:
  • vruntime ordering
  • Process priority
  • Time slice allocation
  • Context switching

QEMU Boot Tests

Validates that the kernel boots successfully in QEMU:
bash tests/qemu/boot-test.sh

What It Tests

1

ISO Build

Verifies the bootable ISO can be created:
make iso
2

Boot Sequence

Launches QEMU with a timeout and monitors serial output:
qemu-system-x86_64 \
  -cdrom dist/aurora-os.iso \
  -m 128M \
  -nographic \
  -serial mon:stdio \
  -no-reboot \
  -timeout 10
3

Boot Verification

Checks for kernel initialization messages:
  • Bootloader handoff
  • Memory initialization
  • Capability system ready
  • Scheduler initialized
Boot logs are saved to dist/boot-test.log for debugging.

Source Validation

Run static analysis checks on the kernel source:
# Run all source checks
for f in tests/source-checks/*.sh; do bash "$f"; done

Check Categories

Validates kernel ELF symbols:
bash tests/source-checks/symbols.sh
  • Required kernel symbols are present
  • No undefined references
  • Proper symbol visibility

Browser Tests (Playwright)

Test the WebAssembly runtime in real browsers:
1

Install Dependencies

npm install @playwright/test serve
npx playwright install --with-deps chromium
2

Build WASM Runtime

make wasm
This creates wasm-runtime/pwa/kernel.wasm and loader.
3

Run Browser Tests

npx playwright test tests/browser/chrome.spec.ts --reporter=list
npx playwright test --reporter=list

Test Coverage

Browser tests validate:
  • Page loads without errors
  • WASM module initializes
  • Boot screen renders
  • Kernel bridge functions work
  • Service worker caches assets
Playwright automatically serves wasm-runtime/pwa/ using the webServer configuration.

Fuzz Testing

Automated fuzzing runs nightly via GitHub Actions.

Local Fuzzing

cd tests/fuzz/c
gcc -fsanitize=address,fuzzer fuzz_target.c -o fuzzer
./fuzzer
Uses LLVM’s libFuzzer for coverage-guided fuzzing.

Trigger Manual Fuzz Run

  1. Go to GitHub Actions → Nightly Fuzz
  2. Click “Run workflow”
  3. Wait for results
Fuzz testing can take hours. Results are reported as GitHub Issues if crashes are found.

Continuous Integration

All tests run automatically on:
  • Pull requests
  • Commits to main
  • Nightly builds

CI Test Matrix

Jobs:
  - build:       Compile kernel for all architectures
  - unit-tests:  Run hosted unit tests
  - qemu-tests:  Boot validation
  - wasm-tests:  Browser tests with Playwright
  - fuzz:        Nightly fuzzing (scheduled)
See .github/workflows/ for full CI configuration.

Test Development

Adding Unit Tests

  1. Add test functions to tests/unit/kernel/test_harness.c:
void test_my_feature(void) {
    // Setup
    int result = my_kernel_function();
    
    // Assert
    assert(result == EXPECTED_VALUE);
}
  1. Register in test suite:
int main(void) {
    test_my_feature();
    printf("✓ My feature test passed\n");
    return 0;
}

Adding Browser Tests

  1. Create a new spec file in tests/browser/:
import { test, expect } from '@playwright/test';

test('my feature works', async ({ page }) => {
  await page.goto('http://localhost:8080');
  await expect(page.locator('#my-element')).toBeVisible();
});

Benchmarking

Performance benchmarks must run inside the full kernel:
# Note: Benchmarks are not automated
make bench
This displays instructions:
=== AURORA OS Benchmarks ===
Benchmarks must run inside QEMU with the full kernel.
  1. Build: make iso
  2. Boot:  make run
  3. Run bench binaries from the shell inside the OS.
See docs/testing.md for details.
In-kernel benchmarking tools are under development.

Test Logs and Artifacts

Test artifacts are saved to:
dist/
├── test_runner        # Unit test binary
├── boot-test.log      # QEMU boot output
└── playwright-report/ # Browser test results

Troubleshooting

Ensure include paths are correct:
gcc -I kernel/src -I kernel/include \
  tests/unit/kernel/test_harness.c -o dist/test_runner
Increase timeout in tests/qemu/boot-test.sh:
# Change -timeout value
qemu-system-x86_64 ... -timeout 30
Check if port 8080 is already in use:
lsof -i :8080
# Kill conflicting process or change port in playwright.config.ts
This is expected! Check the crash artifact:
# Crash inputs are saved to:
tests/fuzz/c/crash-*

# Reproduce with:
./fuzzer crash-[hash]

Next Steps

Contributing

Learn how to submit your changes

Setup Guide

Review development environment setup

Build docs developers (and LLMs) love