prole/tests/final_test.sh

135 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
echo "=============================================="
echo " FINAL COMPREHENSIVE TEST"
echo " Knoe Database Installer"
echo "=============================================="
echo ""
TESTS_PASSED=0
TESTS_TOTAL=0
test_item() {
TESTS_TOTAL=$((TESTS_TOTAL + 1))
echo -n "[$TESTS_TOTAL] $1... "
shift
if "$@" > /dev/null 2>&1; then
echo "✓"
TESTS_PASSED=$((TESTS_PASSED + 1))
return 0
else
echo "✗"
return 1
fi
}
# Core Features
echo "CORE FEATURES"
test_item "Installer imports" python3 -c "from knoe.ui.screens import KnoeController, get_resource_path"
test_item "Ncurses interface" python3 -c "from knoe.ncurses_installer import run_ncurses_installer"
test_item "Display auto-detection" python3 -c "from knoe.ui.screens import has_display"
test_item "CLI arguments" python3 -m knoe.ui.screens --help
# Build System
echo ""
echo "BUILD SYSTEM"
test_item "Makefile" make help
test_item "Spec generator" python3 scripts/generate_spec.py
test_item "Icon conversion" make build/knoe.icns
# Image Resources
echo ""
echo "IMAGE RESOURCES"
test_item "knoeIcon.png" test -f img/knoeIcon.png
test_item "knoeLogo.png" test -f img/knoeLogo.png
test_item "knoeLogoSepia.png" test -f img/knoeLogoSepia.png
# Binary Resources
echo ""
echo "BINARY RESOURCES"
test_item "network-agent exists" test -f scan/network-agent
test_item "network-agent executable" test -x scan/network-agent
# App Bundle
echo ""
echo "APP BUNDLE"
test_item "Knoe Tools.app exists" test -d "knoe-app/dist/Knoe Tools.app"
# Docker Build Context
echo ""
echo "DOCKER BUILD CONTEXT"
test_item "knoe-db directory" test -d knoe-db
test_item "Dockerfile exists" test -f knoe-db/Dockerfile
# Spec Verification
echo ""
echo "SPEC FILE VERIFICATION"
python3 scripts/generate_spec.py > /dev/null 2>&1
test_item "Spec includes img" grep -q "img" installer.spec
test_item "Spec includes knoe-db" grep -q "knoe-db" installer.spec
test_item "Spec includes network-agent" grep -q "network-agent" installer.spec
test_item "Spec includes Knoe Tools" grep -q "Knoe Tools" installer.spec
# Resource Path Tests
echo ""
echo "RESOURCE PATH RESOLUTION"
test_item "Image paths work" python3 -c "
from pathlib import Path
import sys
sys.path.insert(0, str(Path.cwd()))
from install import get_resource_path
assert get_resource_path('img/knoeIcon.png').exists()
"
test_item "Binary paths work" python3 -c "
from pathlib import Path
import sys
sys.path.insert(0, str(Path.cwd()))
from install import get_resource_path
assert get_resource_path('scan/network-agent').exists()
"
test_item "Docker context works" python3 -c "
from pathlib import Path
import sys
sys.path.insert(0, str(Path.cwd()))
from install import get_resource_path
assert get_resource_path('knoe-db').exists()
"
# Summary
echo ""
echo "=============================================="
echo " RESULTS: $TESTS_PASSED/$TESTS_TOTAL PASSED"
echo "=============================================="
echo ""
if [ $TESTS_PASSED -eq $TESTS_TOTAL ]; then
echo "✓✓✓ ALL TESTS PASSED ✓✓✓"
echo ""
echo "READY TO BUILD:"
echo " make package"
echo ""
echo "FEATURES IMPLEMENTED:"
echo " ✓ Ncurses terminal interface"
echo " ✓ Automatic display detection"
echo " ✓ Static universal binary build system"
echo " ✓ Image resources embedded"
echo " ✓ network-agent binary embedded"
echo " ✓ Knoe Tools.app embedded"
echo " ✓ Docker build context embedded"
echo " ✓ Docker build uses ~/.knoe/build (writable)"
echo ""
echo "PACKAGE WILL INCLUDE:"
echo " • Images (~11 MB)"
echo " • network-agent (6.8 MB)"
echo " • Knoe Tools.app (~12 MB)"
echo " • knoe-db build context (~1-5 MB)"
echo " • Python runtime + deps (~30-50 MB)"
echo " • Total: ~50-100 MB"
echo ""
exit 0
else
echo "✗ SOME TESTS FAILED"
echo "Fix issues before building package"
exit 1
fi