# thesofproject/sof-test architecture

> Architecture diagram of the GitHub repository thesofproject/sof-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thesofproject/sof-test
- Repository: https://github.com/thesofproject/sof-test

## Overview

SOF Test Case is a Linux audio validation and diagnostic toolkit. Users run individual test scripts against a SOF-enabled system; tests exercise playback, capture, system behavior, and audio features, then report pass/fail/not-applicable via exit status. Shared shell helpers support test logic, while command-line tools inspect system state, topology, audio traces, and performance. The README documents direct script execution and several external audio tools; source excerpts are limited, so links between unsampled subsystems are omitted.

Main entry points: [`test-case`](https://github.com/thesofproject/sof-test/tree/main/test-case) (Test scripts), [`test-case/check-playback.sh`](https://github.com/thesofproject/sof-test/blob/main/test-case/check-playback.sh) (Playback and capture), [`tools/sof-dump-status.py`](https://github.com/thesofproject/sof-test/blob/main/tools/sof-dump-status.py) (System status dump), [`kernel_tracing/measure_function_time.py`](https://github.com/thesofproject/sof-test/blob/main/kernel_tracing/measure_function_time.py) (Kernel function timing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tests["Audio Tests"]
  node_suite["Test scripts"]
  node_playback["Playback and capture<br/>[check-playback.sh]"]
  node_system["System behavior tests"]
  node_audio_features["Audio feature tests"]
end

subgraph group_framework["Test Support"]
  node_helpers["Shell helper library"]
  node_platform_settings["Platform ALSA settings"]
end

subgraph group_diagnostics["Diagnostics"]
  node_status_dump["System status dump<br/>[sof-dump-status.py]"]
  node_common["Pipeline formatting<br/>[common.py]"]
  node_topology["Topology inspection and merge<br/>[tplgtool2.py]"]
  node_ipc_timing["IPC timing analysis<br/>[sof-ipc-timer.py]"]
  node_performance["Firmware performance analysis"]
  node_fragment_analysis["Sound fragment analysis"]
  node_kernel_timing["Kernel function timing"]
end

node_user(("Test operator"))
node_audio_stack["ALSA and TinyALSA"]
node_pipewire["PipeWire"]
node_test_result["Exit status"]
node_bpftrace["bpftrace"]

node_user -->|"runs directly"| node_suite
node_suite -->|"includes"| node_playback
node_playback -->|"plays audio"| node_audio_stack
node_suite -.->|"can use"| node_pipewire
node_suite -->|"reports status"| node_test_result
node_suite -->|"uses reboot wrapper"| node_helpers
node_status_dump -->|"imports formatting"| node_common
node_kernel_timing -->|"runs probes with"| node_bpftrace

click node_suite "https://github.com/thesofproject/sof-test/tree/main/test-case"
click node_playback "https://github.com/thesofproject/sof-test/blob/main/test-case/check-playback.sh"
click node_system "https://github.com/thesofproject/sof-test/tree/main/test-case"
click node_audio_features "https://github.com/thesofproject/sof-test/tree/main/test-case"
click node_helpers "https://github.com/thesofproject/sof-test/tree/main/case-lib"
click node_platform_settings "https://github.com/thesofproject/sof-test/tree/main/alsa_settings"
click node_status_dump "https://github.com/thesofproject/sof-test/blob/main/tools/sof-dump-status.py"
click node_common "https://github.com/thesofproject/sof-test/blob/main/tools/common.py"
click node_topology "https://github.com/thesofproject/sof-test/blob/main/tools/tplgtool2.py"
click node_ipc_timing "https://github.com/thesofproject/sof-test/blob/main/tools/sof-ipc-timer.py"
click node_performance "https://github.com/thesofproject/sof-test/blob/main/tools/sof_perf_analyzer.py"
click node_fragment_analysis "https://github.com/thesofproject/sof-test/blob/main/tools/analyze-sound-fragments.py"
click node_kernel_timing "https://github.com/thesofproject/sof-test/blob/main/kernel_tracing/measure_function_time.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_suite,node_playback,node_system,node_audio_features toneBlue
class node_helpers,node_platform_settings toneAmber
class node_status_dump,node_common,node_topology,node_ipc_timing,node_performance,node_fragment_analysis,node_kernel_timing toneMint
class node_user,node_audio_stack,node_pipewire,node_test_result,node_bpftrace toneIndigo
```

## Components

### Audio Tests

- [Test scripts](https://github.com/thesofproject/sof-test/tree/main/test-case): `test-case`
- [Playback and capture](https://github.com/thesofproject/sof-test/blob/main/test-case/check-playback.sh): `test-case/check-playback.sh`
- [System behavior tests](https://github.com/thesofproject/sof-test/tree/main/test-case): `test-case`
- [Audio feature tests](https://github.com/thesofproject/sof-test/tree/main/test-case): `test-case`

### Test Support

- [Shell helper library](https://github.com/thesofproject/sof-test/tree/main/case-lib): `case-lib`
- [Platform ALSA settings](https://github.com/thesofproject/sof-test/tree/main/alsa_settings): `alsa_settings`

### Diagnostics

- [System status dump](https://github.com/thesofproject/sof-test/blob/main/tools/sof-dump-status.py): `tools/sof-dump-status.py`
- [Pipeline formatting](https://github.com/thesofproject/sof-test/blob/main/tools/common.py): `tools/common.py`
- [Topology inspection and merge](https://github.com/thesofproject/sof-test/blob/main/tools/tplgtool2.py): `tools/tplgtool2.py`
- [IPC timing analysis](https://github.com/thesofproject/sof-test/blob/main/tools/sof-ipc-timer.py): `tools/sof-ipc-timer.py`
- [Firmware performance analysis](https://github.com/thesofproject/sof-test/blob/main/tools/sof_perf_analyzer.py): `tools/sof_perf_analyzer.py`
- [Sound fragment analysis](https://github.com/thesofproject/sof-test/blob/main/tools/analyze-sound-fragments.py): `tools/analyze-sound-fragments.py`
- [Kernel function timing](https://github.com/thesofproject/sof-test/blob/main/kernel_tracing/measure_function_time.py): `kernel_tracing/measure_function_time.py`

### Other components

- **Test operator**
- **ALSA and TinyALSA**
- **PipeWire**
- **Exit status**
- **bpftrace**

## Connections

- Test operator → Test scripts: runs directly (evidence: `README.md`)
- Test scripts → Playback and capture: includes (evidence: `README.md`)
- Playback and capture → ALSA and TinyALSA: plays audio (evidence: `README.md`)
- Test scripts → PipeWire: can use (evidence: `README.md`)
- Test scripts → Exit status: reports status (evidence: `README.md`)
- Test scripts → Shell helper library: uses reboot wrapper (evidence: `README.md`)
- System status dump → Pipeline formatting: imports formatting (evidence: `tools/sof-dump-status.py`)
- Kernel function timing → bpftrace: runs probes with (evidence: `kernel_tracing/measure_function_time.py`)
