prole/test_embedded_resources.sh

85 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
echo "=== Testing Embedded Resources ==="
echo ""
# Test 1: Images
echo "1. Testing image resources..."
python3 -c "
from pathlib import Path
import sys
sys.path.insert(0, str(Path.cwd()))
from install import get_resource_path
images = [
'img/proleIcon.png',
'img/proleLogo.png',
'img/proleLogoSepia.png',
]
for img in images:
path = get_resource_path(img)
if not path.exists():
print(f'✗ Missing: {img}')
sys.exit(1)
print('✓ All images present')
"
if [ $? -ne 0 ]; then exit 1; fi
# Test 2: Binaries
echo "2. Testing binary resources..."
if [ -f "prole-net/prole-scan" ] && [ -x "prole-net/prole-scan" ]; then
echo " ✓ prole-scan binary present and executable"
else
echo " ✗ prole-scan missing or not executable"
exit 1
fi
# Test 3: App bundle
echo "3. Testing Prole Tools.app bundle..."
if [ -d "prole-app/dist/Prole Tools.app" ]; then
echo " ✓ Prole Tools.app present"
else
echo " ✗ Prole Tools.app missing"
exit 1
fi
# Test 4: Spec file
echo "4. Testing spec file generation..."
python3 scripts/generate_spec.py > /dev/null 2>&1
if [ -f "installer.spec" ]; then
echo " ✓ installer.spec generated"
else
echo " ✗ installer.spec generation failed"
exit 1
fi
# Test 5: Verify spec includes everything
echo "5. Verifying spec includes all resources..."
grep -q "prole-app/dist/Prole Tools.app" installer.spec && \
grep -q "prole-net/prole-scan" installer.spec && \
grep -q "img" installer.spec
if [ $? -eq 0 ]; then
echo " ✓ All resources included in spec"
else
echo " ✗ Some resources missing from spec"
exit 1
fi
# Test 6: Check binary size
echo "6. Checking binary sizes..."
SCAN_SIZE=$(ls -lh prole-net/prole-scan | awk '{print $5}')
echo " prole-scan: $SCAN_SIZE (universal binary)"
APP_SIZE=$(du -sh "prole-app/dist/Prole Tools.app" | awk '{print $1}')
echo " Prole Tools.app: $APP_SIZE"
echo ""
echo "=== All Embedded Resource Tests Passed ==="
echo ""
echo "Resources ready for packaging:"
echo " ✓ Images (proleIcon.png, proleLogo.png, proleLogoSepia.png)"
echo " ✓ Binary (prole-net/prole-scan)"
echo " ✓ App bundle (prole-app/dist/Prole Tools.app)"
echo ""
echo "Build with: make package"