Quick Start

This guide will help you run your first BIT tests in under 5 minutes.

Prerequisites

Ensure you have installed the BIT SDK and generated configuration files.

Run All Tests Once

The simplest way to start is running all tests in "one-shot" mode:

# Set environment variables
export BIT_CONFIG_PATH=/etc/bit
export BIT_TEST_PATH=/usr/local/lib/bit_manager

# Run all tests once and exit
sudo bit-manager -o

This will: 1. Load all PBIT (power-on) tests 2. Load all CBIT (continuous) tests 3. Run each test once 4. Display results and exit

Example Output

2025-12-08 03:25:30.717 FBIT:[PASS] pbit_cpu_usage
2025-12-08 03:25:30.850 FBIT:[PASS] pbit_memory_usage
2025-12-08 03:25:31.123 FBIT:[PASS] pbit_disk_usage
2025-12-08 03:25:31.456 FBIT:[PASS] pbit_ethernet
2025-12-08 03:25:31.789 FBIT:[FAIL] pbit_gpu_loading
...

Run Specific Tests

Run only specific tests by name:

# Run a single PBIT test
bit-manager -t pbit_cpu_usage -o

# Run multiple tests
bit-manager -t pbit_cpu_usage -t cbit_memory_usage -o

Inspect Available Tests

Before running, you can inspect what tests are available:

# List all tests with descriptions
bit-inspect

# Get detailed information about a specific test
bit-inspect pbit_disk_usage

Example Detailed Output

$ bit-inspect cbit_disk_usage

Details:
  Long-Name              Disk utilization test
  Author                 Ross Newman <[email protected]>
  Description            Check the disk is not nearing full
  Status                 NotRun

Plugin Details:
  Plugin Name            cbit_disk_usage
  Version                1.0.0
  Date Built             2025-12-08 01:42:11
  Module                 /usr/local/lib/bit_manager/libcbit_disk_usage.so
  Config File            /etc/bit/cbit_disk_usage.toml
  Run Frequency          Periodic(30s)

Config Details:
  disk
    +----(0) disk: "/dev/sda1"
    +----(0) threshold: 80
    +----(1) disk: "/dev/shm"
    +----(1) threshold: 80

Running as a Service

For continuous monitoring, run BIT manager as a systemd service:

# Enable service to start on boot
sudo systemctl enable bit_manager

# Start the service
sudo systemctl start bit_manager

# Check status
sudo systemctl status bit_manager

When running as a service: - PBIT tests run once at startup - CBIT tests run continuously at their configured intervals - Logs are written to /tmp/bit-manager_INFO_<timestamp>.log

View Service Logs

# Follow logs in real-time
sudo journalctl -u bit_manager -f

# View last 50 lines
sudo journalctl -u bit_manager -n 50

# View logs for today
sudo journalctl -u bit_manager --since today

Understanding Test Results

Test Status

  • PASS ✓ - Test completed successfully, all checks passed
  • FAIL ✗ - Test failed, issue detected
  • NotRun - Test hasn't been executed yet

Common Failure Scenarios

No hardware detected:

2025-12-08 03:25:40.579 FBIT:[PASS] pbit_can
INFO: No CAN interfaces configured - test passes
This is normal - tests pass gracefully when hardware isn't present.

Threshold exceeded:

2025-12-08 03:25:45.123 FBIT:[FAIL] cbit_disk_usage
ERROR: Disk /dev/sda1 usage 85% exceeds threshold 80%
Action needed - disk is nearly full.

Permission denied:

ERROR: pbit_dmesg_check requires root privileges
Run with sudo or as root.

Customize Configuration

If you need to adjust test settings:

# Edit a specific test config
sudo nano /etc/bit/cbit_disk_usage.toml

# Or regenerate all configs (WARNING: overwrites existing)
sudo bit-learn

See the Configuration Guide for details on configuration options.

Next Steps

Common Workflows

Development Testing

When developing or debugging:

# Build and run locally
cd /path/to/bit
cargo build
export BIT_CONFIG_PATH=./bit_manager/config
export BIT_TEST_PATH=./target/debug
./target/debug/bit-manager -o

Production Deployment

For production systems:

# Install as package
sudo dpkg -i bit-manager_*.deb

# Generate production configs
sudo bit-learn

# Enable service
sudo systemctl enable --now bit_manager

# Monitor
sudo journalctl -u bit_manager -f

CI/CD Integration

In automated testing:

#!/bin/bash
# Run tests and capture exit code
bit-manager -o
EXIT_CODE=$?

# Check results
if [ $EXIT_CODE -ne 0 ]; then
    echo "BIT tests failed"
    exit 1
fi
echo "All BIT tests passed"