prole/tests/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/knoeIcon.png',
'img/knoeLogo.png',
'img/knoeLogoSepia.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 "scan/network-agent" ] && [ -x "scan/network-agent" ]; then
echo " ✓ network-agent binary present and executable"
else
echo " ✗ network-agent missing or not executable"
exit 1
fi
# Test 3: App bundle
echo "3. Testing Knoe Tools.app bundle..."
if [ -d "knoe-app/dist/Knoe Tools.app" ]; then
echo " ✓ Knoe Tools.app present"
else
echo " ✗ Knoe 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 "knoe-app/dist/Knoe Tools.app" installer.spec && \
grep -q "scan/network-agent" 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 scan/network-agent | awk '{print $5}')
echo " network-agent: $SCAN_SIZE (universal binary)"
APP_SIZE=$(du -sh "knoe-app/dist/Knoe Tools.app" | awk '{print $1}')
echo " Knoe Tools.app: $APP_SIZE"
echo ""
echo "=== All Embedded Resource Tests Passed ==="
echo ""
echo "Resources ready for packaging:"
echo " ✓ Images (knoeIcon.png, knoeLogo.png, knoeLogoSepia.png)"
echo " ✓ Binary (scan/network-agent)"
echo " ✓ App bundle (knoe-app/dist/Knoe Tools.app)"
echo ""
echo "Build with: make package"