Hardware test suite for validating profiler installations on WLAN Pi devices.
The profiler includes a comprehensive test suite for on-device validation. Tests are isolated via pytest fixtures and run in stages to prevent state contamination.
sudo profiler testsudo profiler test -v# Skip on-device tests (run offline tests only)
sudo profiler test -m "not ondevice"
# Run only on-device tests
sudo profiler test -m ondevice- Hostapd binary presence and executable permissions
- Hostapd_cli binary presence and executable permissions
- Profiler CLI availability in system PATH
- Configuration file existence
- Required data directories
- Network interface discovery and capabilities
- Wireless tools availability (iw, ip, rfkill)
- Interface preparation for monitor mode
- Virtual interface creation
- Mode switching validation
- End-to-end profiler operation
- Frame capture validation
- Result file generation
Fast tests that don't require hardware:
- Configuration parsing
- Data structure validation
- Utility function testing
Run with:
sudo profiler test -m "not ondevice"Tests requiring actual WLAN Pi hardware with wireless interfaces:
- Interface staging
- Frame injection
- Live capture validation
These tests are marked with @pytest.mark.ondevice and are skipped by default when wireless interfaces are not detected.
Run with:
sudo profiler test -m ondevicetests/
├── conftest.py # Shared fixtures and configuration
├── hardware/
│ ├── __init__.py
│ ├── test_interface_staging.py
│ └── test_ota_beacons.py
└── hardware/
└── ondevice/
├── __init__.py
├── test_health_checks.py
└── test_interface_staging.py
import pytest
def test_example():
"""Test description"""
assert Trueimport pytest
@pytest.mark.ondevice
def test_requires_hardware():
"""This test only runs on actual hardware"""
# Test code here
passdef test_with_interface(interface_fixture):
"""Test using the interface fixture"""
# interface_fixture provides a prepared interface
passTests are run automatically on:
- Pull requests
- Releases
- Scheduled builds
CI runs use the -m "not ondevice" flag to skip hardware-dependent tests.
Before releasing:
- Run full test suite:
sudo profiler test - Test on clean WLAN Pi OS installation
- Test with different adapters (mt76x2u, iwlwifi, etc.)
- Verify pcap analysis mode works
- Test configuration file overrides
- Verify web interface displays results
Ensure you're running with sudo:
sudo profiler testCheck that wireless interfaces are available:
iw devIf tests are interfering with each other:
- Reset the interface manually
- Restart the test suite
- Check for stale processes:
ps aux | grep hostapd
Test fixtures and sample data are stored in:
tests/fixtures/- Sample pcap files and configurationstests/data/- Expected output files
- Development guide - Building and contributing
- Contributing guide - How to contribute
- Interface staging - How interface preparation works