## Test Plan for CUDA and Android Support ### Unit Tests #### Test Case 1: NVIDIA GPU Detection - **Input:** System with NVIDIA GPU and pynvml installed - **Expected Output:** GPUInfo with correct name, VRAM, and is_nvidia=True - **Location:** src/hardware/detector.py:detect_nvidia_gpu() #### Test Case 2: GPU Layer Configuration for CUDA - **Input:** HardwareProfile with NVIDIA GPU (4GB VRAM) - **Expected Output:** n_gpu_layers=-1 (all layers), proper CUDA configuration - **Location:** src/backends/__init__.py:create_backend() #### Test Case 3: Android Platform Detection - **Input:** platform.system() returns 'Linux', Termux environment detected - **Expected Output:** is_android=True, proper Android path handling - **Location:** src/hardware/detector.py:detect_android() #### Test Case 4: PeerInfo with Timeout - **Input:** PeerInfo with custom timeout - **Expected Output:** FederationClient respects peer timeout - **Location:** src/network/discovery.py:PeerInfo ### Integration Tests #### End-to-End Flow 1: CUDA Backend Creation 1. Detect hardware with NVIDIA GPU 2. Create backend via factory 3. Verify n_gpu_layers=-1 set 4. Load test model 5. Expected: Successful GPU offload #### End-to-End Flow 2: Android Device Join Federation 1. Start discovery on Android (Termux) 2. Advertise Android hardware 3. Join federation from macOS peer 4. Send vote request 5. Expected: Android responds successfully #### End-to-End Flow 3: Federation with Per-Peer Timeout 1. Add peer with 30s timeout 2. Add peer with 60s timeout 3. Request votes from both 4. Expected: Each peer uses its own timeout ### Manual Verification #### Command to Run: ```bash python -m pytest tests/ -v -k "cuda or android or federation" ``` #### Expected Output: - All tests pass - No ImportError for pynvml - GPU layer detection works on CUDA machines - Android detection passes on Termux #### Platform Testing: 1. **macOS (Apple Silicon):** MLX backend loads 2. **Linux (NVIDIA):** CUDA backend auto-detects 3. **Android (Termux):** CPU-only mode, proper paths