This document provides a step-by-step testing plan before pushing to Git.
Ensure all files are in the correct locations:
# Run from project root
tree -L 3 -I 'build'
# Or use find
find . -type f ! -path './build/*' ! -path './.git/*' -name "*.cpp" -o -name "*.h"Test that the project compiles:
# Clean build
rm -rf build
./scripts/build.sh
# Expected output:
# - CMake configures successfully
# - All source files compile without errors
# - Executable created at build/streaming_service
# Check executable exists
ls -lh build/streaming_serviceVerify all includes are correct:
# This should show all include dependencies
g++ -std=c++17 -I./src -MM src/main.cppTest config loading:
# Verify sample config is valid
cat streaming.conf
# Test with invalid config (should use defaults)
./build/streaming_service nonexistent.conf
# Should print: "Could not open config file" but continueBasic code quality verification:
# Check for common issues
grep -r "TODO" src/ # Review TODOs
grep -r "FIXME" src/ # Check for FIXMEs (should be none)
# Count lines of code
find src -name "*.cpp" -o -name "*.h" | xargs wc -l | tail -1Ensure all docs are accurate:
# Check that README examples are correct
grep -A 5 "```bash" README.md
# Verify CHANGELOG is up to date
head -30 CHANGELOG.md
# Check all scripts are executable
ls -l scripts/*.shIf you have a USB camera:
# Check camera exists
ls -l /dev/video0
v4l2-ctl --list-devices
# Run server
./build/streaming_service
# Expected output:
# - Camera initializes successfully
# - Encoder starts (NVENC or CPU fallback)
# - Network binds to port 5000
# - Control thread starts
# - All threads running
# In another terminal, test client
./scripts/client_example.sh localhost 5000
# Expected:
# - HELLO packet sent
# - Client registered on server
# - Video playback startsIf no camera available:
# The program will fail at camera init - expected behavior
./build/streaming_service 2>&1 | head -20
# Should see:
# - Config loaded
# - Camera init attempted
# - Error: "Cannot open device /dev/video0"
# - Program exits gracefullyUse V4L2 loopback for testing:
# Install v4l2loopback (Ubuntu)
sudo apt-get install v4l2loopback-dkms v4l2loopback-utils
# Create virtual camera
sudo modprobe v4l2loopback
# Feed test video to virtual camera
ffmpeg -re -i test_video.mp4 -f v4l2 /dev/video0 &
# Now run streaming service
./build/streaming_serviceTest Docker containerization:
# Build Docker image
cd docker
docker build -t cubit-streaming:test -f Dockerfile ..
# Expected: Multi-stage build completes successfully
# Check image size
docker images | grep cubit-streaming
# Test run (will fail without camera, but checks container setup)
docker run --rm cubit-streaming:test --help 2>&1 || echo "Expected to fail without camera"Issue: CMake can't find FFmpeg
# Solution: Install FFmpeg dev libraries
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-devIssue: NVML not found
# This is OK - GPU monitoring is optional
# System will fall back to no adaptive bitrate
Issue: Permission denied on /dev/video0
# Solution: Add user to video group
sudo usermod -a -G video $USER
# Then logout/loginIssue: Port 5000 already in use
# Solution: Change port in streaming.conf
echo "udp_port=5001" >> streaming.confIssue: Client can't connect
# Check firewall
sudo ufw status
sudo ufw allow 5000/udp
# Check server is listening
sudo netstat -nlup | grep 5000If you want to measure performance:
# Monitor CPU usage
top -p $(pgrep streaming_service)
# Monitor network throughput
iftop -i eth0
# Check for dropped frames
# Look in server logs for "Dropped X frames" messagesBefore pushing to Git, verify:
- Project builds without errors
- All 18 source files compile
- Configuration file parsing works
- Documentation is accurate
- Scripts are executable
- .gitignore includes build artifacts
- No sensitive data in repository
- CHANGELOG is up to date
- README has correct usage examples
Run this for a quick sanity check:
#!/bin/bash
echo "=== CUBIT Streaming System - Pre-Push Tests ==="
echo ""
echo "1. Checking project structure..."
if [ ! -f "CMakeLists.txt" ]; then
echo "ERROR: Not in project root"
exit 1
fi
echo "✓ Project root confirmed"
echo ""
echo "2. Checking all source files exist..."
FILES="
src/main.cpp
src/camera/capture.cpp
src/encoding/encoder.cpp
src/network/udp_streamer.cpp
src/monitoring/gpu_monitor.cpp
src/monitoring/performance_tracker.cpp
src/monitoring/adaptation_controller.cpp
"
for f in $FILES; do
if [ ! -f "$f" ]; then
echo "ERROR: Missing $f"
exit 1
fi
done
echo "✓ All source files present"
echo ""
echo "3. Checking documentation..."
for doc in README.md CHANGELOG.md LICENSE; do
if [ ! -f "$doc" ]; then
echo "ERROR: Missing $doc"
exit 1
fi
done
echo "✓ Documentation complete"
echo ""
echo "4. Testing build..."
./scripts/build.sh > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "✓ Build successful"
else
echo "ERROR: Build failed"
exit 1
fi
echo ""
echo "5. Checking executable..."
if [ -f "build/streaming_service" ]; then
echo "✓ Executable created"
ls -lh build/streaming_service
else
echo "ERROR: Executable not found"
exit 1
fi
echo ""
echo "=== All Pre-Push Tests Passed! ==="
echo "Ready to commit and push to Git"Save this as scripts/pre_push_test.sh and run before pushing.