This document provides troubleshooting guidance for the current QEMU test tool implementation, focusing on the test validation utilities and placeholder test server.
Symptoms: The validation script fails to parse console logs or reports no structured messages found.
Diagnosis:
# Check log file format
./Scripts/qemu-test-validation.sh validate-format console.log
# View raw log content
head -20 console.log
# Check for structured messages
./Scripts/qemu-test-validation.sh parse-log console.logSolutions:
- Ensure log files use the correct structured format:
[YYYY-MM-DD HH:MM:SS.mmm] MESSAGE_TYPE: details - Verify log files are not empty or corrupted
- Check file permissions for log files
- Use absolute paths when referencing log files
Symptoms: Script fails to detect correct test environment or uses wrong timeout values.
Diagnosis:
# Check current environment detection
./Scripts/qemu-test-validation.sh environment-info
# Verify environment variables
echo "CI: ${CI:-unset}"
echo "GITHUB_ACTIONS: ${GITHUB_ACTIONS:-unset}"
echo "TEST_ENVIRONMENT: ${TEST_ENVIRONMENT:-unset}"Solutions:
- Set explicit environment:
TEST_ENVIRONMENT=ci ./Scripts/qemu-test-validation.sh - Verify CI environment variables are set correctly
- Check script permissions and execution context
Symptoms: Server connectivity tests fail even when server is running.
Diagnosis:
# Test basic connectivity
nc -z localhost 3240
# Check if USB/IP server is running
lsof -i :3240
# Test with different timeout
./Scripts/qemu-test-validation.sh check-server localhost 3240Solutions:
- Ensure USB/IP server is running and listening on correct port
- Check firewall settings blocking local connections
- Verify network configuration allows local connections
- Install required tools:
brew install netcat(if using nc)
Symptoms: Tests timeout prematurely or take too long in certain environments.
Diagnosis:
# Check current timeout configuration
./Scripts/qemu-test-validation.sh environment-info
# Test with custom timeouts
TEST_ENVIRONMENT=development ./Scripts/qemu-test-validation.sh wait-readiness console.log 30Solutions:
- Adjust environment-specific timeouts by setting
TEST_ENVIRONMENT - Use longer timeouts for slower systems:
TEST_ENVIRONMENT=production - For CI environments, ensure reasonable timeout values (60-120s)
Symptoms: QEMUTestServer fails to build with Swift Package Manager.
Diagnosis:
# Build with verbose output
swift build --product QEMUTestServer --verbose
# Check for compilation errors
swift build --product QEMUTestServer 2>&1 | grep errorSolutions:
- Ensure Swift toolchain is properly installed
- Clean build directory:
swift package clean - Update dependencies:
swift package resolve - Check Package.swift configuration for QEMUTestServer target
Symptoms: QEMUTestServer crashes or doesn't start properly.
Diagnosis:
# Run with direct execution
./.build/debug/QEMUTestServer
# Check for runtime errors
swift run QEMUTestServer 2>&1Solutions:
- Current implementation is a placeholder - limited functionality expected
- Check console output for error messages
- Verify system permissions for executable
Common Issues:
- Faster timeouts may cause false failures on slower development machines
- Log parsing issues when testing with incomplete logs
Solutions:
# Use development-friendly settings
TEST_ENVIRONMENT=development ./Scripts/qemu-test-validation.sh check-readiness console.log
# Allow partial validation
./Scripts/qemu-test-validation.sh environment-validation console.log basicCommon Issues:
- Environment detection failures in CI runners
- Network connectivity restrictions
- Missing system tools (nc, telnet)
Solutions:
# Explicit CI environment setting
TEST_ENVIRONMENT=ci ./Scripts/qemu-test-validation.sh validate-environment
# Install required tools in CI
brew install netcatCommon Issues:
- Extended timeouts may be too long for some use cases
- Comprehensive validation may fail on resource-constrained systems
Solutions:
# Adjust validation level
./Scripts/qemu-test-validation.sh environment-validation console.log basic
# Monitor resource usage
top -l 1 | grep -E "(CPU|Memory)"Current Limitation: Full QEMU testing framework (image creation, VM management) is not yet implemented.
Workarounds:
- Use existing test validation utilities for log analysis
- Implement custom test scenarios using the placeholder test server
- Focus on unit and integration tests rather than full QEMU testing
Planned Solutions:
- QEMU image creation scripts (planned)
- VM lifecycle management utilities (planned)
- Automated testing framework (future development)
Current Limitation: QEMUTestServer is a minimal placeholder.
Workarounds:
- Use other testing methods for USB/IP protocol validation
- Develop against the main usbipd server implementation
- Implement mock test scenarios for development
# Check all components
echo "=== Environment ==="
./Scripts/qemu-test-validation.sh environment-info
echo "=== Build Status ==="
swift build --product QEMUTestServer
echo "=== Script Availability ==="
ls -la Scripts/qemu-test-validation.sh
echo "=== System Tools ==="
which nc || echo "netcat not available"
which telnet || echo "telnet not available"# Analyze existing log file
if [ -f console.log ]; then
echo "=== Log Format Validation ==="
./Scripts/qemu-test-validation.sh validate-format console.log
echo "=== Log Statistics ==="
./Scripts/qemu-test-validation.sh get-stats console.log
echo "=== Generate Report ==="
./Scripts/qemu-test-validation.sh generate-report console.log
else
echo "No console.log found for analysis"
fi- Review Documentation: QEMU Test Tool for current capabilities
- Test Validation Script: Run
./Scripts/qemu-test-validation.sh --helpfor available commands - Build Status: Verify
swift build --product QEMUTestServerworks
When reporting issues with the current implementation:
- Specify Component: Test validation utility vs. placeholder test server
- Include Environment: Development, CI, or production environment
- Provide Logs: Include relevant console logs and error messages
- System Info: Include macOS version, Swift version, and hardware details
For enhancing the current implementation:
- Test Validation Utility: Improve parsing, add validation features, enhance environment detection
- Placeholder Test Server: Implement basic USB/IP protocol support
- Future Features: Contribute to planned QEMU image and VM management capabilities
- QEMU Test Tool Documentation - Current implementation overview
- Testing Strategy - Overall project testing approach
- Build Troubleshooting - General build issues