particle-os-tools/test-individual-tools.sh
robojerk 74c7bede5f Initial commit: Particle-OS tools repository
- Complete Particle-OS rebranding from uBlue-OS
- Professional installation system with standardized paths
- Self-initialization system with --init and --reset commands
- Enhanced error messages and dependency checking
- Comprehensive testing infrastructure
- All source scriptlets updated with runtime improvements
- Clean codebase with redundant files moved to archive
- Complete documentation suite
2025-07-11 21:14:33 -07:00

130 lines
No EOL
2.9 KiB
Bash

#!/bin/bash
# Test Individual Particle-OS Tools
# Simple test to check each tool's basic functionality
set -euo pipefail
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
# Test a tool
test_tool() {
local tool_name=$1
local command_name=$2
log_info "Testing $tool_name..."
# Check if tool exists
if ! command -v "$command_name" >/dev/null 2>&1; then
log_error "$tool_name not found in PATH"
return 1
fi
# Test help command
if timeout 10s "$command_name" --help >/dev/null 2>&1; then
log_success "$tool_name --help works"
else
log_error "$tool_name --help failed"
return 1
fi
return 0
}
# Test apt-layer specifically
test_apt_layer() {
log_info "Testing apt-layer specifically..."
if ! command -v apt-layer >/dev/null 2>&1; then
log_error "apt-layer not found"
return 1
fi
# Test status command
if timeout 10s apt-layer status >/dev/null 2>&1; then
log_success "apt-layer status works"
else
log_warning "apt-layer status failed (may need --init)"
fi
# Test init command
if timeout 10s apt-layer --init >/dev/null 2>&1; then
log_success "apt-layer --init works"
else
log_warning "apt-layer --init failed"
fi
}
# Test particle-orchestrator specifically
test_orchestrator() {
log_info "Testing particle-orchestrator specifically..."
if ! command -v particle-orchestrator >/dev/null 2>&1; then
log_error "particle-orchestrator not found"
return 1
fi
# Test help command
if timeout 10s particle-orchestrator help >/dev/null 2>&1; then
log_success "particle-orchestrator help works"
else
log_error "particle-orchestrator help failed"
fi
# Test status command
if timeout 10s particle-orchestrator status >/dev/null 2>&1; then
log_success "particle-orchestrator status works"
else
log_warning "particle-orchestrator status failed"
fi
}
# Main test function
main() {
log_info "Testing Individual Particle-OS Tools"
echo
# Test each tool
test_tool "apt-layer" "apt-layer"
test_tool "composefs" "composefs"
test_tool "bootc" "bootc"
test_tool "bootupd" "bootupd"
test_tool "particle-orchestrator" "particle-orchestrator"
test_tool "particle-oci" "particle-oci"
test_tool "particle-logrotate" "particle-logrotate"
echo
log_info "Testing specific functionality..."
echo
# Test specific functionality
test_apt_layer
test_orchestrator
echo
log_info "Individual tool testing completed!"
}
# Run main function
main "$@"