apt-ostree/scripts/validate-compatibility.sh
robojerk 733b202120
Some checks failed
Comprehensive CI/CD Pipeline / Build and Test (push) Failing after 7m50s
Comprehensive CI/CD Pipeline / Security Audit (push) Failing after 8s
Comprehensive CI/CD Pipeline / Package Validation (push) Successful in 2m48s
Comprehensive CI/CD Pipeline / Status Report (push) Has been skipped
fix: Resolve compilation errors in parallel and cache modules
- Fix parallel execution logic to properly handle JoinHandle<Result<R, E>> types
- Use join_all instead of try_join_all for proper Result handling
- Fix double question mark (??) issue in parallel execution methods
- Clean up unused imports in parallel and cache modules
- Ensure all performance optimization modules compile successfully
- Fix CI build failures caused by compilation errors
2025-08-16 15:10:00 -07:00

122 lines
3.3 KiB
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# apt-ostree Compatibility Validator
# Tests CLI compatibility with rpm-ostree
set -e
echo "🔍 Validating apt-ostree compatibility with rpm-ostree..."
echo "=================================================="
# Check if both commands are available
if ! command -v rpm-ostree &> /dev/null; then
echo "❌ rpm-ostree not found. Install it first for comparison."
exit 1
fi
if ! command -v apt-ostree &> /dev/null; then
echo "❌ apt-ostree not found. Build it first with 'cargo build --release'"
exit 1
fi
echo "✅ Both commands available"
# Test command structure
echo ""
echo "📋 Testing command structure..."
# Get command lists
rpm_ostree_commands=$(rpm-ostree --help 2>/dev/null | grep -E "^ [a-z-]+" | awk '{print $1}' | sort)
apt_ostree_commands=$(apt-ostree --help 2>/dev/null | grep -E "^ [a-z-]+" | awk '{print $1}' | sort)
echo "rpm-ostree commands: $(echo "$rpm_ostree_commands" | wc -l)"
echo "apt-ostree commands: $(echo "$apt_ostree_commands" | wc -l)"
# Find missing commands
missing_commands=$(comm -23 <(echo "$rpm_ostree_commands") <(echo "$apt_ostree_commands"))
extra_commands=$(comm -13 <(echo "$rpm_ostree_commands") <(echo "$apt_ostree_commands"))
if [ -n "$missing_commands" ]; then
echo "❌ Missing commands:"
echo "$missing_commands" | sed 's/^/ - /'
else
echo "✅ All rpm-ostree commands are available"
fi
if [ -n "$extra_commands" ]; then
echo " Extra commands:"
echo "$extra_commands" | sed 's/^/ + /'
fi
# Test help command compatibility
echo ""
echo "📖 Testing help command compatibility..."
# Compare help output structure
rpm_help_lines=$(rpm-ostree --help 2>/dev/null | wc -l)
apt_help_lines=$(apt-ostree --help 2>/dev/null | wc -l)
echo "rpm-ostree help lines: $rpm_help_lines"
echo "apt-ostree help lines: $apt_help_lines"
# Test basic command execution
echo ""
echo "🧪 Testing basic command execution..."
# Test status command
echo "Testing 'status' command..."
if apt-ostree status &>/dev/null; then
echo "✅ Status command works"
else
echo "❌ Status command failed"
fi
# Test help command
echo "Testing '--help' flag..."
if apt-ostree --help &>/dev/null; then
echo "✅ Help flag works"
else
echo "❌ Help flag failed"
fi
# Test version command
echo "Testing '--version' flag..."
if apt-ostree --version &>/dev/null; then
echo "✅ Version flag works"
else
echo "❌ Version flag failed"
fi
# Test invalid command handling
echo ""
echo "⚠️ Testing error handling..."
# Test invalid command
echo "Testing invalid command..."
if apt-ostree invalid-command &>/dev/null; then
echo "❌ Invalid command should have failed"
else
echo "✅ Invalid command properly rejected"
fi
# Test invalid flag
echo "Testing invalid flag..."
if apt-ostree --invalid-flag &>/dev/null; then
echo "❌ Invalid flag should have failed"
else
echo "✅ Invalid flag properly rejected"
fi
echo ""
echo "🎯 Compatibility validation complete!"
echo ""
echo "Summary:"
echo "- Commands available: $(echo "$apt_ostree_commands" | wc -l)/$(echo "$rpm_ostree_commands" | wc -l)"
echo "- Missing: $(echo "$missing_commands" | wc -l)"
echo "- Extra: $(echo "$extra_commands" | wc -l)"
if [ -z "$missing_commands" ]; then
echo "🎉 100% command compatibility achieved!"
else
echo "⚠️ Some commands still need implementation"
fi