Running Tests¶
This guide covers different ways to execute BIT tests for various use cases.
Quick Reference¶
| Scenario | Command | Use Case |
|---|---|---|
| System validation | bit-manager -o |
Quick health check |
| Continuous monitoring | sudo systemctl start bit_manager |
Production deployment |
| Single test | bit-manager -t <test_name> -o |
Debug specific component |
| Remote monitoring | bit-manager --zenoh |
Enable remote monitors |
| CI/CD | bit-manager -o && echo "Pass" |
Automated testing |
For detailed bit-manager options, see bit-manager reference.
Running Tests by Type¶
Running All Tests¶
# One-shot: Run all tests once
bit-manager -o
# Service: Run continuously
sudo systemctl start bit_manager
Running PBIT Tests Only¶
PBIT tests run automatically at boot when using service mode. To run manually:
# Run all PBIT tests individually
bit-manager -t pbit_cpu_usage -t pbit_memory_usage -t pbit_disk_usage -o
Remote control:
# Enable/disable all PBIT tests at once
bit-monitor-cli --hostname=<device> --enable-suite PBIT
bit-monitor-cli --hostname=<device> --disable-suite PBIT
# Run all enabled PBIT tests immediately
bit-monitor-cli --hostname=<device> --run-enabled PBIT
Running CBIT Tests Only¶
CBIT tests run automatically at configured frequencies in service mode. To test manually:
# Run all CBIT tests once (ignores frequency)
bit-manager -t cbit_cpu_usage -t cbit_memory_usage -t cbit_disk_usage -o
Remote control:
# Enable/disable all CBIT tests
bit-monitor-cli --hostname=<device> --enable-suite CBIT
bit-monitor-cli --hostname=<device> --disable-suite CBIT
# Trigger immediate run of all enabled CBIT tests
bit-monitor-cli --hostname=<device> --run-enabled CBIT
Running FBIT Tests¶
FBIT tests never run automatically - always triggered manually:
Remote control:
# Run specific FBIT test
bit-monitor-cli --hostname=<device> --run-test fbit_serial_data
# Run all FBIT tests
bit-monitor-cli --hostname=<device> --run-suite FBIT
Common Scenarios¶
Initial System Validation¶
After installation or hardware changes:
Production Deployment¶
For continuous monitoring:
# Enable service to start at boot
sudo systemctl enable bit_manager
# Start service now
sudo systemctl start bit_manager
# Verify running
sudo systemctl status bit_manager
View live results:
# Via logs
sudo journalctl -u bit_manager -f
# Via remote monitor (requires bit-manager --zenoh)
bit-monitor-cli --hostname=<device>
CI/CD Integration¶
#!/bin/bash
# Run critical tests in CI pipeline
bit-manager -t pbit_cpu_usage -t pbit_memory_usage -t pbit_disk_usage -o
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo "❌ Critical tests failed"
exit 1
else
echo "✓ All critical tests passed"
fi
Remote Testing¶
# Via SSH
ssh user@remote-host "bit-manager -o"
# With sudo for PBIT tests
ssh user@remote-host "sudo bit-manager -o"
Scheduled Testing¶
# Add to crontab for daily validation
crontab -e
# Run tests daily at 3 AM
0 3 * * * /usr/bin/bit-manager -o >> /var/log/bit-daily.log 2>&1
Debugging Failed Tests¶
When a test fails:
# 1. Get test details
bit-inspect <failed_test_name>
# 2. Run test individually with logging
BIT_STDOUT_LOG=1 bit-manager -t <failed_test_name> -o
# 3. Check configuration
cat /etc/bit/<failed_test_name>.toml
# 4. Check logs
sudo journalctl -u bit_manager | grep <failed_test_name>
Remote Control¶
Both bit-monitor-cli and bit-monitor-gui provide remote control capabilities:
Enable/Disable Tests¶
# Single test
bit-monitor-cli --hostname=<device> --enable-test pbit_temperature
bit-monitor-cli --hostname=<device> --disable-test pbit_temperature
# Entire suite
bit-monitor-cli --hostname=<device> --enable-suite CBIT
bit-monitor-cli --hostname=<device> --disable-suite PBIT
Changes persist to configuration files and survive bit-manager restarts.
Run Tests On-Demand¶
# Single test
bit-monitor-cli --hostname=<device> --run-test pbit_ethernet
# Entire suite
bit-monitor-cli --hostname=<device> --run-suite FBIT
# Only enabled tests
bit-monitor-cli --hostname=<device> --run-enabled CBIT
Understanding Test Output¶
Console Output¶
When run with -o, results print to stdout:
[2026-01-07 10:15:30] PBIT PASS: pbit_cpu_usage - CPU usage at 12%
[2026-01-07 10:15:31] PBIT PASS: pbit_memory_usage - Memory usage at 45%
[2026-01-07 10:15:32] CBIT PASS: cbit_disk_usage - Disk usage at 67%
[2026-01-07 10:15:33] CBIT FAIL: cbit_temperature - Temperature 85°C exceeds threshold
Format: [timestamp] TYPE STATUS: test_name - description
Service Logs¶
When running as a service:
# Follow live logs
sudo journalctl -u bit_manager -f
# View recent logs
sudo journalctl -u bit_manager -n 100
# Filter by test type
sudo journalctl -u bit_manager | grep PBIT
sudo journalctl -u bit_manager | grep CBIT
# Filter by status
sudo journalctl -u bit_manager | grep FAIL
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | All tests passed |
| 1 | One or more tests failed |
| 2 | Configuration or plugin loading error |
Troubleshooting¶
See Troubleshooting Guide for common issues.
Next Steps¶
- bit-manager - Complete command reference
- Test Types - Understanding PBIT, CBIT, and FBIT
- bit-monitor-cli - Remote monitoring and control
- bit-monitor-gui - Graphical monitoring